svn commit: r328076 - head/sys/powerpc/powernv

2018-01-16 Thread Wojciech Macek
Author: wma
Date: Wed Jan 17 07:39:11 2018
New Revision: 328076
URL: https://svnweb.freebsd.org/changeset/base/328076

Log:
  PowerNV: make PowerNV PCIe working on a real hardware
  
  Fixes:
  - map all devices to PE0
  - use 1:1 TCE mapping
  - provide the same TCE mapping for all PEs (not only PE0)
  - add TCE reset and alignment (required by OPAL)
  
  Created by:Wojciech Macek 
  Obtained from: Semihalf
  Sponsored by:  QCM Technologies

Modified:
  head/sys/powerpc/powernv/opal.h
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal.h
==
--- head/sys/powerpc/powernv/opal.h Wed Jan 17 06:31:21 2018
(r328075)
+++ head/sys/powerpc/powernv/opal.h Wed Jan 17 07:39:11 2018
(r328076)
@@ -65,10 +65,13 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_GET_MSI_32 39
 #defineOPAL_GET_MSI_64 40
 #defineOPAL_PCI_MSI_EOI63
+#defineOPAL_PCI_GET_PHB_DIAG_DATA2 64
 #defineOPAL_START_CPU  41
+#defineOPAL_PCI_MAP_PE_DMA_WINDOW  44
 #defineOPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45
 #defineOPAL_RETURN_CPU 69
 #defineOPAL_REINIT_CPUS70
+#defineOPAL_PCI_TCE_KILL   126
 
 /* For OPAL_PCI_SET_PE */
 #defineOPAL_UNMAP_PE   0

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Wed Jan 17 06:31:21 2018
(r328075)
+++ head/sys/powerpc/powernv/opal_pci.c Wed Jan 17 07:39:11 2018
(r328076)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2015-2016 Nathan Whitehorn
+ * Copyright (c) 2017-2018 Semihalf
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,6 +59,12 @@ __FBSDID("$FreeBSD$");
 #include "iommu_if.h"
 #include "opal.h"
 
+#defineOPAL_PCI_TCE_MAX_ENTRIES(1024*1024UL)
+#defineOPAL_PCI_TCE_SEG_SIZE   (16*1024*1024UL)
+#defineOPAL_PCI_TCE_R  (1UL << 0)
+#defineOPAL_PCI_TCE_W  (1UL << 1)
+#definePHB3_TCE_KILL_INVAL_ALL (1UL << 63)
+
 /*
  * Device interface.
  */
@@ -148,6 +155,8 @@ struct opalpci_softc {
vmem_t *msi_vmem;
int msi_base;   /* Base XIVE number */
int base_msi_irq;   /* Base IRQ assigned by FreeBSD to this PIC */
+   uint64_t *tce;  /* TCE table for 1:1 mapping */
+   struct resource *r_reg;
 };
 
 static devclass_t  opalpci_devclass;
@@ -177,12 +186,24 @@ opalpci_probe(device_t dev)
return (BUS_PROBE_GENERIC);
 }
 
+static void
+pci_phb3_tce_invalidate_entire(struct opalpci_softc *sc)
+{
+
+   mb();
+   bus_write_8(sc->r_reg, 0x210, PHB3_TCE_KILL_INVAL_ALL);
+   mb();
+}
+
 static int
 opalpci_attach(device_t dev)
 {
struct opalpci_softc *sc;
cell_t id[2], m64window[6], npe;
int i, err;
+   uint64_t maxmem;
+   uint64_t entries;
+   int rid;
 
sc = device_get_softc(dev);
 
@@ -204,6 +225,15 @@ opalpci_attach(device_t dev)
if (bootverbose)
device_printf(dev, "OPAL ID %#lx\n", sc->phb_id);
 
+   rid = 0;
+   sc->r_reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+   , RF_ACTIVE | RF_SHAREABLE);
+   if (sc->r_reg == NULL) {
+   device_printf(dev, "Failed to allocate PHB[%jd] registers\n",
+   (uintmax_t)sc->phb_id);
+   return (ENXIO);
+   }
+
/*
 * Reset PCI IODA table
 */
@@ -214,47 +244,12 @@ opalpci_attach(device_t dev)
return (ENXIO);
}
while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0)
-   DELAY(1000*err); /* Returns expected delay in ms */
+   DELAY(1000*(err + 1)); /* Returns expected delay in ms */
if (err < 0) {
-   device_printf(dev, "PHB IODA reset poll failed: %d\n", err);
-   return (ENXIO);
+   device_printf(dev, "WARNING: PHB IODA reset poll failed: %d\n", 
err);
}
 
/*
-* Reset everything. Especially important if we have inherited the
-* system from Linux by kexec()
-*/
-#ifdef NOTYET
-   if (bootverbose)
-   device_printf(dev, "Resetting PCI bus\n");
-   err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PHB_COMPLETE, 1);
-   if (err < 0) {
-   device_printf(dev, "PHB reset failed: %d\n", err);
-   return (ENXIO);
-   }
-   while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0)
-   DELAY(1000*err); /* Returns expected delay in ms */
-   if (err < 0) {
-   device_printf(dev, "PHB reset poll 

svn commit: r328075 - head/sbin/fsck_ffs

2018-01-16 Thread Kirk McKusick
Author: mckusick
Date: Wed Jan 17 06:31:21 2018
New Revision: 328075
URL: https://svnweb.freebsd.org/changeset/base/328075

Log:
  Rename cgget => cglookup to clear name space for new libufs function cgget.
  No functional change.

Modified:
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/fsutil.c
  head/sbin/fsck_ffs/inode.c
  head/sbin/fsck_ffs/pass1.c
  head/sbin/fsck_ffs/pass5.c

Modified: head/sbin/fsck_ffs/fsck.h
==
--- head/sbin/fsck_ffs/fsck.h   Wed Jan 17 06:22:10 2018(r328074)
+++ head/sbin/fsck_ffs/fsck.h   Wed Jan 17 06:31:21 2018(r328075)
@@ -437,7 +437,7 @@ voidfreeinodebuf(void);
 void   fsutilinit(void);
 intftypeok(union dinode *dp);
 void   getblk(struct bufarea *bp, ufs2_daddr_t blk, long size);
-struct bufarea *cgget(int cg);
+struct bufarea *cglookup(int cg);
 struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type);
 struct inoinfo *getinoinfo(ino_t inumber);
 union dinode   *getnextinode(ino_t inumber, int rebuildcg);

Modified: head/sbin/fsck_ffs/fsutil.c
==
--- head/sbin/fsck_ffs/fsutil.c Wed Jan 17 06:22:10 2018(r328074)
+++ head/sbin/fsck_ffs/fsutil.c Wed Jan 17 06:31:21 2018(r328075)
@@ -222,7 +222,7 @@ static struct bufarea *cgbufs;  /* header for cylinder 
 static int flushtries; /* number of tries to reclaim memory */
 
 struct bufarea *
-cgget(int cg)
+cglookup(int cg)
 {
struct bufarea *cgbp;
struct cg *cgp;
@@ -791,7 +791,7 @@ allocblk(long frags)
continue;
}
cg = dtog(, i + j);
-   cgbp = cgget(cg);
+   cgbp = cglookup(cg);
cgp = cgbp->b_un.b_cg;
if (!check_cgmagic(cg, cgbp))
return (0);

Modified: head/sbin/fsck_ffs/inode.c
==
--- head/sbin/fsck_ffs/inode.c  Wed Jan 17 06:22:10 2018(r328074)
+++ head/sbin/fsck_ffs/inode.c  Wed Jan 17 06:31:21 2018(r328075)
@@ -673,7 +673,7 @@ allocino(ino_t request, int type)
if (ino == maxino)
return (0);
cg = ino_to_cg(, ino);
-   cgbp = cgget(cg);
+   cgbp = cglookup(cg);
cgp = cgbp->b_un.b_cg;
if (!check_cgmagic(cg, cgbp))
return (0);

Modified: head/sbin/fsck_ffs/pass1.c
==
--- head/sbin/fsck_ffs/pass1.c  Wed Jan 17 06:22:10 2018(r328074)
+++ head/sbin/fsck_ffs/pass1.c  Wed Jan 17 06:31:21 2018(r328075)
@@ -98,7 +98,7 @@ pass1(void)
for (c = 0; c < sblock.fs_ncg; c++) {
inumber = c * sblock.fs_ipg;
setinodebuf(inumber);
-   cgbp = cgget(c);
+   cgbp = cglookup(c);
cgp = cgbp->b_un.b_cg;
rebuildcg = 0;
if (!check_cgmagic(c, cgbp))

Modified: head/sbin/fsck_ffs/pass5.c
==
--- head/sbin/fsck_ffs/pass5.c  Wed Jan 17 06:22:10 2018(r328074)
+++ head/sbin/fsck_ffs/pass5.c  Wed Jan 17 06:31:21 2018(r328075)
@@ -174,7 +174,7 @@ pass5(void)
c * 100 / sblock.fs_ncg);
got_sigalarm = 0;
}
-   cgbp = cgget(c);
+   cgbp = cglookup(c);
cg = cgbp->b_un.b_cg;
if (!cg_chkmagic(cg))
pfatal("CG %d: BAD MAGIC NUMBER\n", c);
___
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: r327950 - in head/sys/powerpc: aim include powerpc ps3

2018-01-16 Thread Nathan Whitehorn



On 01/16/18 11:32, Marius Strobl wrote:

On Mon, Jan 15, 2018 at 03:20:49PM -0800, Nathan Whitehorn wrote:


On 01/15/18 09:53, Konstantin Belousov wrote:

On Mon, Jan 15, 2018 at 09:32:56AM -0800, Nathan Whitehorn wrote:

That seems fine to me. I don't think a less-clumsy way that does not
involve extra indirection is possible. The PHYS_TO_DMAP() returning NULL
is about the best thing I can come up with from a clumsiness standpoint
since plenty of code checks for null pointers already, but doesn't
cleanly handle the rarer case where you want to test for the existence
of direct maps in general without testing some potemkin address.

My one reservation about PMAP_HAS_DMAP or the like as a selector is that
it does not encode the full shape of the problem: one could imagine
having a direct map that only covers a limited range of RAM (I am not
sure whether the existence of dmaplimit on amd64 implies this can happen
with non-device memory in real life), for example. These cases are
currently covered by an assert() in PHYS_TO_DMAP(), whereas having
PHYS_TO_DMAP() return NULL allows a more flexible signalling and the
potential for the calling code to do something reasonable to handle the
error. A single global flag can't convey information at this kind of
granularity. Is this a reasonable concern? Or am I overthinking things?

IMO it is overreaction.  amd64 assumes that all normal memory is covered
by DMAP.  It must never fail.   See, for instance, the implementation
of the sf bufs for it.

If device memory not covered by DMAP can exists, it is the driver problem.
For instance, for NVDIMMs I wrote specific mapping code which establishes
kernel mapping for it, when not covered by EFI memory map and correspondingly
not included into DMAP.


Fair enough. Here's a patch with a new flag (DIRECT_MAP_AVAILABLE). I've
also retooled the sfbuf code to use this rather than its own flags that
mean the same things. The sparc64 part of the patch is untested.
-Nathan
Index: sparc64/include/vmparam.h
===
--- sparc64/include/vmparam.h   (revision 328006)
+++ sparc64/include/vmparam.h   (working copy)
@@ -240,10 +240,12 @@
   */
  #define   ZERO_REGION_SIZEPAGE_SIZE
  
+#include 

+
  #define   SFBUF
  #define   SFBUF_MAP
-#defineSFBUF_OPTIONAL_DIRECT_MAP   dcache_color_ignore
-#include 
-#defineSFBUF_PHYS_DMAP(x)  TLB_PHYS_TO_DIRECT(x)
  
+#define DIRECT_MAP_AVAILABLE	dcache_color_ignore

+#definePHYS_TO_DMAP(x) (DIRECT_MAP_AVAILABLE ? (TLB_PHYS_TO_DIRECT(x) 
: 0)

What dcache_color_ignore actually indicates is the presence of
hardware unaliasing support, in other words the ability to enter
duplicate cacheable mappings into the MMU. While a direct map is
available and used by MD code on all supported CPUs down to US-I,
the former feature is only implemented in the line of Fujitsu SPARC64
processors. IIRC, the sfbuf(9) code can't guarantee that there isn't
already a cacheable mapping from a different VA to the same PA,
which is why it employs dcache_color_ignore. Is that a general
constraint of all MI PHYS_TO_DMAP users or are there consumers
which can guarantee that they are the only users of a mapping
to the same PA?

Marius



With the patch, there are four uses of this in the kernel: the sfbuf 
code, a diagnostic check on page zeroing, part of the EFI runtime code, 
and part of the Linux KBI compat. The second looks safe from this 
perspective and at least some of the others (EFI runtime) are irrelevant 
on sparc64. But I really have no idea what was intended for the 
semantics of this API -- I didn't even know it *was* an MI API until 
this commit. Maybe kib can comment? If this is outside the semantics of 
PHYS_TO_DMAP, then we need to keep the existing sfbuf code.

-Nathan

___
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: r328073 - vendor-sys/libfdt/1.4.6

2018-01-16 Thread Kyle Evans
Author: kevans
Date: Wed Jan 17 05:09:15 2018
New Revision: 328073
URL: https://svnweb.freebsd.org/changeset/base/328073

Log:
  Tag libfdt 1.4.6 following initial import

Added:
  vendor-sys/libfdt/1.4.6/
 - copied from r328072, vendor-sys/libfdt/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: r328072 - in vendor-sys/libfdt: . dist

2018-01-16 Thread Kyle Evans
Author: kevans
Date: Wed Jan 17 05:08:01 2018
New Revision: 328072
URL: https://svnweb.freebsd.org/changeset/base/328072

Log:
  Create vendor-sys/libfdt from libfdt in vendor/dtc
  
  There are no plans at the moment to continue updating GPL dtc in the tree as
  BSDL dtc is slowly replacing it.
  
  We use libfdt in the kernel and loaders, so fork off the libfdt bits from
  vendor/dtc into vendor-sys/libfdt rather than continuing to update
  vendor/dtc when we have no intention of updating anything in userland as a
  result of these imports.
  
  This also leaves us with a vendor branch whose content has a consistent
  license- the entirety of libfdt is dual license, GPL/BSD, although that was
  not a primary concern.

Added:
  vendor-sys/libfdt/
  vendor-sys/libfdt/dist/
 - copied from r328071, vendor/dtc/dist/libfdt/
___
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: r328071 - in head/sys/dev/bhnd: bhndb cores/pci

2018-01-16 Thread Landon J. Fuller
Author: landonf
Date: Wed Jan 17 03:34:26 2018
New Revision: 328071
URL: https://svnweb.freebsd.org/changeset/base/328071

Log:
  bhndb_pci(4): fix incorrect BHND_PCI_SRSH_PI workaround
  
  On a SPROM-less device, the PCI(e) bridge core will be initialized with its
  power-on-reset defaults; this can leave the SPROM-derived BHND_PCI_SRSH_PI
  value pointing to the wrong backplane address. This value is used by the
  PCI core when performing address translation between the static register
  windows in BAR0 that map the PCI core's register block, and backplane
  address space.
  
  Previously, bhndb_pci(4) incorrectly used the potentially invalid static
  BAR0 PCI register windows when attempting to correct the BHND_PCI_SRSH_PI
  value in the PCI core's SPROM shadow.
  
  Instead, we now read/update BHND_PCI_SRSH_PI by fetching the PCI core's
  backplane address from the core enumeration table, and then using a dynamic
  register window to explicitly map the PCI core's register block into BAR0.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/bhndb/bhndb_pcivar.h
  head/sys/dev/bhnd/cores/pci/bhnd_pcireg.h

Modified: head/sys/dev/bhnd/bhndb/bhndb_pci.c
==
--- head/sys/dev/bhnd/bhndb/bhndb_pci.c Tue Jan 16 23:19:57 2018
(r328070)
+++ head/sys/dev/bhnd/bhndb/bhndb_pci.c Wed Jan 17 03:34:26 2018
(r328071)
@@ -75,13 +75,11 @@ __FBSDID("$FreeBSD$");
 #include "bhndb_private.h"
 
 struct bhndb_pci_eio;
+struct bhndb_pci_probe;
 
 static int bhndb_pci_alloc_msi(struct bhndb_pci_softc *sc,
int *msi_count);
-static int bhndb_pci_read_core_table(device_t dev,
-   struct bhnd_chipid *chipid,
-   struct bhnd_core_info **cores, u_int *ncores,
-   bhnd_erom_class_t **eromcls);
+
 static int bhndb_pci_add_children(struct bhndb_pci_softc *sc);
 
 static bhnd_devclass_t bhndb_expected_pci_devclass(device_t dev);
@@ -101,15 +99,30 @@ static voidbhndb_pci_write_core(struct 
bhndb_pci_sof
 static uint32_tbhndb_pci_read_core(struct bhndb_pci_softc *sc,
bus_size_t offset, u_int width);
 
-static voidbhndb_init_sromless_pci_config(
-   struct bhndb_pci_softc *sc);
+static int bhndb_pci_srsh_pi_war(struct bhndb_pci_softc *sc,
+   struct bhndb_pci_probe *probe);
 
 static bus_addr_t  bhndb_pci_sprom_addr(struct bhndb_pci_softc *sc);
 static bus_size_t  bhndb_pci_sprom_size(struct bhndb_pci_softc *sc);
 
-static int bhndb_pci_eio_init(struct bhndb_pci_eio *pio,
-   device_t dev, device_t pci_dev,
-   struct bhndb_host_resources *hr);
+static int bhndb_pci_probe_alloc(struct bhndb_pci_probe **probe,
+   device_t dev, bhnd_devclass_t pci_devclass);
+static voidbhndb_pci_probe_free(struct bhndb_pci_probe *probe);
+
+static int bhndb_pci_probe_copy_core_table(
+   struct bhndb_pci_probe *probe,
+   struct bhnd_core_info **cores, u_int *ncores);
+static voidbhndb_pci_probe_free_core_table(
+   struct bhnd_core_info *cores);
+
+static voidbhndb_pci_probe_write(struct bhndb_pci_probe *sc,
+   bhnd_addr_t addr, bhnd_size_t offset,
+   uint32_t value, u_int width);
+static uint32_tbhndb_pci_probe_read(struct bhndb_pci_probe *sc,
+   bhnd_addr_t addr, bhnd_size_t offset, u_int width);
+
+static voidbhndb_pci_eio_init(struct bhndb_pci_eio *eio,
+   struct bhndb_pci_probe *probe);
 static int bhndb_pci_eio_map(struct bhnd_erom_io *eio,
bhnd_addr_t addr, bhnd_size_t size);
 static uint32_tbhndb_pci_eio_read(struct bhnd_erom_io *eio,
@@ -122,26 +135,50 @@ static struct bhndb_pci_quirk bhndb_pcie_quirks[];
 static struct bhndb_pci_quirk  bhndb_pcie2_quirks[];
 
 static struct bhndb_pci_core bhndb_pci_cores[] = {
-   BHNDB_PCI_CORE(PCI, BHND_PCI_SRSH_PI_OFFSET,
bhndb_pci_quirks),
-   BHNDB_PCI_CORE(PCIE,BHND_PCIE_SRSH_PI_OFFSET,   
bhndb_pcie_quirks),
-   BHNDB_PCI_CORE(PCIE2,   BHND_PCIE_SRSH_PI_OFFSET,   
bhndb_pcie2_quirks),
+   BHNDB_PCI_CORE(PCI, bhndb_pci_quirks),
+   BHNDB_PCI_CORE(PCIE,bhndb_pcie_quirks),
+   BHNDB_PCI_CORE(PCIE2,   bhndb_pcie2_quirks),
BHNDB_PCI_CORE_END
 };
 
 /* bhndb_pci erom I/O instance state */
 struct bhndb_pci_eio {
struct bhnd_erom_io  eio;
-   device_t dev;   /**< bridge device */

svn commit: r328070 - in head/sys/cam: . ctl mmc nvme scsi

2018-01-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jan 16 23:19:57 2018
New Revision: 328070
URL: https://svnweb.freebsd.org/changeset/base/328070

Log:
  SPDX: finish tagging sys/cam.

Modified:
  head/sys/cam/cam_iosched.c
  head/sys/cam/cam_iosched.h
  head/sys/cam/ctl/ctl_ha.c
  head/sys/cam/ctl/ctl_tpc.c
  head/sys/cam/ctl/ctl_tpc.h
  head/sys/cam/ctl/ctl_tpc_local.c
  head/sys/cam/mmc/mmc.h
  head/sys/cam/mmc/mmc_all.h
  head/sys/cam/mmc/mmc_da.c
  head/sys/cam/mmc/mmc_xpt.c
  head/sys/cam/nvme/nvme_all.c
  head/sys/cam/nvme/nvme_all.h
  head/sys/cam/nvme/nvme_da.c
  head/sys/cam/nvme/nvme_xpt.c
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_enc.h
  head/sys/cam/scsi/scsi_ses.h

Modified: head/sys/cam/cam_iosched.c
==
--- head/sys/cam/cam_iosched.c  Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/cam_iosched.c  Tue Jan 16 23:19:57 2018(r328070)
@@ -1,6 +1,8 @@
 /*-
  * CAM IO Scheduler Interface
  *
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Netflix, Inc.
  * All rights reserved.
  *

Modified: head/sys/cam/cam_iosched.h
==
--- head/sys/cam/cam_iosched.h  Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/cam_iosched.h  Tue Jan 16 23:19:57 2018(r328070)
@@ -1,6 +1,8 @@
 /*-
  * CAM IO Scheduler Interface
  *
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Netflix, Inc.
  * All rights reserved.
  *

Modified: head/sys/cam/ctl/ctl_ha.c
==
--- head/sys/cam/ctl/ctl_ha.c   Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/ctl/ctl_ha.c   Tue Jan 16 23:19:57 2018(r328070)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Alexander Motin 
  * All rights reserved.
  *

Modified: head/sys/cam/ctl/ctl_tpc.c
==
--- head/sys/cam/ctl/ctl_tpc.c  Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/ctl/ctl_tpc.c  Tue Jan 16 23:19:57 2018(r328070)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2014 Alexander Motin 
  * All rights reserved.
  *

Modified: head/sys/cam/ctl/ctl_tpc.h
==
--- head/sys/cam/ctl/ctl_tpc.h  Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/ctl/ctl_tpc.h  Tue Jan 16 23:19:57 2018(r328070)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2014 Alexander Motin 
  * All rights reserved.
  *

Modified: head/sys/cam/ctl/ctl_tpc_local.c
==
--- head/sys/cam/ctl/ctl_tpc_local.cTue Jan 16 23:18:52 2018
(r328069)
+++ head/sys/cam/ctl/ctl_tpc_local.cTue Jan 16 23:19:57 2018
(r328070)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2014 Alexander Motin 
  * Copyright (c) 2004, 2005 Silicon Graphics International Corp.
  * All rights reserved.

Modified: head/sys/cam/mmc/mmc.h
==
--- head/sys/cam/mmc/mmc.h  Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/mmc/mmc.h  Tue Jan 16 23:19:57 2018(r328070)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2014-2016 Ilya Bakulin.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/cam/mmc/mmc_all.h
==
--- head/sys/cam/mmc/mmc_all.h  Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/mmc/mmc_all.h  Tue Jan 16 23:19:57 2018(r328070)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2014-2016 Ilya Bakulin.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Jan 16 23:18:52 2018(r328069)
+++ head/sys/cam/mmc/mmc_da.c   Tue Jan 16 23:19:57 2018(r328070)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2006 Bernd Walter 
  * Copyright (c) 2006 M. Warner Losh 
  * Copyright (c) 2009 Alexander Motin 

Modified: head/sys/cam/mmc/mmc_xpt.c
==
--- head/sys/cam/mmc/mmc_xpt.c  Tue Jan 16 23:18:52 2018

svn commit: r328069 - head/sys/x86/isa

2018-01-16 Thread Ian Lepore
Author: ian
Date: Tue Jan 16 23:18:52 2018
New Revision: 328069
URL: https://svnweb.freebsd.org/changeset/base/328069

Log:
  Remove redundant critical_enter/exit() calls.  The block of code delimited
  by these calls is now protected by a spin mutex (obscured within the
  RTC_LOCK/RTC_UNLOCK macros).
  
  Reported by:  bde@

Modified:
  head/sys/x86/isa/atrtc.c

Modified: head/sys/x86/isa/atrtc.c
==
--- head/sys/x86/isa/atrtc.cTue Jan 16 23:14:12 2018(r328068)
+++ head/sys/x86/isa/atrtc.cTue Jan 16 23:18:52 2018(r328069)
@@ -370,7 +370,6 @@ atrtc_gettime(device_t dev, struct timespec *ts)
mtx_lock(_time_lock);
while (rtcin(RTC_STATUSA) & RTCSA_TUP)
continue;
-   critical_enter();
RTC_LOCK;
bct.sec  = rtcin_locked(RTC_SEC);
bct.min  = rtcin_locked(RTC_MIN);
@@ -382,7 +381,6 @@ atrtc_gettime(device_t dev, struct timespec *ts)
bct.year |= rtcin_locked(RTC_CENTURY) << 8;
 #endif
RTC_UNLOCK;
-   critical_exit();
mtx_unlock(_time_lock);
/* dow is unused in timespec conversion and we have no nsec info. */
bct.dow  = 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: r328068 - head/sys/x86/isa

2018-01-16 Thread Ian Lepore
Author: ian
Date: Tue Jan 16 23:14:12 2018
New Revision: 328068
URL: https://svnweb.freebsd.org/changeset/base/328068

Log:
  Move some code around and rename a couple variables; no functional changes.
  
  The static atrtc_set() function was called only from clock_settime(), so
  just move its contents entirely into clock_settime() and delete atrtc_set().
  
  Rename the struct bcd_clocktime variables from 'ct' to 'bct'.  I had
  originally wanted to emphasize how identical the clocktime and bcd_clocktime
  structs were, but things evolved to the point where the structs are not at
  all identical anymore, so now emphasizing the difference seems better.

Modified:
  head/sys/x86/isa/atrtc.c

Modified: head/sys/x86/isa/atrtc.c
==
--- head/sys/x86/isa/atrtc.cTue Jan 16 23:08:25 2018(r328067)
+++ head/sys/x86/isa/atrtc.cTue Jan 16 23:14:12 2018(r328068)
@@ -169,39 +169,6 @@ atrtc_restore(void)
rtcin(RTC_INTR);
 }
 
-static void
-atrtc_set(struct timespec *ts)
-{
-   struct bcd_clocktime ct;
-
-   clock_ts_to_bcd(ts, , false);
-
-   mtx_lock(_time_lock);
-   RTC_LOCK;
-
-   /* Disable RTC updates and interrupts. */
-   rtcout_locked(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
-
-   /* Write all the time registers. */
-   rtcout_locked(RTC_SEC,   ct.sec);
-   rtcout_locked(RTC_MIN,   ct.min);
-   rtcout_locked(RTC_HRS,   ct.hour);
-   rtcout_locked(RTC_WDAY,  ct.dow + 1);
-   rtcout_locked(RTC_DAY,   ct.day);
-   rtcout_locked(RTC_MONTH, ct.mon);
-   rtcout_locked(RTC_YEAR,  ct.year & 0xff);
-#ifdef USE_RTC_CENTURY
-   rtcout_locked(RTC_CENTURY, ct.year >> 8);
-#endif
-
-   /* Re-enable RTC updates and interrupts. */
-   rtcout_locked(RTC_STATUSB, rtc_statusb);
-   rtcin_locked(RTC_INTR);
-
-   RTC_UNLOCK;
-   mtx_unlock(_time_lock);
-}
-
 /**
  * RTC driver for subr_rtc
  */
@@ -348,15 +315,44 @@ atrtc_resume(device_t dev)
 static int
 atrtc_settime(device_t dev __unused, struct timespec *ts)
 {
+   struct bcd_clocktime bct;
 
-   atrtc_set(ts);
+   clock_ts_to_bcd(ts, , false);
+
+   mtx_lock(_time_lock);
+   RTC_LOCK;
+
+   /* Disable RTC updates and interrupts.  */
+   rtcout_locked(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
+
+   /* Write all the time registers. */
+   rtcout_locked(RTC_SEC,   bct.sec);
+   rtcout_locked(RTC_MIN,   bct.min);
+   rtcout_locked(RTC_HRS,   bct.hour);
+   rtcout_locked(RTC_WDAY,  bct.dow + 1);
+   rtcout_locked(RTC_DAY,   bct.day);
+   rtcout_locked(RTC_MONTH, bct.mon);
+   rtcout_locked(RTC_YEAR,  bct.year & 0xff);
+#ifdef USE_RTC_CENTURY
+   rtcout_locked(RTC_CENTURY, bct.year >> 8);
+#endif
+
+   /*
+* Re-enable RTC updates and interrupts.
+*/
+   rtcout_locked(RTC_STATUSB, rtc_statusb);
+   rtcin_locked(RTC_INTR);
+
+   RTC_UNLOCK;
+   mtx_unlock(_time_lock);
+
return (0);
 }
 
 static int
 atrtc_gettime(device_t dev, struct timespec *ts)
 {
-   struct bcd_clocktime ct;
+   struct bcd_clocktime bct;
 
/* Look if we have a RTC present and the time is valid */
if (!(rtcin(RTC_STATUSD) & RTCSD_PWR)) {
@@ -376,22 +372,22 @@ atrtc_gettime(device_t dev, struct timespec *ts)
continue;
critical_enter();
RTC_LOCK;
-   ct.sec  = rtcin_locked(RTC_SEC);
-   ct.min  = rtcin_locked(RTC_MIN);
-   ct.hour = rtcin_locked(RTC_HRS);
-   ct.day  = rtcin_locked(RTC_DAY);
-   ct.mon  = rtcin_locked(RTC_MONTH);
-   ct.year = rtcin_locked(RTC_YEAR);
+   bct.sec  = rtcin_locked(RTC_SEC);
+   bct.min  = rtcin_locked(RTC_MIN);
+   bct.hour = rtcin_locked(RTC_HRS);
+   bct.day  = rtcin_locked(RTC_DAY);
+   bct.mon  = rtcin_locked(RTC_MONTH);
+   bct.year = rtcin_locked(RTC_YEAR);
 #ifdef USE_RTC_CENTURY
-   ct.year |= rtcin_locked(RTC_CENTURY) << 8;
+   bct.year |= rtcin_locked(RTC_CENTURY) << 8;
 #endif
RTC_UNLOCK;
critical_exit();
mtx_unlock(_time_lock);
/* dow is unused in timespec conversion and we have no nsec info. */
-   ct.dow  = 0;
-   ct.nsec = 0;
-   return (clock_bcd_to_ts(, ts, false));
+   bct.dow  = 0;
+   bct.nsec = 0;
+   return (clock_bcd_to_ts(, ts, false));
 }
 
 static device_method_t atrtc_methods[] = {
___
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: r328067 - head/sys/cam/scsi

2018-01-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jan 16 23:08:25 2018
New Revision: 328067
URL: https://svnweb.freebsd.org/changeset/base/328067

Log:
  scsi_ch.c: Small cleanups to the comments.
  
  Move the the NetBSD tag near to the related licence. Update it to reflect
  better the point where we started diverging.
  
  Use grouping parenthesis for the SPDX tag.
  
  No functional change.

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

Modified: head/sys/cam/scsi/scsi_ch.c
==
--- head/sys/cam/scsi/scsi_ch.c Tue Jan 16 21:58:38 2018(r328066)
+++ head/sys/cam/scsi/scsi_ch.c Tue Jan 16 23:08:25 2018(r328067)
@@ -1,5 +1,5 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-4-Clause
+ * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-4-Clause)
  *
  * Copyright (c) 1997 Justin T. Gibbs.
  * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
@@ -27,12 +27,6 @@
  * SUCH DAMAGE.
  */
 
-/*
- * Derived from the NetBSD SCSI changer driver.
- *
- * $NetBSD: ch.c,v 1.32 1998/01/12 09:49:12 thorpej Exp $
- *
- */
 /*-
  * Copyright (c) 1996, 1997 Jason R. Thorpe 
  * All rights reserved.
@@ -67,6 +61,8 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * $NetBSD: ch.c,v 1.34 1998/08/31 22:28:06 cgd Exp $
  */
 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r328066 - head/sys/netinet

2018-01-16 Thread Michael Tuexen
Author: tuexen
Date: Tue Jan 16 21:58:38 2018
New Revision: 328066
URL: https://svnweb.freebsd.org/changeset/base/328066

Log:
  Fix a bug related to fast retransmissions.
  
  When processing a SACK advancing the cumtsn-ack in fast recovery,
  increment the miss-indications for all TSN's reported as missing.
  
  Thanks to Fabian Ising for finding the bug and to Timo Voelker
  for provinding a fix.
  
  This fix moves also CMT related initialisation of some variables
  to a more appropriate place.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Tue Jan 16 21:43:57 2018
(r328065)
+++ head/sys/netinet/sctp_indata.c  Tue Jan 16 21:58:38 2018
(r328066)
@@ -3364,7 +3364,8 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
}
}
}
-   if (SCTP_TSN_GT(tp1->rec.data.tsn, 
asoc->this_sack_highest_gap)) {
+   if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->this_sack_highest_gap) 
&&
+   !(accum_moved && asoc->fast_retran_loss_recovery)) {
/* we are beyond the tsn in the sack  */
break;
}
@@ -3388,8 +3389,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
 * FR using this SACK.
 */
continue;
-   } else if (tp1->whoTo && SCTP_TSN_GT(tp1->rec.data.tsn,
-   tp1->whoTo->this_sack_highest_newack)) {
+   } else if (tp1->whoTo &&
+   SCTP_TSN_GT(tp1->rec.data.tsn,
+   tp1->whoTo->this_sack_highest_newack) &&
+   !(accum_moved && asoc->fast_retran_loss_recovery)) {
/*
 * CMT: New acks were receieved for data sent to
 * this dest. But no new acks were seen for data
@@ -3674,7 +3677,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
tp1->whoTo->find_pseudo_cumack = 1;
tp1->whoTo->find_rtx_pseudo_cumack = 1;
}
-   } else {/* CMT is OFF */
+   } else {/* CMT is OFF */
 
 #ifdef SCTP_FR_TO_ALTERNATE
/* Can we find an alternate? */
@@ -4603,6 +4606,13 @@ hopeless_peer:
if (stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) {

(*stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) (stcb, net);
}
+   /*
+* CMT: SFR algo (and HTNA) - this_sack_highest_newack has
+* to be greater than the cumack. Also reset saw_newack to 0
+* for all dests.
+*/
+   net->saw_newack = 0;
+   net->this_sack_highest_newack = last_tsn;
}
/* process the new consecutive TSN first */
TAILQ_FOREACH(tp1, >sent_queue, sctp_next) {
@@ -4728,16 +4738,6 @@ hopeless_peer:
asoc->this_sack_highest_gap = last_tsn;
 
if ((num_seg > 0) || (num_nr_seg > 0)) {
-
-   /*
-* CMT: SFR algo (and HTNA) - this_sack_highest_newack has
-* to be greater than the cumack. Also reset saw_newack to 0
-* for all dests.
-*/
-   TAILQ_FOREACH(net, >nets, sctp_next) {
-   net->saw_newack = 0;
-   net->this_sack_highest_newack = last_tsn;
-   }
 
/*
 * thisSackHighestGap will increase while handling NEW
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r328064 - in head: usr.bin/xinstall usr.sbin/makefs

2018-01-16 Thread Alex Richardson
Author: arichardson
Date: Tue Jan 16 21:43:46 2018
New Revision: 328064
URL: https://svnweb.freebsd.org/changeset/base/328064

Log:
  Allow xinstall and makefs to be crossbuilt on Linux and Mac
  
  I need these tools in order to install the crossbuilt FreeBSD and create a
  disk image. Linux does not have a st_flags in struct stat so unfortunately
  I need a bunch of ugly ifdefs. The resulting binaries allow me to
  sucessfully install a MIPS64 world and create a disk-image that boots.
  
  Reviewed By:  brooks, bdrewery, emaste
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D13307

Modified:
  head/usr.bin/xinstall/Makefile
  head/usr.bin/xinstall/xinstall.c
  head/usr.sbin/makefs/ffs.c
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.bin/xinstall/Makefile
==
--- head/usr.bin/xinstall/Makefile  Tue Jan 16 21:43:36 2018
(r328063)
+++ head/usr.bin/xinstall/Makefile  Tue Jan 16 21:43:46 2018
(r328064)
@@ -11,6 +11,7 @@ MAN=  install.1
 .PATH: ${SRCTOP}/contrib/mtree
 CFLAGS+=   -I${SRCTOP}/contrib/mtree
 CFLAGS+=   -I${SRCTOP}/lib/libnetbsd
+CFLAGS+=   -DHAVE_STRUCT_STAT_ST_FLAGS=1
 
 LIBADD=md
 

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cTue Jan 16 21:43:36 2018
(r328063)
+++ head/usr.bin/xinstall/xinstall.cTue Jan 16 21:43:46 2018
(r328064)
@@ -533,9 +533,11 @@ do_link(const char *from_name, const char *to_name,
unlink(tmpl);
err(EX_OSERR, "%s", to_name);
}
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (target_sb->st_flags & NOCHANGEBITS)
(void)chflags(to_name, target_sb->st_flags &
 ~NOCHANGEBITS);
+#endif
if (verbose)
printf("install: link %s -> %s\n",
from_name, to_name);
@@ -579,9 +581,11 @@ do_symlink(const char *from_name, const char *to_name,
(void)unlink(tmpl);
err(EX_OSERR, "%s", to_name);
}
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (target_sb->st_flags & NOCHANGEBITS)
(void)chflags(to_name, target_sb->st_flags &
 ~NOCHANGEBITS);
+#endif
if (verbose)
printf("install: symlink %s -> %s\n",
from_name, to_name);
@@ -779,9 +783,11 @@ install(const char *from_name, const char *to_name, u_
if (target && !safecopy) {
if (to_sb.st_mode & S_IFDIR && rmdir(to_name) == -1)
err(EX_OSERR, "%s", to_name);
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name,
to_sb.st_flags & ~NOCHANGEBITS);
+#endif
unlink(to_name);
}
makelink(from_name, to_name, target ? _sb : NULL);
@@ -893,9 +899,11 @@ install(const char *from_name, const char *to_name, u_
 * and the files are different (or just not compared).
 */
if (tempcopy && !files_match) {
+#if HAVE_STRUCT_STAT_ST_FLAGS
/* Try to turn off the immutable bits. */
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name, to_sb.st_flags & ~NOCHANGEBITS);
+#endif
if (dobackup) {
if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s", 
to_name,
suffix) != strlen(to_name) + strlen(suffix)) {
@@ -907,8 +915,10 @@ install(const char *from_name, const char *to_name, u_
(void)printf("install: %s -> %s\n", to_name, 
backup);
if (unlink(backup) < 0 && errno != ENOENT) {
serrno = errno;
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name, to_sb.st_flags);
+#endif
unlink(tempfile);
errno = serrno;
err(EX_OSERR, "unlink: %s", backup);
@@ -916,8 +926,10 @@ install(const char *from_name, const char *to_name, u_
if (link(to_name, backup) < 0) {
serrno = errno;
unlink(tempfile);
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (to_sb.st_flags & NOCHANGEBITS)
(void)chflags(to_name, to_sb.st_flags);
+#endif
 

svn commit: r328063 - head

2018-01-16 Thread Alex Richardson
Author: arichardson
Date: Tue Jan 16 21:43:36 2018
New Revision: 328063
URL: https://svnweb.freebsd.org/changeset/base/328063

Log:
  Don't build share/syscons in build-tools stage if MK_SYSCONS == "no"
  
  Reviewed By:  emaste, jhb
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D12926

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jan 16 21:43:21 2018(r328062)
+++ head/Makefile.inc1  Tue Jan 16 21:43:36 2018(r328063)
@@ -1976,7 +1976,7 @@ bootstrap-tools: ${_bt}-${_tool}
 #
 # build-tools: Build special purpose build tools
 #
-.if !defined(NO_SHARE)
+.if !defined(NO_SHARE) && ${MK_SYSCONS} != "no"
 _share=share/syscons/scrnmaps
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r328065 - head/sys/conf

2018-01-16 Thread Alex Richardson
Author: arichardson
Date: Tue Jan 16 21:43:57 2018
New Revision: 328065
URL: https://svnweb.freebsd.org/changeset/base/328065

Log:
  Use ln -n instead of -h to allow building the kernel on Linux
  
  Both flags do the same thing but -n is more widely supported.
  
  Reviewed By:  jhb, emaste
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D13936

Modified:
  head/sys/conf/kern.post.mk
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Tue Jan 16 21:43:46 2018(r328064)
+++ head/sys/conf/kern.post.mk  Tue Jan 16 21:43:57 2018(r328065)
@@ -300,7 +300,7 @@ ${_ILINKS}:
path=${S}/${.TARGET}/include ;; \
esac ; \
${ECHO} ${.TARGET} "->" $$path ; \
-   ln -fhs $$path ${.TARGET}
+   ln -fns $$path ${.TARGET}
 
 # .depend needs include links so we remove them only together.
 kernel-cleandepend: .PHONY

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Tue Jan 16 21:43:46 2018(r328064)
+++ head/sys/conf/kmod.mk   Tue Jan 16 21:43:57 2018(r328065)
@@ -292,7 +292,7 @@ ${_ILINKS}:
esac ; \
path=`(cd $$path && /bin/pwd)` ; \
${ECHO} ${.TARGET:T} "->" $$path ; \
-   ln -fhs $$path ${.TARGET:T}
+   ln -fns $$path ${.TARGET:T}
 
 CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS}
 
___
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: r328062 - head/lib/libnetbsd

2018-01-16 Thread Alex Richardson
Author: arichardson
Date: Tue Jan 16 21:43:21 2018
New Revision: 328062
URL: https://svnweb.freebsd.org/changeset/base/328062

Log:
  libnetbsd: Make the function declaration of efopen() match the definition
  
  In order to crossbuild FreeBSD on Mac/Linux I also need to build libnetbsd
  and FILE* is not equal to struct __sFILE on those platforms.
  
  Reviewed By:  brooks, emaste
  Approved By:  jhb (mentor)
  Differential Revision: https://reviews.freebsd.org/D13305

Modified:
  head/lib/libnetbsd/util.h

Modified: head/lib/libnetbsd/util.h
==
--- head/lib/libnetbsd/util.h   Tue Jan 16 20:35:54 2018(r328061)
+++ head/lib/libnetbsd/util.h   Tue Jan 16 21:43:21 2018(r328062)
@@ -37,6 +37,7 @@
 
 #include 
 #include 
+#include 
 
 void   (*esetfunc(void (*)(int, const char *, ...)))(int, const char *, ...);
 size_t  estrlcpy(char *, const char *, size_t);
@@ -46,7 +47,7 @@ char  *estrndup(const char *, size_t);
 void   *emalloc(size_t);
 void   *ecalloc(size_t, size_t);
 void   *erealloc(void *, size_t);
-struct __sFILE *efopen(const char *, const char *);
+FILE   *efopen(const char *, const char *);
 int easprintf(char ** __restrict, const char * __restrict, ...)
__printflike(2, 3);
 int evasprintf(char ** __restrict, const char * __restrict, __va_list)
___
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: r328060 - head/usr.sbin/service

2018-01-16 Thread Jilles Tjoelker
On Tue, Jan 16, 2018 at 08:14:31PM +, Kyle Evans wrote:
> Author: kevans
> Date: Tue Jan 16 20:14:31 2018
> New Revision: 328060
> URL: https://svnweb.freebsd.org/changeset/base/328060

> Log:
>   service(8): Reset OPTIND properly now that we're parsing args twice

>   r328032 introduced a second round of argument parsing to proxy the request
>   through to a jail as needed, but failed to reset OPTIND before getting to
>   the second round of parsing to allow other flags to be set.

>   Reported by:Oleg Ginzburg 

> Modified:
>   head/usr.sbin/service/service.sh

> Modified: head/usr.sbin/service/service.sh
> ==
> --- head/usr.sbin/service/service.sh  Tue Jan 16 20:02:07 2018
> (r328059)
> +++ head/usr.sbin/service/service.sh  Tue Jan 16 20:14:31 2018
> (r328060)
> @@ -79,6 +79,7 @@ if [ -n "$JAIL" ]; then
>   exit $?
>  fi
>  
> +OPTIND=1
>  while getopts ${accepted_argstr} COMMAND_LINE_ARGUMENT ; do
>   case "${COMMAND_LINE_ARGUMENT}" in
>   e)  ENABLED=eopt ;;

Hi,

Although this solves the immediate problem of all existing options
becoming no-ops, the new -j option still behaves strangely if it is not
used with "-j" and the jail name as the first two arguments, since the
shift commands will shift away other arguments.

One way to fix this avoids depending on the exact options known by the
jailed service(8) and accepts that the -j option must be first (either
-j JAIL as two arguments or -jJAIL as one argument). This parsing would
be open-coded and there would be only one getopts loop.

Another way to fix this allows using the -j option as any other option.
This would also use one getopts loop and reconstruct a command line for
the jailed service(8) based on the variables like ENABLED (the values
for set options can be changed to simplify this since the rest of the
script only cares about non-empty or not).

-- 
Jilles Tjoelker
___
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: r328061 - head/stand/efi/libefi

2018-01-16 Thread Toomas Soome
Author: tsoome
Date: Tue Jan 16 20:35:54 2018
New Revision: 328061
URL: https://svnweb.freebsd.org/changeset/base/328061

Log:
  utf8_to_ucs2() should check for malloc failure
  
  utf8_to_ucs2() is calling malloc() without checking the result.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D13933

Modified:
  head/stand/efi/libefi/efichar.c

Modified: head/stand/efi/libefi/efichar.c
==
--- head/stand/efi/libefi/efichar.c Tue Jan 16 20:14:31 2018
(r328060)
+++ head/stand/efi/libefi/efichar.c Tue Jan 16 20:35:54 2018
(r328061)
@@ -139,6 +139,8 @@ utf8_to_ucs2(const char *name, efi_char **nmp, size_t 
sz = strlen(name) * 2 + 2;
if (*nmp == NULL)
*nmp = malloc(sz);
+   if (*nmp == NULL)
+   return (ENOMEM);
nm = *nmp;
*len = sz;
 
___
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: r328060 - head/usr.sbin/service

2018-01-16 Thread Kyle Evans
Author: kevans
Date: Tue Jan 16 20:14:31 2018
New Revision: 328060
URL: https://svnweb.freebsd.org/changeset/base/328060

Log:
  service(8): Reset OPTIND properly now that we're parsing args twice
  
  r328032 introduced a second round of argument parsing to proxy the request
  through to a jail as needed, but failed to reset OPTIND before getting to
  the second round of parsing to allow other flags to be set.
  
  Reported by:  Oleg Ginzburg 

Modified:
  head/usr.sbin/service/service.sh

Modified: head/usr.sbin/service/service.sh
==
--- head/usr.sbin/service/service.shTue Jan 16 20:02:07 2018
(r328059)
+++ head/usr.sbin/service/service.shTue Jan 16 20:14:31 2018
(r328060)
@@ -79,6 +79,7 @@ if [ -n "$JAIL" ]; then
exit $?
 fi
 
+OPTIND=1
 while getopts ${accepted_argstr} COMMAND_LINE_ARGUMENT ; do
case "${COMMAND_LINE_ARGUMENT}" in
e)  ENABLED=eopt ;;
___
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: r328059 - head/usr.bin/truss

2018-01-16 Thread Michael Tuexen
Author: tuexen
Date: Tue Jan 16 20:02:07 2018
New Revision: 328059
URL: https://svnweb.freebsd.org/changeset/base/328059

Log:
  Improve the printing of cmgs when the length is 0. Fix error handling.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Tue Jan 16 19:57:30 2018
(r328058)
+++ head/usr.bin/truss/syscalls.c   Tue Jan 16 20:02:07 2018
(r328059)
@@ -1493,10 +1493,15 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct 
bool first;
 
len = msghdr->msg_controllen;
+   if (len == 0) {
+   fputs("{}", fp);
+   return;
+   }
cmsgbuf = calloc(1, len);
if (get_struct(pid, msghdr->msg_control, cmsgbuf, len) == -1) {
fprintf(fp, "%p", msghdr->msg_control);
free(cmsgbuf);
+   return;
}
msghdr->msg_control = cmsgbuf;
first = true;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r328058 - head/usr.bin/truss

2018-01-16 Thread Michael Tuexen
Author: tuexen
Date: Tue Jan 16 19:57:30 2018
New Revision: 328058
URL: https://svnweb.freebsd.org/changeset/base/328058

Log:
  Using %p already prints "0x", so don't do it explicitly.

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Tue Jan 16 19:41:18 2018
(r328057)
+++ head/usr.bin/truss/syscalls.c   Tue Jan 16 19:57:30 2018
(r328058)
@@ -1176,14 +1176,14 @@ print_sockaddr(FILE *fp, struct trussinfo *trussinfo, 
}
/* If the length is too small, just bail. */
if (len < sizeof(*sa)) {
-   fprintf(fp, "0x%p", arg);
+   fprintf(fp, "%p", arg);
return;
}
 
sa = calloc(1, len);
if (get_struct(pid, arg, sa, len) == -1) {
free(sa);
-   fprintf(fp, "0x%p", arg);
+   fprintf(fp, "%p", arg);
return;
}
 
@@ -1240,7 +1240,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi
bool buf_truncated, iov_truncated;
 
if (iovcnt <= 0) {
-   fprintf(fp, "0x%p", arg);
+   fprintf(fp, "%p", arg);
return;
}
if (iovcnt > IOV_LIMIT) {
@@ -1250,7 +1250,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi
iov_truncated = false;
}
if (get_struct(pid, arg, , iovcnt * sizeof(struct iovec)) == -1) {
-   fprintf(fp, "0x%p", arg);
+   fprintf(fp, "%p", arg);
return;
}
 
@@ -1278,7 +1278,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi
buf_truncated ? "..." : "");
free(tmp3);
} else {
-   fprintf(fp, "0x%p", iov[i].iov_base);
+   fprintf(fp, "%p", iov[i].iov_base);
}
fprintf(fp, ",%zu}", iov[i].iov_len);
}
@@ -1495,7 +1495,7 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct 
len = msghdr->msg_controllen;
cmsgbuf = calloc(1, len);
if (get_struct(pid, msghdr->msg_control, cmsgbuf, len) == -1) {
-   fprintf(fp, "0x%p", msghdr);
+   fprintf(fp, "%p", msghdr->msg_control);
free(cmsgbuf);
}
msghdr->msg_control = cmsgbuf;
___
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: r328057 - head/sys/opencrypto

2018-01-16 Thread John Baldwin
Author: jhb
Date: Tue Jan 16 19:41:18 2018
New Revision: 328057
URL: https://svnweb.freebsd.org/changeset/base/328057

Log:
  Split crp_buf into a union.
  
  This adds explicit crp_mbuf and crp_uio pointers of the right type to
  replace casts of crp_buf.  This does not sweep through changing existing
  code, but new code should use the correct fields instead of casts.
  
  Reviewed by:  kib
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D13927

Modified:
  head/sys/opencrypto/cryptodev.h

Modified: head/sys/opencrypto/cryptodev.h
==
--- head/sys/opencrypto/cryptodev.h Tue Jan 16 19:29:32 2018
(r328056)
+++ head/sys/opencrypto/cryptodev.h Tue Jan 16 19:41:18 2018
(r328057)
@@ -425,7 +425,11 @@ struct cryptop {
 * if CRYPTO_F_ASYNC flags is set
 */
 
-   caddr_t crp_buf;/* Data to be processed */
+   union {
+   caddr_t crp_buf;/* Data to be processed */
+   struct mbuf *crp_mbuf;
+   struct uio  *crp_uio;
+   };
void *  crp_opaque; /* Opaque pointer, passed along */
struct cryptodesc *crp_desc;/* Linked list of processing 
descriptors */
 
@@ -538,5 +542,6 @@ extern  void crypto_copydata(int flags, caddr_t buf, in
caddr_t out);
 extern int crypto_apply(int flags, caddr_t buf, int off, int len,
int (*f)(void *, void *, u_int), void *arg);
+
 #endif /* _KERNEL */
 #endif /* _CRYPTO_CRYPTO_H_ */
___
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: r327950 - in head/sys/powerpc: aim include powerpc ps3

2018-01-16 Thread Marius Strobl
On Mon, Jan 15, 2018 at 03:20:49PM -0800, Nathan Whitehorn wrote:
> 
> 
> On 01/15/18 09:53, Konstantin Belousov wrote:
> > On Mon, Jan 15, 2018 at 09:32:56AM -0800, Nathan Whitehorn wrote:
> >> That seems fine to me. I don't think a less-clumsy way that does not
> >> involve extra indirection is possible. The PHYS_TO_DMAP() returning NULL
> >> is about the best thing I can come up with from a clumsiness standpoint
> >> since plenty of code checks for null pointers already, but doesn't
> >> cleanly handle the rarer case where you want to test for the existence
> >> of direct maps in general without testing some potemkin address.
> >>
> >> My one reservation about PMAP_HAS_DMAP or the like as a selector is that
> >> it does not encode the full shape of the problem: one could imagine
> >> having a direct map that only covers a limited range of RAM (I am not
> >> sure whether the existence of dmaplimit on amd64 implies this can happen
> >> with non-device memory in real life), for example. These cases are
> >> currently covered by an assert() in PHYS_TO_DMAP(), whereas having
> >> PHYS_TO_DMAP() return NULL allows a more flexible signalling and the
> >> potential for the calling code to do something reasonable to handle the
> >> error. A single global flag can't convey information at this kind of
> >> granularity. Is this a reasonable concern? Or am I overthinking things?
> > IMO it is overreaction.  amd64 assumes that all normal memory is covered
> > by DMAP.  It must never fail.   See, for instance, the implementation
> > of the sf bufs for it.
> >
> > If device memory not covered by DMAP can exists, it is the driver problem.
> > For instance, for NVDIMMs I wrote specific mapping code which establishes
> > kernel mapping for it, when not covered by EFI memory map and 
> > correspondingly
> > not included into DMAP.
> >
> 
> Fair enough. Here's a patch with a new flag (DIRECT_MAP_AVAILABLE). I've 
> also retooled the sfbuf code to use this rather than its own flags that 
> mean the same things. The sparc64 part of the patch is untested.
> -Nathan
> Index: sparc64/include/vmparam.h
> ===
> --- sparc64/include/vmparam.h (revision 328006)
> +++ sparc64/include/vmparam.h (working copy)
> @@ -240,10 +240,12 @@
>   */
>  #define  ZERO_REGION_SIZEPAGE_SIZE
>  
> +#include 
> +
>  #define  SFBUF
>  #define  SFBUF_MAP
> -#define  SFBUF_OPTIONAL_DIRECT_MAP   dcache_color_ignore
> -#include 
> -#define  SFBUF_PHYS_DMAP(x)  TLB_PHYS_TO_DIRECT(x)
>  
> +#define DIRECT_MAP_AVAILABLE dcache_color_ignore
> +#define  PHYS_TO_DMAP(x) (DIRECT_MAP_AVAILABLE ? (TLB_PHYS_TO_DIRECT(x) 
> : 0)

What dcache_color_ignore actually indicates is the presence of
hardware unaliasing support, in other words the ability to enter
duplicate cacheable mappings into the MMU. While a direct map is
available and used by MD code on all supported CPUs down to US-I,
the former feature is only implemented in the line of Fujitsu SPARC64
processors. IIRC, the sfbuf(9) code can't guarantee that there isn't
already a cacheable mapping from a different VA to the same PA,
which is why it employs dcache_color_ignore. Is that a general
constraint of all MI PHYS_TO_DMAP users or are there consumers
which can guarantee that they are the only users of a mapping
to the same PA?

Marius
___
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: r328056 - head/sys/fs/ext2fs

2018-01-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jan 16 19:29:32 2018
New Revision: 328056
URL: https://svnweb.freebsd.org/changeset/base/328056

Log:
  ext2fs: use mallocarray(9).
  
  Focus on code where we are doing multiplications within malloc(9). These
  are not likely to overflow, however the change is still useful as some
  static checkers can benefit from the allocation attributes we use for
  mallocarray.

Modified:
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/fs/ext2fs/ext2_vfsops.c

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==
--- head/sys/fs/ext2fs/ext2_lookup.cTue Jan 16 18:36:25 2018
(r328055)
+++ head/sys/fs/ext2fs/ext2_lookup.cTue Jan 16 19:29:32 2018
(r328056)
@@ -145,9 +145,9 @@ ext2_readdir(struct vop_readdir_args *ap)
off_t offset, startoffset;
size_t readcnt, skipcnt;
ssize_t startresid;
-   int ncookies;
int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize;
int error;
+   u_int ncookies;
 
if (uio->uio_offset < 0)
return (EINVAL);
@@ -160,7 +160,8 @@ ext2_readdir(struct vop_readdir_args *ap)
ncookies = ip->i_size - uio->uio_offset;
ncookies = ncookies / (offsetof(struct ext2fs_direct_2,
e2d_namlen) + 4) + 1;
-   cookies = malloc(ncookies * sizeof(*cookies), M_TEMP, M_WAITOK);
+   cookies = mallocarray(ncookies, sizeof(*cookies), M_TEMP,
+   M_WAITOK);
*ap->a_ncookies = ncookies;
*ap->a_cookies = cookies;
} else {

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==
--- head/sys/fs/ext2fs/ext2_vfsops.cTue Jan 16 18:36:25 2018
(r328055)
+++ head/sys/fs/ext2fs/ext2_vfsops.cTue Jan 16 19:29:32 2018
(r328056)
@@ -400,9 +400,9 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es
fs->e2fs_bsize / sizeof(struct ext2_gd));
}
fs->e2fs_gdbcount = howmany(fs->e2fs_gcount, e2fs_descpb);
-   fs->e2fs_gd = malloc(e2fs_gdbcount_alloc * fs->e2fs_bsize,
+   fs->e2fs_gd = mallocarray(e2fs_gdbcount_alloc, fs->e2fs_bsize,
M_EXT2MNT, M_WAITOK | M_ZERO);
-   fs->e2fs_contigdirs = malloc(fs->e2fs_gcount *
+   fs->e2fs_contigdirs = mallocarray(fs->e2fs_gcount,
sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK | M_ZERO);
 
/*
@@ -683,7 +683,8 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp)
for (i = 0; i < ump->um_e2fs->e2fs_gcount; i++, sump++) {
*lp++ = ump->um_e2fs->e2fs_contigsumsize;
sump->cs_init = 0;
-   sump->cs_sum = malloc((ump->um_e2fs->e2fs_contigsumsize 
+ 1) *
+   sump->cs_sum = mallocarray(
+   ump->um_e2fs->e2fs_contigsumsize + 1,
sizeof(int32_t), M_EXT2MNT, M_WAITOK | M_ZERO);
}
}
___
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: r328055 - head/contrib/tzdata

2018-01-16 Thread Philip Paeps
Author: philip
Date: Tue Jan 16 18:36:25 2018
New Revision: 328055
URL: https://svnweb.freebsd.org/changeset/base/328055

Log:
  Import tzdata 2018a
  
  Changes: https://github.com/eggert/tz/blob/2018a/NEWS
  
  MFC after:3 days

Deleted:
  head/contrib/tzdata/pacificnew
Modified:
  head/contrib/tzdata/Makefile
  head/contrib/tzdata/NEWS
  head/contrib/tzdata/README
  head/contrib/tzdata/africa
  head/contrib/tzdata/asia
  head/contrib/tzdata/australasia
  head/contrib/tzdata/backzone
  head/contrib/tzdata/europe
  head/contrib/tzdata/northamerica
  head/contrib/tzdata/southamerica
  head/contrib/tzdata/theory.html
  head/contrib/tzdata/version
  head/contrib/tzdata/zishrink.awk
  head/contrib/tzdata/zone.tab
  head/contrib/tzdata/zone1970.tab
Directory Properties:
  head/contrib/tzdata/   (props changed)

Modified: head/contrib/tzdata/Makefile
==
--- head/contrib/tzdata/MakefileTue Jan 16 18:27:26 2018
(r328054)
+++ head/contrib/tzdata/MakefileTue Jan 16 18:36:25 2018
(r328055)
@@ -42,37 +42,64 @@ POSIXRULES= America/New_York
 # Also see TZDEFRULESTRING below, which takes effect only
 # if the time zone files cannot be accessed.
 
-# Everything gets put in subdirectories of. . .
 
-TOPDIR=/usr/local
+# Installation locations.
+#
+# The defaults are suitable for Debian, except that if REDO is
+# posix_right or right_posix then files that Debian puts under
+# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
+# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
+# respectively.  Problems with the Debian approach are discussed in
+# the commentary for the right_posix rule (below).
 
+# Destination directory, which can be used for staging.
+# 'make DESTDIR=/stage install' installs under /stage (e.g., to
+# /stage/etc/localtime instead of to /etc/localtime).  Files under
+# /stage are not intended to work as-is, but can be copied by hand to
+# the root directory later.  If DESTDIR is empty, 'make install' does
+# not stage, but installs directly into production locations.
+DESTDIR =
+
+# Everything is installed into subdirectories of TOPDIR, and used there.
+# TOPDIR should be empty (meaning the root directory),
+# or a directory name that does not end in "/".
+# TOPDIR should be empty or an absolute name unless you're just testing.
+TOPDIR =
+
+# The default local time zone is taken from the file TZDEFAULT.
+TZDEFAULT = $(TOPDIR)/etc/localtime
+
+# The subdirectory containing installed program and data files, and
+# likewise for installed files that can be shared among architectures.
+# These should be relative file names.
+USRDIR = usr
+USRSHAREDIR = $(USRDIR)/share
+
 # "Compiled" time zone information is placed in the "TZDIR" directory
 # (and subdirectories).
-# Use an absolute path name for TZDIR unless you're just testing the software.
 # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
-
 TZDIR_BASENAME=zoneinfo
-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
+TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
 
-# Types to try, as an alternative to time_t.  int64_t should be first.
-TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
+BINDIR = $(TOPDIR)/$(USRDIR)/bin
 
-# The "tzselect", "zic", and "zdump" commands get installed in. . .
+# The "zdump" command goes in:
+ZDUMPDIR = $(BINDIR)
 
-ETCDIR=$(TOPDIR)/etc
+# The "zic" command goes in:
+ZICDIR = $(TOPDIR)/$(USRDIR)/sbin
 
-# If you "make INSTALL", the "date" command gets installed in. . .
-
-BINDIR=$(TOPDIR)/bin
-
 # Manual pages go in subdirectories of. . .
+MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
 
-MANDIR=$(TOPDIR)/man
-
 # Library functions are put in an archive in LIBDIR.
+LIBDIR = $(TOPDIR)/$(USRDIR)/lib
 
-LIBDIR=$(TOPDIR)/lib
 
+# Types to try, as an alternative to time_t.  int64_t should be first.
+TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
+
 # If you want only POSIX time, with time values interpreted as
 # seconds since the epoch (not counting leap seconds), use
 #  REDO=   posix_only
@@ -105,11 +132,14 @@ REDO= posix_right
 TZDATA_TEXT=   leapseconds tzdata.zi
 
 # For backward-compatibility links for old zone names, use
+#  BACKWARD=   backward
+# If you also want the link US/Pacific-New, even though it is confusing
+# and is planned to be removed from the database eventually, use
 #  BACKWARD=   backward pacificnew
 # To omit these links, use
 #  BACKWARD=
 
-BACKWARD=  backward pacificnew
+BACKWARD=  backward
 
 # If you want out-of-scope and often-wrong data from the file 'backzone', use
 #  PACKRATDATA=backzone
@@ -313,7 +343,7 @@ ZFLAGS=
 
 # How to use zic to install tz binary files.
 
-ZIC_INSTALL=   $(ZIC) -d 

svn commit: r328054 - vendor/tzdata/tzdata2018a

2018-01-16 Thread Philip Paeps
Author: philip
Date: Tue Jan 16 18:27:26 2018
New Revision: 328054
URL: https://svnweb.freebsd.org/changeset/base/328054

Log:
  Tag import of tzdata 2018a

Added:
  vendor/tzdata/tzdata2018a/
 - copied from r328053, vendor/tzdata/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: r328053 - vendor/tzdata/dist

2018-01-16 Thread Philip Paeps
Author: philip
Date: Tue Jan 16 18:26:11 2018
New Revision: 328053
URL: https://svnweb.freebsd.org/changeset/base/328053

Log:
  Import tzdata 2018a

Deleted:
  vendor/tzdata/dist/pacificnew
Modified:
  vendor/tzdata/dist/Makefile
  vendor/tzdata/dist/NEWS
  vendor/tzdata/dist/README
  vendor/tzdata/dist/africa
  vendor/tzdata/dist/asia
  vendor/tzdata/dist/australasia
  vendor/tzdata/dist/backzone
  vendor/tzdata/dist/europe
  vendor/tzdata/dist/northamerica
  vendor/tzdata/dist/southamerica
  vendor/tzdata/dist/theory.html
  vendor/tzdata/dist/version
  vendor/tzdata/dist/zishrink.awk
  vendor/tzdata/dist/zone.tab
  vendor/tzdata/dist/zone1970.tab

Modified: vendor/tzdata/dist/Makefile
==
--- vendor/tzdata/dist/Makefile Tue Jan 16 18:20:12 2018(r328052)
+++ vendor/tzdata/dist/Makefile Tue Jan 16 18:26:11 2018(r328053)
@@ -42,37 +42,64 @@ POSIXRULES= America/New_York
 # Also see TZDEFRULESTRING below, which takes effect only
 # if the time zone files cannot be accessed.
 
-# Everything gets put in subdirectories of. . .
 
-TOPDIR=/usr/local
+# Installation locations.
+#
+# The defaults are suitable for Debian, except that if REDO is
+# posix_right or right_posix then files that Debian puts under
+# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
+# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
+# respectively.  Problems with the Debian approach are discussed in
+# the commentary for the right_posix rule (below).
 
+# Destination directory, which can be used for staging.
+# 'make DESTDIR=/stage install' installs under /stage (e.g., to
+# /stage/etc/localtime instead of to /etc/localtime).  Files under
+# /stage are not intended to work as-is, but can be copied by hand to
+# the root directory later.  If DESTDIR is empty, 'make install' does
+# not stage, but installs directly into production locations.
+DESTDIR =
+
+# Everything is installed into subdirectories of TOPDIR, and used there.
+# TOPDIR should be empty (meaning the root directory),
+# or a directory name that does not end in "/".
+# TOPDIR should be empty or an absolute name unless you're just testing.
+TOPDIR =
+
+# The default local time zone is taken from the file TZDEFAULT.
+TZDEFAULT = $(TOPDIR)/etc/localtime
+
+# The subdirectory containing installed program and data files, and
+# likewise for installed files that can be shared among architectures.
+# These should be relative file names.
+USRDIR = usr
+USRSHAREDIR = $(USRDIR)/share
+
 # "Compiled" time zone information is placed in the "TZDIR" directory
 # (and subdirectories).
-# Use an absolute path name for TZDIR unless you're just testing the software.
 # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
-
 TZDIR_BASENAME=zoneinfo
-TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
+TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME)
 
-# Types to try, as an alternative to time_t.  int64_t should be first.
-TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+# The "tzselect" and (if you do "make INSTALL") "date" commands go in:
+BINDIR = $(TOPDIR)/$(USRDIR)/bin
 
-# The "tzselect", "zic", and "zdump" commands get installed in. . .
+# The "zdump" command goes in:
+ZDUMPDIR = $(BINDIR)
 
-ETCDIR=$(TOPDIR)/etc
+# The "zic" command goes in:
+ZICDIR = $(TOPDIR)/$(USRDIR)/sbin
 
-# If you "make INSTALL", the "date" command gets installed in. . .
-
-BINDIR=$(TOPDIR)/bin
-
 # Manual pages go in subdirectories of. . .
+MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
 
-MANDIR=$(TOPDIR)/man
-
 # Library functions are put in an archive in LIBDIR.
+LIBDIR = $(TOPDIR)/$(USRDIR)/lib
 
-LIBDIR=$(TOPDIR)/lib
 
+# Types to try, as an alternative to time_t.  int64_t should be first.
+TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
+
 # If you want only POSIX time, with time values interpreted as
 # seconds since the epoch (not counting leap seconds), use
 #  REDO=   posix_only
@@ -105,11 +132,14 @@ REDO= posix_right
 TZDATA_TEXT=   leapseconds tzdata.zi
 
 # For backward-compatibility links for old zone names, use
+#  BACKWARD=   backward
+# If you also want the link US/Pacific-New, even though it is confusing
+# and is planned to be removed from the database eventually, use
 #  BACKWARD=   backward pacificnew
 # To omit these links, use
 #  BACKWARD=
 
-BACKWARD=  backward pacificnew
+BACKWARD=  backward
 
 # If you want out-of-scope and often-wrong data from the file 'backzone', use
 #  PACKRATDATA=backzone
@@ -313,7 +343,7 @@ ZFLAGS=
 
 # How to use zic to install tz binary files.
 
-ZIC_INSTALL=   $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
+ZIC_INSTALL=   $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
 
 # The name of a Posix-compliant 'awk' on your system.
 AWK=   awk
@@ -341,8 +371,8 @@ 

svn commit: r328052 - head/usr.sbin/kldxref

2018-01-16 Thread Ed Maste
Author: emaste
Date: Tue Jan 16 18:20:12 2018
New Revision: 328052
URL: https://svnweb.freebsd.org/changeset/base/328052

Log:
  kldxref: handle modules with md_cval at the end of allocated sections
  
  Attempting to retrieve an md_cval string from a kernel module with
  kldxref would throw a offset error for modules created using lld, since
  this value would be placed at the end of all allocated sections.
  
  Add an ef_read_seg_string method to the ef interface, to allow reading
  strings of varying size without attempting to read beyond the segment's
  bounds.
  
  PR:   224875
  Submitted by: Mitchell Horne 
  Reviewed by:  cem, kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D13923

Modified:
  head/usr.sbin/kldxref/ef.c
  head/usr.sbin/kldxref/ef.h
  head/usr.sbin/kldxref/ef_obj.c
  head/usr.sbin/kldxref/kldxref.c

Modified: head/usr.sbin/kldxref/ef.c
==
--- head/usr.sbin/kldxref/ef.c  Tue Jan 16 11:25:08 2018(r328051)
+++ head/usr.sbin/kldxref/ef.c  Tue Jan 16 18:20:12 2018(r328052)
@@ -90,6 +90,8 @@ static int ef_read_entry(elf_file_t ef, Elf_Off offset
 static int ef_seg_read(elf_file_t ef, Elf_Off offset, size_t len, void *dest);
 static int ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t len,
 void *dest);
+static int ef_seg_read_string(elf_file_t ef, Elf_Off offset, size_t len,
+char *dest);
 static int ef_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len,
 void **ptr);
 static int ef_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len,
@@ -106,6 +108,7 @@ static struct elf_file_ops ef_file_ops = {
ef_read_entry,
ef_seg_read,
ef_seg_read_rel,
+   ef_seg_read_string,
ef_seg_read_entry,
ef_seg_read_entry_rel,
ef_symaddr,
@@ -494,6 +497,28 @@ ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t 
if (error != 0)
return (error);
}
+   return (0);
+}
+
+static int
+ef_seg_read_string(elf_file_t ef, Elf_Off offset, size_t len, char *dest)
+{
+   u_long ofs = ef_get_offset(ef, offset);
+   ssize_t r;
+
+   if (ofs == 0 || ofs == (Elf_Off)-1) {
+   if (ef->ef_verbose)
+   warnx("ef_seg_read_string(%s): bad offset (%lx:%ld)",
+   ef->ef_name, (long)offset, ofs);
+   return (EFAULT);
+   }
+
+   r = pread(ef->ef_fd, dest, len, ofs);
+   if (r < 0)
+   return (errno);
+   if (strnlen(dest, len) == len)
+   return (EFAULT);
+
return (0);
 }
 

Modified: head/usr.sbin/kldxref/ef.h
==
--- head/usr.sbin/kldxref/ef.h  Tue Jan 16 11:25:08 2018(r328051)
+++ head/usr.sbin/kldxref/ef.h  Tue Jan 16 18:20:12 2018(r328052)
@@ -21,6 +21,8 @@
 (ef)->ef_ops->seg_read((ef)->ef_ef, offset, len, dest)
 #define EF_SEG_READ_REL(ef, offset, len, dest) \
 (ef)->ef_ops->seg_read_rel((ef)->ef_ef, offset, len, dest)
+#define EF_SEG_READ_STRING(ef, offset, len, dest) \
+(ef)->ef_ops->seg_read_string((ef)->ef_ef, offset, len, dest)
 #define EF_SEG_READ_ENTRY(ef, offset, len, ptr) \
 (ef)->ef_ops->seg_read_entry((ef)->kf_ef, offset, len, ptr)
 #define EF_SEG_READ_ENTRY_REL(ef, offset, len, ptr) \
@@ -44,6 +46,8 @@ struct elf_file_ops {
int (*seg_read)(elf_file_t ef, Elf_Off offset, size_t len, void *dest);
int (*seg_read_rel)(elf_file_t ef, Elf_Off offset, size_t len,
void *dest);
+   int (*seg_read_string)(elf_file_t, Elf_Off offset, size_t len,
+   char *dest);
int (*seg_read_entry)(elf_file_t ef, Elf_Off offset, size_t len,
void**ptr);
int (*seg_read_entry_rel)(elf_file_t ef, Elf_Off offset, size_t len,

Modified: head/usr.sbin/kldxref/ef_obj.c
==
--- head/usr.sbin/kldxref/ef_obj.c  Tue Jan 16 11:25:08 2018
(r328051)
+++ head/usr.sbin/kldxref/ef_obj.c  Tue Jan 16 18:20:12 2018
(r328052)
@@ -110,6 +110,8 @@ static int ef_obj_seg_read(elf_file_t ef, Elf_Off offs
 void *dest);
 static int ef_obj_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t len,
 void *dest);
+static int ef_obj_seg_read_string(elf_file_t ef, Elf_Off offset, size_t len,
+char *dest);
 static int ef_obj_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len,
 void **ptr);
 static int ef_obj_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len,
@@ -126,6 +128,7 @@ static struct elf_file_ops ef_obj_file_ops = {
ef_obj_read_entry,
ef_obj_seg_read,
ef_obj_seg_read_rel,
+   ef_obj_seg_read_string,
ef_obj_seg_read_entry,
ef_obj_seg_read_entry_rel,
ef_obj_symaddr,
@@ -295,6 +298,27 @@ 

svn commit: r328051 - stable/10/sys/dev/usb

2018-01-16 Thread Andriy Gapon
Author: avg
Date: Tue Jan 16 11:25:08 2018
New Revision: 328051
URL: https://svnweb.freebsd.org/changeset/base/328051

Log:
  MFC r327724: usbdevs: add ASMedia vendor ID

Modified:
  stable/10/sys/dev/usb/usbdevs
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usbdevs
==
--- stable/10/sys/dev/usb/usbdevs   Tue Jan 16 11:23:21 2018
(r328050)
+++ stable/10/sys/dev/usb/usbdevs   Tue Jan 16 11:25:08 2018
(r328051)
@@ -703,6 +703,7 @@ vendor WCH2 0x1a86  QinHeng Electronics
 vendor STELERA 0x1a8d  Stelera Wireless
 vendor SEL 0x1adb  Schweitzer Engineering Laboratories
 vendor CORSAIR 0x1b1c  Corsair
+vendor ASM 0x1b21  ASMedia Technology
 vendor MATRIXORBITAL   0x1b3d  Matrix Orbital
 vendor OVISLINK0x1b75  OvisLink
 vendor TML 0x1b91  The Mobility Lab
___
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: r328050 - stable/11/sys/dev/usb

2018-01-16 Thread Andriy Gapon
Author: avg
Date: Tue Jan 16 11:23:21 2018
New Revision: 328050
URL: https://svnweb.freebsd.org/changeset/base/328050

Log:
  MFC r327724: usbdevs: add ASMedia vendor ID

Modified:
  stable/11/sys/dev/usb/usbdevs
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/usbdevs
==
--- stable/11/sys/dev/usb/usbdevs   Tue Jan 16 11:22:08 2018
(r328049)
+++ stable/11/sys/dev/usb/usbdevs   Tue Jan 16 11:23:21 2018
(r328050)
@@ -704,6 +704,7 @@ vendor WCH2 0x1a86  QinHeng Electronics
 vendor STELERA 0x1a8d  Stelera Wireless
 vendor SEL 0x1adb  Schweitzer Engineering Laboratories
 vendor CORSAIR 0x1b1c  Corsair
+vendor ASM 0x1b21  ASMedia Technology
 vendor MATRIXORBITAL   0x1b3d  Matrix Orbital
 vendor OVISLINK0x1b75  OvisLink
 vendor TML 0x1b91  The Mobility Lab
___
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: r328049 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-01-16 Thread Andriy Gapon
Author: avg
Date: Tue Jan 16 11:22:08 2018
New Revision: 328049
URL: https://svnweb.freebsd.org/changeset/base/328049

Log:
  MFC r327725: zfs_mount: restore a bit of ifdef-out illumos code

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Tue Jan 16 11:22:07 2018(r328048)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Tue Jan 16 11:22:08 2018(r328049)
@@ -1629,13 +1629,21 @@ zfs_mount(vfs_t *vfsp)
 * can be interrogated.
 */
if ((uap->flags & MS_DATA) && uap->datalen > 0)
+   return (SET_ERROR(EINVAL));
+
+   /*
+* Get the objset name (the "special" mount argument).
+*/
+   if (error = pn_get(uap->spec, fromspace, ))
+   return (error);
+
+   osname = spn.pn_path;
 #else  /* !illumos */
if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS))
return (SET_ERROR(EPERM));
 
if (vfs_getopt(vfsp->mnt_optnew, "from", (void **), NULL))
return (SET_ERROR(EINVAL));
-#endif /* illumos */
 
/*
 * If full-owner-access is enabled and delegated administration is
@@ -1645,6 +1653,7 @@ zfs_mount(vfs_t *vfsp)
dsl_deleg_access(osname, ZFS_DELEG_PERM_MOUNT, cr) != ECANCELED) {
secpolicy_fs_mount_clearopts(cr, vfsp);
}
+#endif /* illumos */
 
/*
 * Check for mount privilege?
___
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: r328048 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-01-16 Thread Andriy Gapon
Author: avg
Date: Tue Jan 16 11:22:07 2018
New Revision: 328048
URL: https://svnweb.freebsd.org/changeset/base/328048

Log:
  MFC r327725: zfs_mount: restore a bit of ifdef-out illumos code

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Tue Jan 16 10:58:31 2018(r328047)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Tue Jan 16 11:22:07 2018(r328048)
@@ -1617,13 +1617,21 @@ zfs_mount(vfs_t *vfsp)
 * can be interrogated.
 */
if ((uap->flags & MS_DATA) && uap->datalen > 0)
+   return (SET_ERROR(EINVAL));
+
+   /*
+* Get the objset name (the "special" mount argument).
+*/
+   if (error = pn_get(uap->spec, fromspace, ))
+   return (error);
+
+   osname = spn.pn_path;
 #else  /* !illumos */
if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS))
return (SET_ERROR(EPERM));
 
if (vfs_getopt(vfsp->mnt_optnew, "from", (void **), NULL))
return (SET_ERROR(EINVAL));
-#endif /* illumos */
 
/*
 * If full-owner-access is enabled and delegated administration is
@@ -1633,6 +1641,7 @@ zfs_mount(vfs_t *vfsp)
dsl_deleg_access(osname, ZFS_DELEG_PERM_MOUNT, cr) != ECANCELED) {
secpolicy_fs_mount_clearopts(cr, vfsp);
}
+#endif /* illumos */
 
/*
 * Check for mount privilege?
___
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: r328047 - stable/11/sys/ufs/ffs

2018-01-16 Thread Konstantin Belousov
Author: kib
Date: Tue Jan 16 10:58:31 2018
New Revision: 328047
URL: https://svnweb.freebsd.org/changeset/base/328047

Log:
  MFC r327723, r327821:
  Generalize the fix from r322757 and apply it to several more places.

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

Modified: stable/11/sys/ufs/ffs/ffs_softdep.c
==
--- stable/11/sys/ufs/ffs/ffs_softdep.c Tue Jan 16 10:56:35 2018
(r328046)
+++ stable/11/sys/ufs/ffs/ffs_softdep.c Tue Jan 16 10:58:31 2018
(r328047)
@@ -904,6 +904,7 @@ static  int request_cleanup(struct mount *, int);
 static int softdep_request_cleanup_flush(struct mount *, struct ufsmount *);
 static void schedule_cleanup(struct mount *);
 static void softdep_ast_cleanup_proc(struct thread *);
+static struct ufsmount *softdep_bp_to_mp(struct buf *bp);
 static int process_worklist_item(struct mount *, int, int);
 static void process_removes(struct vnode *);
 static void process_truncates(struct vnode *);
@@ -7245,9 +7246,9 @@ deallocate_dependencies(bp, freeblks, off)
struct worklist *wk, *wkn;
struct ufsmount *ump;
 
-   if ((wk = LIST_FIRST(>b_dep)) == NULL)
+   ump = softdep_bp_to_mp(bp);
+   if (ump == NULL)
goto done;
-   ump = VFSTOUFS(wk->wk_mp);
ACQUIRE_LOCK(ump);
LIST_FOREACH_SAFE(wk, >b_dep, wk_list, wkn) {
switch (wk->wk_type) {
@@ -9972,9 +9973,9 @@ softdep_disk_io_initiation(bp)
panic("softdep_disk_io_initiation: Writing buffer with "
"background write in progress: %p", bp);
 
-   if ((wk = LIST_FIRST(>b_dep)) == NULL)
+   ump = softdep_bp_to_mp(bp);
+   if (ump == NULL)
return;
-   ump = VFSTOUFS(wk->wk_mp);
 
marker.wk_type = D_LAST + 1;/* Not a normal workitem */
PHOLD(curproc); /* Don't swap out kernel stack */
@@ -10974,9 +10975,9 @@ softdep_disk_write_complete(bp)
struct freeblks *freeblks;
struct buf *sbp;
 
-   if ((wk = LIST_FIRST(>b_dep)) == NULL)
+   ump = softdep_bp_to_mp(bp);
+   if (ump == NULL)
return;
-   ump = VFSTOUFS(wk->wk_mp);
 
/*
 * If an error occurred while doing the write, then the data
@@ -11016,8 +11017,9 @@ softdep_disk_write_complete(bp)
return;
}
LIST_INIT();
+
/*
-* This lock must not be released anywhere in this code segment.
+* Ump SU lock must not be released anywhere in this code segment.
 */
sbp = NULL;
owk = NULL;
@@ -13885,6 +13887,40 @@ softdep_freework(wkhd)
FREE_LOCK(ump);
 }
 
+static struct ufsmount *
+softdep_bp_to_mp(bp)
+   struct buf *bp;
+{
+   struct mount *mp;
+   struct vnode *vp;
+
+   if (LIST_EMPTY(>b_dep))
+   return (NULL);
+   vp = bp->b_vp;
+
+   /*
+* The ump mount point is stable after we get a correct
+* pointer, since bp is locked and this prevents unmount from
+* proceeding.  But to get to it, we cannot dereference bp->b_dep
+* head wk_mp, because we do not yet own SU ump lock and
+* workitem might be freed while dereferenced.
+*/
+retry:
+   if (vp->v_type == VCHR) {
+   VI_LOCK(vp);
+   mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL;
+   VI_UNLOCK(vp);
+   if (mp == NULL)
+   goto retry;
+   } else if (vp->v_type == VREG || vp->v_type == VDIR ||
+   vp->v_type == VLNK) {
+   mp = vp->v_mount;
+   } else {
+   return (NULL);
+   }
+   return (VFSTOUFS(mp));
+}
+
 /*
  * Function to determine if the buffer has outstanding dependencies
  * that will cause a roll-back if the buffer is written. If wantcount
@@ -13908,36 +13944,12 @@ softdep_count_dependencies(bp, wantcount)
struct newblk *newblk;
struct mkdir *mkdir;
struct diradd *dap;
-   struct vnode *vp;
-   struct mount *mp;
int i, retval;
 
-   retval = 0;
-   if (LIST_EMPTY(>b_dep))
+   ump = softdep_bp_to_mp(bp);
+   if (ump == NULL)
return (0);
-   vp = bp->b_vp;
-
-   /*
-* The ump mount point is stable after we get a correct
-* pointer, since bp is locked and this prevents unmount from
-* proceed.  But to get to it, we cannot dereference bp->b_dep
-* head wk_mp, because we do not yet own SU ump lock and
-* workitem might be freed while dereferenced.
-*/
-retry:
-   if (vp->v_type == VCHR) {
-   VI_LOCK(vp);
-   mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL;
-   VI_UNLOCK(vp);
-   if (mp == NULL)
-   goto retry;
-   } else if (vp->v_type == VREG) {
-   

svn commit: r328046 - stable/11/sys/ufs/ffs

2018-01-16 Thread Konstantin Belousov
Author: kib
Date: Tue Jan 16 10:56:35 2018
New Revision: 328046
URL: https://svnweb.freebsd.org/changeset/base/328046

Log:
  MFC r327722:
  When handling write completion, take SU lock around calls to
  handle_written_XXX() in case of processing the buffer with an error.

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

Modified: stable/11/sys/ufs/ffs/ffs_softdep.c
==
--- stable/11/sys/ufs/ffs/ffs_softdep.c Tue Jan 16 10:54:32 2018
(r328045)
+++ stable/11/sys/ufs/ffs/ffs_softdep.c Tue Jan 16 10:56:35 2018
(r328046)
@@ -10974,12 +10974,17 @@ softdep_disk_write_complete(bp)
struct freeblks *freeblks;
struct buf *sbp;
 
+   if ((wk = LIST_FIRST(>b_dep)) == NULL)
+   return;
+   ump = VFSTOUFS(wk->wk_mp);
+
/*
 * If an error occurred while doing the write, then the data
 * has not hit the disk and the dependencies cannot be processed.
 * But we do have to go through and roll forward any dependencies
 * that were rolled back before the disk write.
 */
+   ACQUIRE_LOCK(ump);
if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & B_INVAL) == 0) {
LIST_FOREACH(wk, >b_dep, wk_list) {
switch (wk->wk_type) {
@@ -11007,18 +11012,15 @@ softdep_disk_write_complete(bp)
continue;
}
}
+   FREE_LOCK(ump);
return;
}
-   if ((wk = LIST_FIRST(>b_dep)) == NULL)
-   return;
-   ump = VFSTOUFS(wk->wk_mp);
LIST_INIT();
/*
 * This lock must not be released anywhere in this code segment.
 */
sbp = NULL;
owk = NULL;
-   ACQUIRE_LOCK(ump);
while ((wk = LIST_FIRST(>b_dep)) != NULL) {
WORKLIST_REMOVE(wk);
atomic_add_long(_write[wk->wk_type], 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r328045 - stable/11/sys/ufs/ffs

2018-01-16 Thread Konstantin Belousov
Author: kib
Date: Tue Jan 16 10:54:32 2018
New Revision: 328045
URL: https://svnweb.freebsd.org/changeset/base/328045

Log:
  MFC r327721:
  Postpone the disassotiation of the background write buffer with devvp
  so that buf_complete() sees fully constructed buffer.

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

Modified: stable/11/sys/ufs/ffs/ffs_vfsops.c
==
--- stable/11/sys/ufs/ffs/ffs_vfsops.c  Tue Jan 16 09:31:01 2018
(r328044)
+++ stable/11/sys/ufs/ffs/ffs_vfsops.c  Tue Jan 16 10:54:32 2018
(r328045)
@@ -2040,7 +2040,6 @@ ffs_backgroundwritedone(struct buf *bp)
/*
 * Process dependencies then return any unfinished ones.
 */
-   pbrelvp(bp);
if (!LIST_EMPTY(>b_dep) && (bp->b_ioflags & BIO_ERROR) == 0)
buf_complete(bp);
 #ifdef SOFTUPDATES
@@ -2053,6 +2052,7 @@ ffs_backgroundwritedone(struct buf *bp)
 */
bp->b_flags |= B_NOCACHE;
bp->b_flags &= ~B_CACHE;
+   pbrelvp(bp);
 
/*
 * Prevent brelse() from trying to keep and re-dirtying bp on
___
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: r328044 - head/lib/libpmcstat

2018-01-16 Thread Ruslan Bukin
Author: br
Date: Tue Jan 16 09:31:01 2018
New Revision: 328044
URL: https://svnweb.freebsd.org/changeset/base/328044

Log:
  Fix bug: increment the value of pmcstat_npmcs instead of moving pointer
  to the next int position.
  
  Bug was introduced in r324959 ("Extract a set of pmcstat functions and
  interfaces to the new internal library -- libpmcstat.")
  
  This fixes pmcstat top mode (-T) operation.
  Example: pmcstat -n1 -S clock.hard -T
  
  Reported by:  Peter Holm 
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/libpmcstat/libpmcstat_logging.c

Modified: head/lib/libpmcstat/libpmcstat_logging.c
==
--- head/lib/libpmcstat/libpmcstat_logging.cTue Jan 16 08:00:07 2018
(r328043)
+++ head/lib/libpmcstat/libpmcstat_logging.cTue Jan 16 09:31:01 2018
(r328044)
@@ -101,7 +101,7 @@ pmcstat_pmcid_add(pmc_id_t pmcid, pmcstat_interned_str
 
pr->pr_pmcid = pmcid;
pr->pr_pmcname = ps;
-   pr->pr_pmcin = *pmcstat_npmcs++;
+   pr->pr_pmcin = (*pmcstat_npmcs)++;
pr->pr_samples = 0;
pr->pr_dubious_frames = 0;
pr->pr_merge = prm == NULL ? pr : prm;
___
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: r328043 - in stable/11/contrib/llvm/tools/clang: include/clang/AST lib/AST lib/Sema

2018-01-16 Thread Dimitry Andric
Author: dim
Date: Tue Jan 16 08:00:07 2018
New Revision: 328043
URL: https://svnweb.freebsd.org/changeset/base/328043

Log:
  MFC r327930:
  
  Pull in r314499 from upstream clang trunk (by Daniel Marjamäki):
  
[Sema] Suppress warnings for C's zero initializer
  
Patch by S. Gilles!
  
Differential Revision: https://reviews.llvm.org/D28148
  
  Pull in r314838 from upstream clang trunk (by Richard Smith):
  
Suppress -Wmissing-braces warning when aggregate-initializing a
struct with a single field that is itself an aggregate.
  
In C++, such initialization of std::array types is guaranteed
to work by the standard, is completely idiomatic, and the "suggested"
alternative from Clang was technically invalid.
  
  Together, these suppress unneeded "suggest braces around initialization
  of subobject" warnings for C++11 initializer lists.

Modified:
  stable/11/contrib/llvm/tools/clang/include/clang/AST/Expr.h
  stable/11/contrib/llvm/tools/clang/lib/AST/Expr.cpp
  stable/11/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/llvm/tools/clang/include/clang/AST/Expr.h
==
--- stable/11/contrib/llvm/tools/clang/include/clang/AST/Expr.h Tue Jan 16 
06:24:19 2018(r328042)
+++ stable/11/contrib/llvm/tools/clang/include/clang/AST/Expr.h Tue Jan 16 
08:00:07 2018(r328043)
@@ -3986,6 +3986,10 @@ class InitListExpr : public Expr { (public)
   /// initializer)?
   bool isTransparent() const;
 
+  /// Is this the zero initializer {0} in a language which considers it
+  /// idiomatic?
+  bool isIdiomaticZeroInitializer(const LangOptions ) const;
+
   SourceLocation getLBraceLoc() const { return LBraceLoc; }
   void setLBraceLoc(SourceLocation Loc) { LBraceLoc = Loc; }
   SourceLocation getRBraceLoc() const { return RBraceLoc; }
@@ -3994,6 +3998,9 @@ class InitListExpr : public Expr { (public)
   bool isSemanticForm() const { return AltForm.getInt(); }
   InitListExpr *getSemanticForm() const {
 return isSemanticForm() ? nullptr : AltForm.getPointer();
+  }
+  bool isSyntacticForm() const {
+return !AltForm.getInt() || !AltForm.getPointer();
   }
   InitListExpr *getSyntacticForm() const {
 return isSemanticForm() ? AltForm.getPointer() : nullptr;

Modified: stable/11/contrib/llvm/tools/clang/lib/AST/Expr.cpp
==
--- stable/11/contrib/llvm/tools/clang/lib/AST/Expr.cpp Tue Jan 16 06:24:19 
2018(r328042)
+++ stable/11/contrib/llvm/tools/clang/lib/AST/Expr.cpp Tue Jan 16 08:00:07 
2018(r328043)
@@ -1899,6 +1899,17 @@ bool InitListExpr::isTransparent() const {
  getInit(0)->getType().getCanonicalType();
 }
 
+bool InitListExpr::isIdiomaticZeroInitializer(const LangOptions ) 
const {
+  assert(isSyntacticForm() && "only test syntactic form as zero initializer");
+
+  if (LangOpts.CPlusPlus || getNumInits() != 1) {
+return false;
+  }
+
+  const IntegerLiteral *Lit = dyn_cast(getInit(0));
+  return Lit && Lit->getValue() == 0;
+}
+
 SourceLocation InitListExpr::getLocStart() const {
   if (InitListExpr *SyntacticForm = getSyntacticForm())
 return SyntacticForm->getLocStart();

Modified: stable/11/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp
==
--- stable/11/contrib/llvm/tools/clang/lib/Sema/SemaInit.cppTue Jan 16 
06:24:19 2018(r328042)
+++ stable/11/contrib/llvm/tools/clang/lib/Sema/SemaInit.cppTue Jan 16 
08:00:07 2018(r328043)
@@ -826,6 +826,34 @@ int InitListChecker::numStructUnionElements(QualType D
   return InitializableMembers - structDecl->hasFlexibleArrayMember();
 }
 
+/// Determine whether Entity is an entity for which it is idiomatic to elide
+/// the braces in aggregate initialization.
+static bool isIdiomaticBraceElisionEntity(const InitializedEntity ) {
+  // Recursive initialization of the one and only field within an aggregate
+  // class is considered idiomatic. This case arises in particular for
+  // initialization of std::array, where the C++ standard suggests the idiom of
+  //
+  //   std::array arr = {1, 2, 3};
+  //
+  // (where std::array is an aggregate struct containing a single array field.
+
+  // FIXME: Should aggregate initialization of a struct with a single
+  // base class and no members also suppress the warning?
+  if (Entity.getKind() != InitializedEntity::EK_Member || !Entity.getParent())
+return false;
+
+  auto *ParentRD =
+  Entity.getParent()->getType()->castAs()->getDecl();
+  if (CXXRecordDecl *CXXRD = dyn_cast(ParentRD))
+if (CXXRD->getNumBases())
+  return false;
+
+  auto FieldIt = ParentRD->field_begin();
+  assert(FieldIt != ParentRD->field_end() &&
+ "no fields but have initializer for member?");
+  return ++FieldIt ==