svn commit: r323935 - head/sys/kern

2017-09-22 Thread Conrad Meyer
Author: cem
Date: Fri Sep 22 20:01:12 2017
New Revision: 323935
URL: https://svnweb.freebsd.org/changeset/base/323935

Log:
  ddb(4): Add 'show badstacks' command to show witness badstacks
  
  Add a DDB command that mirrors sysctl debug.witness.badstacks.
  
  Reported by:  rstone
  Reviewed by:  rstone
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D12468

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cFri Sep 22 17:58:57 2017
(r323934)
+++ head/sys/kern/subr_witness.cFri Sep 22 20:01:12 2017
(r323935)
@@ -2539,31 +2539,18 @@ DB_SHOW_COMMAND(witness, db_witness_display)
 }
 #endif
 
-static int
-sysctl_debug_witness_badstacks(SYSCTL_HANDLER_ARGS)
+static void
+sbuf_print_witness_badstacks(struct sbuf *sb)
 {
struct witness_lock_order_data *data1, *data2, *tmp_data1, *tmp_data2;
struct witness *tmp_w1, *tmp_w2, *w1, *w2;
-   struct sbuf *sb;
u_int w_rmatrix1, w_rmatrix2;
-   int error, generation, i, j;
+   int generation, i, j;
 
tmp_data1 = NULL;
tmp_data2 = NULL;
tmp_w1 = NULL;
tmp_w2 = NULL;
-   if (witness_watch < 1) {
-   error = SYSCTL_OUT(req, w_notrunning, sizeof(w_notrunning));
-   return (error);
-   }
-   if (witness_cold) {
-   error = SYSCTL_OUT(req, w_stillcold, sizeof(w_stillcold));
-   return (error);
-   }
-   error = 0;
-   sb = sbuf_new(NULL, NULL, badstack_sbuf_size, SBUF_AUTOEXTEND);
-   if (sb == NULL)
-   return (ENOMEM);
 
/* Allocate and init temporary storage space. */
tmp_w1 = malloc(sizeof(struct witness), M_TEMP, M_WAITOK | M_ZERO);
@@ -2683,13 +2670,55 @@ restart:
free(tmp_data2, M_TEMP);
free(tmp_w1, M_TEMP);
free(tmp_w2, M_TEMP);
+}
 
+static int
+sysctl_debug_witness_badstacks(SYSCTL_HANDLER_ARGS)
+{
+   struct sbuf *sb;
+   int error;
+
+   if (witness_watch < 1) {
+   error = SYSCTL_OUT(req, w_notrunning, sizeof(w_notrunning));
+   return (error);
+   }
+   if (witness_cold) {
+   error = SYSCTL_OUT(req, w_stillcold, sizeof(w_stillcold));
+   return (error);
+   }
+   error = 0;
+   sb = sbuf_new(NULL, NULL, badstack_sbuf_size, SBUF_AUTOEXTEND);
+   if (sb == NULL)
+   return (ENOMEM);
+
+   sbuf_print_witness_badstacks(sb);
+
sbuf_finish(sb);
error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1);
sbuf_delete(sb);
 
return (error);
 }
+
+#ifdef DDB
+static int
+sbuf_db_printf_drain(void *arg __unused, const char *data, int len)
+{
+
+   return (db_printf("%.*s", len, data));
+}
+
+DB_SHOW_COMMAND(badstacks, db_witness_badstacks)
+{
+   struct sbuf sb;
+   char buffer[128];
+
+   sbuf_new(, buffer, sizeof(buffer), SBUF_FIXEDLEN);
+   sbuf_set_drain(, sbuf_db_printf_drain, NULL);
+   sbuf_print_witness_badstacks();
+   sbuf_finish();
+}
+#endif
 
 static int
 sysctl_debug_witness_channel(SYSCTL_HANDLER_ARGS)
___
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: r323920 - in stable/11/sys/x86: include x86

2017-09-22 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 22 10:49:04 2017
New Revision: 323920
URL: https://svnweb.freebsd.org/changeset/base/323920

Log:
  MFC r323325, r323450:
  If IOAPIC has PCI binding, match the PCI device against MADT
  enumerated IOAPIC.

Modified:
  stable/11/sys/x86/include/apicvar.h
  stable/11/sys/x86/x86/io_apic.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/include/apicvar.h
==
--- stable/11/sys/x86/include/apicvar.h Fri Sep 22 10:45:51 2017
(r323919)
+++ stable/11/sys/x86/include/apicvar.h Fri Sep 22 10:49:04 2017
(r323920)
@@ -474,6 +474,8 @@ voidlapic_handle_error(void);
 void   lapic_handle_intr(int vector, struct trapframe *frame);
 void   lapic_handle_timer(struct trapframe *frame);
 
+intioapic_get_rid(u_int apic_id, uint16_t *ridp);
+
 extern int x2apic_mode;
 extern int lapic_eoi_suppression;
 

Modified: stable/11/sys/x86/x86/io_apic.c
==
--- stable/11/sys/x86/x86/io_apic.c Fri Sep 22 10:45:51 2017
(r323919)
+++ stable/11/sys/x86/x86/io_apic.c Fri Sep 22 10:49:04 2017
(r323920)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -99,6 +100,9 @@ struct ioapic {
volatile ioapic_t *io_addr; /* XXX: should use bus_space */
vm_paddr_t io_paddr;
STAILQ_ENTRY(ioapic) io_next;
+   device_t pci_dev;   /* matched pci device, if found */
+   struct resource *pci_wnd;   /* BAR 0, should be same or alias to
+  io_paddr */
struct ioapic_intsrc io_pins[0];
 };
 
@@ -622,6 +626,8 @@ ioapic_create(vm_paddr_t addr, int32_t apic_id, int in
io = malloc(sizeof(struct ioapic) +
numintr * sizeof(struct ioapic_intsrc), M_IOAPIC, M_WAITOK);
io->io_pic = ioapic_template;
+   io->pci_dev = NULL;
+   io->pci_wnd = NULL;
mtx_lock_spin(_lock);
io->io_id = next_id++;
io->io_apic_id = ioapic_read(apic, IOAPIC_ID) >> APIC_ID_SHIFT;
@@ -954,7 +960,72 @@ ioapic_pci_probe(device_t dev)
 static int
 ioapic_pci_attach(device_t dev)
 {
+   struct resource *res;
+   volatile ioapic_t *apic;
+   struct ioapic *io;
+   int rid;
+   u_int apic_id;
 
+   /*
+* Try to match the enumerated ioapic.  Match BAR start
+* against io_paddr.  Due to a fear that PCI window is not the
+* same as the MADT reported io window, but an alias, read the
+* APIC ID from the mapped BAR and match against it.
+*/
+   rid = PCIR_BAR(0);
+   res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, ,
+   RF_ACTIVE | RF_SHAREABLE);
+   if (res == NULL) {
+   if (bootverbose)
+   device_printf(dev, "cannot activate BAR0\n");
+   return (ENXIO);
+   }
+   apic = (volatile ioapic_t *)rman_get_virtual(res);
+   if (rman_get_size(res) < IOAPIC_WND_SIZE) {
+   if (bootverbose)
+   device_printf(dev,
+   "BAR0 too small (%jd) for IOAPIC window\n",
+   (uintmax_t)rman_get_size(res));
+   goto fail;
+   }
+   mtx_lock_spin(_lock);
+   apic_id = ioapic_read(apic, IOAPIC_ID) >> APIC_ID_SHIFT;
+   /* First match by io window address */
+   STAILQ_FOREACH(io, _list, io_next) {
+   if (io->io_paddr == (vm_paddr_t)rman_get_start(res))
+   goto found;
+   }
+   /* Then by apic id */
+   STAILQ_FOREACH(io, _list, io_next) {
+   if (io->io_apic_id == apic_id)
+   goto found;
+   }
+   mtx_unlock_spin(_lock);
+   if (bootverbose)
+   device_printf(dev,
+   "cannot match pci bar apic id %d against MADT\n",
+   apic_id);
+fail:
+   bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
+   return (ENXIO);
+found:
+   KASSERT(io->pci_dev == NULL,
+   ("ioapic %d pci_dev not NULL", io->io_id));
+   KASSERT(io->pci_wnd == NULL,
+   ("ioapic %d pci_wnd not NULL", io->io_id));
+
+   io->pci_dev = dev;
+   io->pci_wnd = res;
+   if (bootverbose && (io->io_paddr != (vm_paddr_t)rman_get_start(res) ||
+   io->io_apic_id != apic_id)) {
+   device_printf(dev, "pci%d:%d:%d:%d pci BAR0@%jx id %d "
+   "MADT id %d paddr@%jx\n",
+   pci_get_domain(dev), pci_get_bus(dev),
+   pci_get_slot(dev), pci_get_function(dev),
+   (uintmax_t)rman_get_start(res), apic_id,
+   io->io_apic_id, (uintmax_t)io->io_paddr);
+   }
+   mtx_unlock_spin(_lock);
return (0);
 }
 
@@ -971,6 +1042,28 @@ DEFINE_CLASS_0(ioapic, ioapic_pci_driver, 

svn commit: r323919 - stable/11/sys/vm

2017-09-22 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 22 10:45:51 2017
New Revision: 323919
URL: https://svnweb.freebsd.org/changeset/base/323919

Log:
  MFC r323616:
  Batch freeing of the pages in vm_object_page_remove().

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

Modified: stable/11/sys/vm/vm_object.c
==
--- stable/11/sys/vm/vm_object.cFri Sep 22 08:27:27 2017
(r323918)
+++ stable/11/sys/vm/vm_object.cFri Sep 22 10:45:51 2017
(r323919)
@@ -1960,6 +1960,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t 
 {
vm_page_t p, next;
struct mtx *mtx;
+   struct pglist pgl;
 
VM_OBJECT_ASSERT_WLOCKED(object);
KASSERT((object->flags & OBJ_UNMANAGED) == 0 ||
@@ -1968,6 +1969,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t 
if (object->resident_page_count == 0)
return;
vm_object_pip_add(object, 1);
+   TAILQ_INIT();
 again:
p = vm_page_find_least(object, start);
mtx = NULL;
@@ -2019,10 +2021,13 @@ again:
}
if ((options & OBJPR_NOTMAPPED) == 0)
pmap_remove_all(p);
-   vm_page_free(p);
+   p->flags &= ~PG_ZERO;
+   if (vm_page_free_prep(p, false))
+   TAILQ_INSERT_TAIL(, p, listq);
}
if (mtx != NULL)
mtx_unlock(mtx);
+   vm_page_free_phys_pglist();
vm_object_pip_wakeup(object);
 }
 
___
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: r323921 - stable/11/sys/x86/iommu

2017-09-22 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 22 10:51:32 2017
New Revision: 323921
URL: https://svnweb.freebsd.org/changeset/base/323921

Log:
  MFC r323326:
  Use IOAPIC PCI rid as the interrupt TLP source id for DMAR interrupt
  remapping.

Modified:
  stable/11/sys/x86/iommu/intel_drv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/iommu/intel_drv.c
==
--- stable/11/sys/x86/iommu/intel_drv.c Fri Sep 22 10:49:04 2017
(r323920)
+++ stable/11/sys/x86/iommu/intel_drv.c Fri Sep 22 10:51:32 2017
(r323921)
@@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$");
 
 #ifdef DEV_APIC
 #include "pcib_if.h"
+#include 
+#include 
+#include 
 #endif
 
 #defineDMAR_FAULT_IRQ_RID  0
@@ -788,6 +791,9 @@ dmar_find_nonpci(u_int id, u_int entry_type, uint16_t 
ACPI_DMAR_DEVICE_SCOPE *devscope;
ACPI_DMAR_PCI_PATH *path;
char *ptr, *ptrend;
+#ifdef DEV_APIC
+   int error;
+#endif
int i;
 
for (i = 0; i < dmar_devcnt; i++) {
@@ -809,6 +815,17 @@ dmar_find_nonpci(u_int id, u_int entry_type, uint16_t 
continue;
if (devscope->EnumerationId != id)
continue;
+#ifdef DEV_APIC
+   if (entry_type == ACPI_DMAR_SCOPE_TYPE_IOAPIC) {
+   error = ioapic_get_rid(id, rid);
+   /*
+* If our IOAPIC has PCI bindings then
+* use the PCI device rid.
+*/
+   if (error == 0)
+   return (unit);
+   }
+#endif
if (devscope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE)
== 2) {
if (rid != NULL) {
@@ -818,12 +835,11 @@ dmar_find_nonpci(u_int id, u_int entry_type, uint16_t 
path->Device, path->Function);
}
return (unit);
-   } else {
-   /* XXXKIB */
-   printf(
-  "dmar_find_nonpci: id %d type %d path length != 2\n",
-   id, entry_type);
}
+   printf(
+  "dmar_find_nonpci: id %d type %d path length != 2\n",
+   id, entry_type);
+   break;
}
}
return (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: r323905 - in head/sys/boot/efi: include loader

2017-09-22 Thread Toomas Soome
Author: tsoome
Date: Fri Sep 22 07:29:26 2017
New Revision: 323905
URL: https://svnweb.freebsd.org/changeset/base/323905

Log:
  libefi: pdinfo_t pd_unit and pd_open should be unsigned
  
  The device index, partition index and reference counter are all positive
  numbers. However, since our internal partition number may be negative
  to indicate GPT table, the compare expression need to take care when comparing
  pdinfo_t and partition data.

Modified:
  head/sys/boot/efi/include/efilib.h
  head/sys/boot/efi/loader/main.c

Modified: head/sys/boot/efi/include/efilib.h
==
--- head/sys/boot/efi/include/efilib.h  Fri Sep 22 06:33:01 2017
(r323904)
+++ head/sys/boot/efi/include/efilib.h  Fri Sep 22 07:29:26 2017
(r323905)
@@ -56,8 +56,8 @@ typedef struct pdinfo
EFI_HANDLE  pd_alias;
EFI_DEVICE_PATH *pd_devpath;
EFI_BLOCK_IO*pd_blkio;
-   int pd_unit;/* unit number */
-   int pd_open;/* reference counter */
+   uint32_tpd_unit;/* unit number */
+   uint32_tpd_open;/* reference counter */
void*pd_bcache; /* buffer cache data */
 } pdinfo_t;
 

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Fri Sep 22 06:33:01 2017
(r323904)
+++ head/sys/boot/efi/loader/main.c Fri Sep 22 07:29:26 2017
(r323905)
@@ -901,7 +901,7 @@ command_chain(int argc, char *argv[])
/*
 * d_partition should be 255
 */
-   if (pd->pd_unit == d_dev->d_slice) {
+   if (pd->pd_unit == (uint32_t)d_dev->d_slice) {
loaded_image->DeviceHandle =
pd->pd_handle;
break;
___
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: r323907 - head/sys/boot/efi/libefi

2017-09-22 Thread Toomas Soome
Author: tsoome
Date: Fri Sep 22 07:37:42 2017
New Revision: 323907
URL: https://svnweb.freebsd.org/changeset/base/323907

Log:
  libefi: efipart.c cstyle fix for efipart_print_common()
  
  The else statement should have { }

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==
--- head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:34:08 2017
(r323906)
+++ head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:37:42 2017
(r323907)
@@ -632,8 +632,9 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t 
if (blkio->Media->MediaPresent) {
if (blkio->Media->RemovableMedia)
printf(" (removable)");
-   } else
+   } else {
printf(" (no media)");
+   }
if ((ret = pager_output("\n")) != 0)
break;
if (!blkio->Media->MediaPresent)
___
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: r323912 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/man/man1m

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:15:35 2017
New Revision: 323912
URL: https://svnweb.freebsd.org/changeset/base/323912

Log:
  8592 ZFS channel programs - rollback
  
  illumos/illumos-gate@000cce6b6fad4a8b0eecef6e1251f6aca1719c55
  
https://github.com/illumos/illumos-gate/commit/000cce6b6fad4a8b0eecef6e1251f6aca1719c55
  
  https://www.illumos.org/issues/8592
ZFS channel programs should be able to perform a rollback. This logic will
probably look pretty similar to zfs.sync.destroy().
  
  Reviewed by: Chris Williamson 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Brad Lewis 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/man/man1m/zfs-program.1m

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Fri Sep 22 
08:13:09 2017(r323911)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Fri Sep 22 
08:15:35 2017(r323912)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 RackTop Systems.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
@@ -2452,14 +2452,7 @@ dsl_dataset_handoff_check(dsl_dataset_t *ds, void *own
return (0);
 }
 
-typedef struct dsl_dataset_rollback_arg {
-   const char *ddra_fsname;
-   const char *ddra_tosnap;
-   void *ddra_owner;
-   nvlist_t *ddra_result;
-} dsl_dataset_rollback_arg_t;
-
-static int
+int
 dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx)
 {
dsl_dataset_rollback_arg_t *ddra = arg;
@@ -2567,7 +2560,7 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx)
return (0);
 }
 
-static void
+void
 dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx)
 {
dsl_dataset_rollback_arg_t *ddra = arg;

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h Fri Sep 22 
08:13:09 2017(r323911)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h Fri Sep 22 
08:15:35 2017(r323912)
@@ -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, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
@@ -237,6 +237,13 @@ typedef struct dsl_dataset_promote_arg {
cred_t *cr;
 } dsl_dataset_promote_arg_t;
 
+typedef struct dsl_dataset_rollback_arg {
+   const char *ddra_fsname;
+   const char *ddra_tosnap;
+   void *ddra_owner;
+   nvlist_t *ddra_result;
+} dsl_dataset_rollback_arg_t;
+
 /*
  * The max length of a temporary tag prefix is the number of hex digits
  * required to express UINT64_MAX plus one for the hyphen.
@@ -375,6 +382,9 @@ void dsl_dataset_set_refreservation_sync_impl(dsl_data
 void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx);
 boolean_t dsl_dataset_is_zapified(dsl_dataset_t *ds);
 boolean_t dsl_dataset_has_resume_receive_state(dsl_dataset_t *ds);
+
+int dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx);
+void dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx);
 int dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner,
 nvlist_t *result);
 

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.cFri Sep 22 
08:13:09 2017(r323911)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.cFri Sep 22 
08:15:35 2017(r323912)
@@ -14,7 +14,7 @@
  */
 
 /*
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
  */
 
 #include "lua.h"
@@ -177,6 +177,37 @@ zcp_synctask_promote(lua_State *state, boolean_t sync,
return (err);
 }
 
+static int zcp_synctask_rollback(lua_State *, boolean_t, nvlist_t 
*err_details);
+static zcp_synctask_info_t zcp_synctask_rollback_info = {
+   .name = "rollback",
+   .func = zcp_synctask_rollback,
+   .space_check = 

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

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:27:27 2017
New Revision: 323918
URL: https://svnweb.freebsd.org/changeset/base/323918

Log:
  MFV r323917: 8648 Fix range locking in ZIL commit codepath
  
  illumos/illumos-gate@42b14111721da2ebd5159e7b45012a3eb0e3384c
  
https://github.com/illumos/illumos-gate/commit/42b14111721da2ebd5159e7b45012a3eb0e3384c
  
  https://www.illumos.org/issues/8648
I'm opening this bug to track integration of the following ZFS on Linux
commit into illumos:
  
commit f763c3d1df569a8d6b60bcb5e95cf07aa7a189e6
Author: LOLi 
Date:   Mon Aug 21 17:59:48 2017 +0200
  
Fix range locking in ZIL commit codepath
  
Since OpenZFS 7578 (1b7c1e5) if we have a ZVOL with logbias=throughput
we will force WR_INDIRECT itxs in zvol_log_write() setting itx->itx_lr
offset and length to the offset and length of the BIO from
zvol_write()->zvol_log_write(): these offset and length are later used
to take a range lock in zillog->zl_get_data function: zvol_get_data().
  
Now suppose we have a ZVOL with blocksize=8K and push 4K writes to
offset 0: we will only be range-locking 0-4096. This means the
ASSERTion we make in dbuf_unoverride() is no longer valid because now
dmu_sync() is called from zilog's get_data functions holding a partial
lock on the dbuf.
  
Fix this by taking a range lock on the whole block in zvol_get_data().
  
Reviewed-by: Chunwei Chen 
Reviewed-by: Brian Behlendorf 
Signed-off-by: loli10K 
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: Matt Ahrens 
  Reviewed by: Andriy Gapon 
  Reviewed by: Alexander Motin 
  Approved by: Robert Mustacchi 
  Author: LOLi 
  
  MFC after:10 days

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 
22 08:23:24 2017(r323917)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 
22 08:27:27 2017(r323918)
@@ -1343,7 +1343,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio
} else { /* indirect write */
/*
 * Have to lock the whole block to ensure when it's
-* written out and it's checksum is being calculated
+* written out and its checksum is being calculated
 * that no one can change the data. We need to re-check
 * blocksize after we get the lock in case it's changed!
 */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Fri Sep 22 
08:23:24 2017(r323917)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Fri Sep 22 
08:27:27 2017(r323918)
@@ -1349,7 +1349,6 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi
 
zgd = kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
zgd->zgd_zilog = zv->zv_zilog;
-   zgd->zgd_rl = zfs_range_lock(>zv_znode, offset, size, RL_READER);
 
/*
 * Write records come in two flavors: immediate and indirect.
@@ -1358,12 +1357,22 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi
 * sync the data and get a pointer to it (indirect) so that
 * we don't have to write the data twice.
 */
-   if (buf != NULL) {  /* immediate write */
+   if (buf != NULL) { /* immediate write */
+   zgd->zgd_rl = zfs_range_lock(>zv_znode, offset, size,
+   RL_READER);
error = dmu_read(os, object, offset, size, buf,
DMU_READ_NO_PREFETCH);
-   } else {
+   } else { /* indirect write */
+   /*
+* Have to lock the whole block to ensure when it's written out
+* and its checksum is being calculated that no one can change
+* the data. Contrarily to zfs_get_data we need not re-check
+* blocksize after we get the lock because it cannot be changed.
+*/
size = zv->zv_volblocksize;
offset = P2ALIGN(offset, size);
+   zgd->zgd_rl = zfs_range_lock(>zv_znode, offset, size,
+   RL_READER);
error = dmu_buf_hold(os, object, offset, zgd, ,

svn commit: r323908 - head/sys/boot/efi/libefi

2017-09-22 Thread Toomas Soome
Author: tsoome
Date: Fri Sep 22 07:40:05 2017
New Revision: 323908
URL: https://svnweb.freebsd.org/changeset/base/323908

Log:
  libefi: efipart_hdinfo_add_filepath should check strtol result
  
  Use errno for error checking.

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==
--- head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:37:42 2017
(r323907)
+++ head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:40:05 2017
(r323908)
@@ -489,7 +489,14 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle)
return (0);
}
p++;/* skip the colon */
+   errno = 0;
unit = (int)strtol(p, NULL, 0);
+   if (errno != 0) {
+   printf("Bad unit number for partition \"%s\"\n", pathname);
+   free(pathname);
+   free(pd);
+   return (EUNIT);
+   }
 
/*
 * We should have disk registered, if not, we are receiving
___
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: r323909 - head/sys/boot/efi/libefi

2017-09-22 Thread Toomas Soome
Author: tsoome
Date: Fri Sep 22 07:44:36 2017
New Revision: 323909
URL: https://svnweb.freebsd.org/changeset/base/323909

Log:
  libefi: define EISA PNP constants
  
  Define EISA PNP constants and use them, also fix ID for 0x701

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==
--- head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:40:05 2017
(r323908)
+++ head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:44:36 2017
(r323909)
@@ -58,6 +58,11 @@ static int efipart_printfd(int);
 static int efipart_printcd(int);
 static int efipart_printhd(int);
 
+/* EISA PNP ID's for floppy controllers */
+#definePNP0604 0x604
+#definePNP0700 0x700
+#definePNP0701 0x701
+
 struct devsw efipart_fddev = {
.dv_name = "fd",
.dv_type = DEVT_FD,
@@ -181,9 +186,9 @@ efipart_floppy(EFI_DEVICE_PATH *node)
if (DevicePathType(node) == ACPI_DEVICE_PATH &&
DevicePathSubType(node) == ACPI_DP) {
acpi = (ACPI_HID_DEVICE_PATH *) node;
-   if (acpi->HID == EISA_PNP_ID(0x604) ||
-   acpi->HID == EISA_PNP_ID(0x700) ||
-   acpi->HID == EISA_ID(0x41d1, 0x701)) {
+   if (acpi->HID == EISA_PNP_ID(PNP0604) ||
+   acpi->HID == EISA_PNP_ID(PNP0700) ||
+   acpi->HID == EISA_PNP_ID(PNP0701)) {
return (acpi);
}
}
___
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: r323912 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/man/man1m

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:15:35 2017
New Revision: 323912
URL: https://svnweb.freebsd.org/changeset/base/323912

Log:
  8592 ZFS channel programs - rollback
  
  illumos/illumos-gate@000cce6b6fad4a8b0eecef6e1251f6aca1719c55
  
https://github.com/illumos/illumos-gate/commit/000cce6b6fad4a8b0eecef6e1251f6aca1719c55
  
  https://www.illumos.org/issues/8592
ZFS channel programs should be able to perform a rollback. This logic will
probably look pretty similar to zfs.sync.destroy().
  
  Reviewed by: Chris Williamson 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Brad Lewis 

Modified:
  vendor/illumos/dist/man/man1m/zfs-program.1m

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c

Modified: vendor/illumos/dist/man/man1m/zfs-program.1m
==
--- vendor/illumos/dist/man/man1m/zfs-program.1mFri Sep 22 08:13:09 
2017(r323911)
+++ vendor/illumos/dist/man/man1m/zfs-program.1mFri Sep 22 08:15:35 
2017(r323912)
@@ -8,7 +8,7 @@
 .\" http://www.illumos.org/license/CDDL.
 .\"
 .\"
-.\" Copyright (c) 2016 by Delphix. All Rights Reserved.
+.\" Copyright (c) 2016, 2017 by Delphix. All rights reserved.
 .\"
 .Dd January 21, 2016
 .Dt ZFS-PROGRAM 1M
@@ -361,6 +361,17 @@ dataset (string)
 .Bd -ragged -compact -offset ""
 Clone to be promoted.
 .Ed
+.It Em zfs.sync.rollback(filesystem)
+Rollback to the previous snapshot for a dataset.
+Returns 0 on successful rollback, or a nonzero error code otherwise.
+Rollbacks can be performed on filesystems or zvols, but not on snapshots
+or mounted datasets.
+EBUSY is returned in the case where the filesystem is mounted.
+.Pp
+filesystem (string)
+.Bd -ragged -compact -offset ""
+Filesystem to rollback.
+.Ed
 .El
 .It Sy zfs.check submodule
 For each function in the zfs.sync submodule, there is a corresponding zfs.check
@@ -380,6 +391,7 @@ The available zfs.check functions are:
 .Bl -tag -width "xx"
 .It Em zfs.check.destroy(dataset, [defer=true|false])
 .It Em zfs.check.promote(dataset)
+.It Em zfs.check.rollback(filesystem)
 .El
 .It Sy zfs.list submodule
 The zfs.list submodule provides functions for iterating over datasets and
___
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: r323913 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/lib/libzfs_core/common vendor/illumos/dist/man/man1m

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:18:05 2017
New Revision: 323913
URL: https://svnweb.freebsd.org/changeset/base/323913

Log:
  8600 ZFS channel programs - snapshot
  
  illumos/illumos-gate@2840dce1a029098fb784afd951d5f98089f850d8
  
https://github.com/illumos/illumos-gate/commit/2840dce1a029098fb784afd951d5f98089f850d8
  
  https://www.illumos.org/issues/8600
ZFS channel programs should be able to create snapshots.
In addition to the base snapshot functionality, this will likely entail 
adding
extra logic to handle edge cases which were formerly not possible, such as
creating then destroying a snapshot in the same transaction sync.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: John Kennedy 
  Reviewed by: Brad Lewis 
  Approved by: Robert Mustacchi 
  Author: Chris Williamson 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
  vendor/illumos/dist/man/man1m/zfs-program.1m

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Fri Sep 22 
08:15:35 2017(r323912)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c Fri Sep 22 
08:18:05 2017(r323913)
@@ -1081,13 +1081,6 @@ dsl_dataset_snapshot_reserve_space(dsl_dataset_t *ds, 
return (0);
 }
 
-typedef struct dsl_dataset_snapshot_arg {
-   nvlist_t *ddsa_snaps;
-   nvlist_t *ddsa_props;
-   nvlist_t *ddsa_errors;
-   cred_t *ddsa_cr;
-} dsl_dataset_snapshot_arg_t;
-
 int
 dsl_dataset_snapshot_check_impl(dsl_dataset_t *ds, const char *snapname,
 dmu_tx_t *tx, boolean_t recv, uint64_t cnt, cred_t *cr)
@@ -1147,7 +1140,7 @@ dsl_dataset_snapshot_check_impl(dsl_dataset_t *ds, con
return (0);
 }
 
-static int
+int
 dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx)
 {
dsl_dataset_snapshot_arg_t *ddsa = arg;
@@ -1422,7 +1415,7 @@ dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, cons
spa_history_log_internal_ds(ds->ds_prev, "snapshot", tx, "");
 }
 
-static void
+void
 dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx)
 {
dsl_dataset_snapshot_arg_t *ddsa = arg;

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h Fri Sep 22 
08:15:35 2017(r323912)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h Fri Sep 22 
08:18:05 2017(r323913)
@@ -244,6 +244,13 @@ typedef struct dsl_dataset_rollback_arg {
nvlist_t *ddra_result;
 } dsl_dataset_rollback_arg_t;
 
+typedef struct dsl_dataset_snapshot_arg {
+   nvlist_t *ddsa_snaps;
+   nvlist_t *ddsa_props;
+   nvlist_t *ddsa_errors;
+   cred_t *ddsa_cr;
+} dsl_dataset_snapshot_arg_t;
+
 /*
  * The max length of a temporary tag prefix is the number of hex digits
  * required to express UINT64_MAX plus one for the hyphen.
@@ -276,6 +283,8 @@ uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const
 dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
 uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin,
 uint64_t flags, dmu_tx_t *tx);
+void dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx);
+int dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx);
 int dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors);
 void dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx);
 int dsl_dataset_promote_check(void *arg, dmu_tx_t *tx);

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h Fri Sep 22 08:15:35 
2017(r323912)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h Fri Sep 22 08:18:05 
2017(r323913)
@@ -14,7 +14,7 @@
  */
 
 /*
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
  */
 
 #ifndef _SYS_ZCP_H
@@ -136,8 +136,6 @@ typedef struct zcp_lib_info {
const zcp_arg_t pargs[4];
const zcp_arg_t kwargs[2];
 } zcp_lib_info_t;
-
-int zcp_nvlist_to_lua(lua_State *, nvlist_t *, char *, int);
 
 #ifdef __cplusplus
 }

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

svn commit: r323913 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/lib/libzfs_core/common vendor/illumos/dist/man/man1m

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:18:05 2017
New Revision: 323913
URL: https://svnweb.freebsd.org/changeset/base/323913

Log:
  8600 ZFS channel programs - snapshot
  
  illumos/illumos-gate@2840dce1a029098fb784afd951d5f98089f850d8
  
https://github.com/illumos/illumos-gate/commit/2840dce1a029098fb784afd951d5f98089f850d8
  
  https://www.illumos.org/issues/8600
ZFS channel programs should be able to create snapshots.
In addition to the base snapshot functionality, this will likely entail 
adding
extra logic to handle edge cases which were formerly not possible, such as
creating then destroying a snapshot in the same transaction sync.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: John Kennedy 
  Reviewed by: Brad Lewis 
  Approved by: Robert Mustacchi 
  Author: Chris Williamson 

Modified:
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
  vendor/illumos/dist/man/man1m/zfs-program.1m

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
==
--- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.cFri Sep 22 
08:15:35 2017(r323912)
+++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.cFri Sep 22 
08:18:05 2017(r323913)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2017 RackTop Systems.
@@ -142,7 +142,12 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name,
 
if (resultp != NULL) {
*resultp = NULL;
-   zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024);
+   if (ioc == ZFS_IOC_CHANNEL_PROGRAM) {
+   zc.zc_nvlist_dst_size = fnvlist_lookup_uint64(source,
+   ZCP_ARG_MEMLIMIT);
+   } else {
+   zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024);
+   }
zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
malloc(zc.zc_nvlist_dst_size);
if (zc.zc_nvlist_dst == NULL) {
@@ -156,7 +161,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name,
 * If ioctl exited with ENOMEM, we retry the ioctl after
 * increasing the size of the destination nvlist.
 *
-* Channel programs that exit with ENOMEM probably ran over the
+* Channel programs that exit with ENOMEM ran over the
 * lua memory sandbox; they should not be retried.
 */
if (errno == ENOMEM && resultp != NULL &&

Modified: vendor/illumos/dist/man/man1m/zfs-program.1m
==
--- vendor/illumos/dist/man/man1m/zfs-program.1mFri Sep 22 08:15:35 
2017(r323912)
+++ vendor/illumos/dist/man/man1m/zfs-program.1mFri Sep 22 08:18:05 
2017(r323913)
@@ -372,6 +372,18 @@ filesystem (string)
 .Bd -ragged -compact -offset ""
 Filesystem to rollback.
 .Ed
+.It Em zfs.sync.snapshot(dataset)
+Create a snapshot of a filesystem.
+Returns 0 if the snapshot was successfully created,
+and a nonzero error code otherwise.
+.Pp
+Note: Taking a snapshot will fail on any pool older than legacy version 27.
+To enable taking snapshots from ZCP scripts, the pool must be upgraded.
+.Pp
+dataset (string)
+.Bd -ragged -compact -offset ""
+Name of snapshot to create.
+.Ed
 .El
 .It Sy zfs.check submodule
 For each function in the zfs.sync submodule, there is a corresponding zfs.check
@@ -392,6 +404,7 @@ The available zfs.check functions are:
 .It Em zfs.check.destroy(dataset, [defer=true|false])
 .It Em zfs.check.promote(dataset)
 .It Em zfs.check.rollback(filesystem)
+.It Em zfs.check.snapshot(dataset)
 .El
 .It Sy zfs.list submodule
 The zfs.list submodule provides functions for iterating over datasets and
___
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: r323917 - vendor-sys/illumos/dist/uts/common/fs/zfs

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:23:24 2017
New Revision: 323917
URL: https://svnweb.freebsd.org/changeset/base/323917

Log:
  8648 Fix range locking in ZIL commit codepath
  
  illumos/illumos-gate@42b14111721da2ebd5159e7b45012a3eb0e3384c
  
https://github.com/illumos/illumos-gate/commit/42b14111721da2ebd5159e7b45012a3eb0e3384c
  
  https://www.illumos.org/issues/8648
I'm opening this bug to track integration of the following ZFS on Linux
commit into illumos:
  
commit f763c3d1df569a8d6b60bcb5e95cf07aa7a189e6
Author: LOLi 
Date:   Mon Aug 21 17:59:48 2017 +0200
  
Fix range locking in ZIL commit codepath
  
Since OpenZFS 7578 (1b7c1e5) if we have a ZVOL with logbias=throughput
we will force WR_INDIRECT itxs in zvol_log_write() setting itx->itx_lr
offset and length to the offset and length of the BIO from
zvol_write()->zvol_log_write(): these offset and length are later used
to take a range lock in zillog->zl_get_data function: zvol_get_data().
  
Now suppose we have a ZVOL with blocksize=8K and push 4K writes to
offset 0: we will only be range-locking 0-4096. This means the
ASSERTion we make in dbuf_unoverride() is no longer valid because now
dmu_sync() is called from zilog's get_data functions holding a partial
lock on the dbuf.
  
Fix this by taking a range lock on the whole block in zvol_get_data().
  
Reviewed-by: Chunwei Chen 
Reviewed-by: Brian Behlendorf 
Signed-off-by: loli10K 
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: Matt Ahrens 
  Reviewed by: Andriy Gapon 
  Reviewed by: Alexander Motin 
  Approved by: Robert Mustacchi 
  Author: LOLi 

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

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c   Fri Sep 22 
08:21:35 2017(r323916)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c   Fri Sep 22 
08:23:24 2017(r323917)
@@ -1101,7 +1101,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, str
} else { /* indirect write */
/*
 * Have to lock the whole block to ensure when it's
-* written out and it's checksum is being calculated
+* written out and its checksum is being calculated
 * that no one can change the data. We need to re-check
 * blocksize after we get the lock in case it's changed!
 */

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.cFri Sep 22 08:21:35 
2017(r323916)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.cFri Sep 22 08:23:24 
2017(r323917)
@@ -1003,7 +1003,6 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, st
 
zgd = kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
zgd->zgd_lwb = lwb;
-   zgd->zgd_rl = zfs_range_lock(>zv_znode, offset, size, RL_READER);
 
/*
 * Write records come in two flavors: immediate and indirect.
@@ -1012,12 +1011,22 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, st
 * sync the data and get a pointer to it (indirect) so that
 * we don't have to write the data twice.
 */
-   if (buf != NULL) {  /* immediate write */
+   if (buf != NULL) { /* immediate write */
+   zgd->zgd_rl = zfs_range_lock(>zv_znode, offset, size,
+   RL_READER);
error = dmu_read(os, object, offset, size, buf,
DMU_READ_NO_PREFETCH);
-   } else {
+   } else { /* indirect write */
+   /*
+* Have to lock the whole block to ensure when it's written out
+* and its checksum is being calculated that no one can change
+* the data. Contrarily to zfs_get_data we need not re-check
+* blocksize after we get the lock because it cannot be changed.
+*/
size = zv->zv_volblocksize;
offset = P2ALIGN(offset, size);
+   zgd->zgd_rl = zfs_range_lock(>zv_znode, offset, size,
+   RL_READER);
error = dmu_buf_hold(os, object, offset, zgd, ,
DMU_READ_NO_PREFETCH);
if (error == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To 

svn commit: r323906 - head/sys/boot/efi/libefi

2017-09-22 Thread Toomas Soome
Author: tsoome
Date: Fri Sep 22 07:34:08 2017
New Revision: 323906
URL: https://svnweb.freebsd.org/changeset/base/323906

Log:
  libefi: efipart_strategy() should return ENXIO when there is no media
  
  We should return ENXIO to indicate the situation with device present,
  but no media.

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==
--- head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:29:26 2017
(r323905)
+++ head/sys/boot/efi/libefi/efipart.c  Fri Sep 22 07:34:08 2017
(r323906)
@@ -857,7 +857,7 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, s
 
if (pd->pd_blkio->Media->RemovableMedia &&
!pd->pd_blkio->Media->MediaPresent)
-   return (EIO);
+   return (ENXIO);
 
bcd.dv_strategy = efipart_realstrategy;
bcd.dv_devdata = devdata;
___
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: r323910 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2017-09-22 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 22 08:12:08 2017
New Revision: 323910
URL: https://svnweb.freebsd.org/changeset/base/323910

Log:
  Add support for 32-bit compatibility IOCTLs in the LinuxKPI.
  
  Bump the FreeBSD version to force recompilation of external
  kernel modules due to structure change.
  
  PR:   222504
  Submitted by: Greg V 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/fs.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h
==
--- head/sys/compat/linuxkpi/common/include/linux/fs.h  Fri Sep 22 07:44:36 
2017(r323909)
+++ head/sys/compat/linuxkpi/common/include/linux/fs.h  Fri Sep 22 08:12:08 
2017(r323910)
@@ -137,6 +137,7 @@ struct file_operations {
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long);
+   long (*compat_ioctl)(struct file *, unsigned int, unsigned long);
int (*mmap)(struct file *, struct vm_area_struct *);
int (*open)(struct inode *, struct file *);
int (*release)(struct inode *, struct file *);
@@ -157,7 +158,6 @@ struct file_operations {
int (*readdir)(struct file *, void *, filldir_t);
int (*ioctl)(struct inode *, struct file *, unsigned int,
unsigned long);
-   long (*compat_ioctl)(struct file *, unsigned int, unsigned long);
int (*flush)(struct file *, fl_owner_t id);
int (*fsync)(struct file *, struct dentry *, int datasync);
int (*aio_fsync)(struct kiocb *, int datasync);

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Fri Sep 22 07:44:36 
2017(r323909)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Fri Sep 22 08:12:08 
2017(r323910)
@@ -906,7 +906,20 @@ linux_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t 
/* fetch user-space pointer */
data = *(void **)data;
}
-   if (filp->f_op->unlocked_ioctl)
+#if defined(__amd64__)
+   if (td->td_proc->p_elf_machine == EM_386) {
+   /* try the compat IOCTL handler first */
+   if (filp->f_op->compat_ioctl != NULL)
+   error = -filp->f_op->compat_ioctl(filp, cmd, 
(u_long)data);
+   else
+   error = ENOTTY;
+
+   /* fallback to the regular IOCTL handler, if any */
+   if (error == ENOTTY && filp->f_op->unlocked_ioctl != NULL)
+   error = -filp->f_op->unlocked_ioctl(filp, cmd, 
(u_long)data);
+   } else
+#endif
+   if (filp->f_op->unlocked_ioctl != NULL)
error = -filp->f_op->unlocked_ioctl(filp, cmd, (u_long)data);
else
error = ENOTTY;

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hFri Sep 22 07:44:36 2017(r323909)
+++ head/sys/sys/param.hFri Sep 22 08:12:08 2017(r323910)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200045  /* Master, propagated to newvers */
+#define __FreeBSD_version 1200046  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r323911 - vendor/illumos/dist/lib/libzfs/common

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:13:09 2017
New Revision: 323911
URL: https://svnweb.freebsd.org/changeset/base/323911

Log:
  8502 illumos#7955 broke delegated datasets when libshare is not present
  
  illumos/illumos-gate@1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da
  
https://github.com/illumos/illumos-gate/commit/1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da
  
  https://www.illumos.org/issues/8502
The code in lib/libzfs/common/libzfs_mount.c already basically handles
the case when libshare is not installed. We just need to not fail in
zfs_init_libshare_impl.  I tested this in lx and things work as
expected. I also tested there trying to set sharenfs and sharesmb on
the delegated dataset. Neither is allowed from within a zone.  The
spew of msgs from a native zone is not ZFS specific. I see the same
spew simply running the share command.
  
  Reviewed by: Robert Mustacchi 
  Reviewed by: Yuri Pankov 
  Approved by: Richard Lowe 
  Author: Jerry Jelinek 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_mount.cFri Sep 22 
08:12:08 2017(r323910)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_mount.cFri Sep 22 
08:13:09 2017(r323911)
@@ -24,6 +24,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, 2016 by Delphix. All rights reserved.
  * Copyright 2016 Igor Kozhukhov 
+ * Copyright 2017 Joyent, Inc.
  * Copyright 2017 RackTop Systems.
  */
 
@@ -664,8 +665,14 @@ _zfs_init_libshare(void)
 static int
 zfs_init_libshare_impl(libzfs_handle_t *zhandle, int service, void *arg)
 {
+   /*
+* libshare is either not installed or we're in a branded zone. The
+* rest of the wrapper functions around the libshare calls already
+* handle NULL function pointers, but we don't want the callers of
+* zfs_init_libshare() to fail prematurely if libshare is not available.
+*/
if (_sa_init == NULL)
-   return (SA_CONFIG_ERR);
+   return (SA_OK);
 
/*
 * Attempt to refresh libshare. This is necessary if there was a cache
___
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: r323916 - head/sys/dev/usb

2017-09-22 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 22 08:21:35 2017
New Revision: 323916
URL: https://svnweb.freebsd.org/changeset/base/323916

Log:
  Extend sysctl description for hw.usb.disable_enumeration .
  
  PR:   222505
  Submitted by: Julian H. Stacey 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Fri Sep 22 08:21:14 2017(r323915)
+++ head/sys/dev/usb/usb_hub.c  Fri Sep 22 08:21:35 2017(r323916)
@@ -100,7 +100,9 @@ SYSCTL_INT(_hw_usb, OID_AUTO, power_timeout, CTLFLAG_R
 #if USB_HAVE_DISABLE_ENUM
 static int usb_disable_enumeration = 0;
 SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN,
-_disable_enumeration, 0, "Set to disable all USB device enumeration.");
+_disable_enumeration, 0, "Set to disable all USB device enumeration. "
+   "This can secure against USB devices turning evil, "
+   "for example a USB memory stick becoming a USB keyboard.");
 
 static int usb_disable_port_power = 0;
 SYSCTL_INT(_hw_usb, OID_AUTO, disable_port_power, CTLFLAG_RWTUN,
___
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: r323914 - vendor-sys/illumos/dist/uts/common/fs/zfs

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:18:49 2017
New Revision: 323914
URL: https://svnweb.freebsd.org/changeset/base/323914

Log:
  8661 remove "zil-cw2" dtrace probe
  
  illumos/illumos-gate@bd9d3f904625846bdc61af8897a1072029c7aeb7
  
https://github.com/illumos/illumos-gate/commit/bd9d3f904625846bdc61af8897a1072029c7aeb7
  
  https://www.illumos.org/issues/8661
The "zil-cw1" dtrace probe was previously removed in 8558, and the "zil-cw2"
probe should have been removed in that patch as well. Unfortunately, the 
"zil-
cw2" was not removed in 8558, so this bug is to track it's removal.
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Igor Kozhukhov 
  Approved by: Robert Mustacchi 
  Author: Prakash Surya 

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

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Fri Sep 22 08:18:05 
2017(r323913)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Fri Sep 22 08:18:49 
2017(r323914)
@@ -1995,7 +1995,6 @@ zil_process_commit_list(zilog_t *zilog)
list_remove(>zl_itx_commit_list, itx);
zil_itx_destroy(itx);
}
-   DTRACE_PROBE1(zil__cw2, zilog_t *, zilog);
 
if (lwb == 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: r323915 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-09-22 Thread Andriy Gapon
Author: avg
Date: Fri Sep 22 08:21:14 2017
New Revision: 323915
URL: https://svnweb.freebsd.org/changeset/base/323915

Log:
  MFV r323914: 8661 remove "zil-cw2" dtrace probe
  
  illumos/illumos-gate@bd9d3f904625846bdc61af8897a1072029c7aeb7
  
https://github.com/illumos/illumos-gate/commit/bd9d3f904625846bdc61af8897a1072029c7aeb7
  
  https://www.illumos.org/issues/8661
The "zil-cw1" dtrace probe was previously removed in 8558, and the "zil-cw2"
probe should have been removed in that patch as well. Unfortunately, the 
"zil-
cw2" was not removed in 8558, so this bug is to track it's removal.
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Igor Kozhukhov 
  Approved by: Robert Mustacchi 
  Author: Prakash Surya 
  
  MFC after:1 week

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Fri Sep 22 
08:18:49 2017(r323914)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Fri Sep 22 
08:21:14 2017(r323915)
@@ -1574,7 +1574,6 @@ zil_commit_writer(zilog_t *zilog)
kmem_free(itx, offsetof(itx_t, itx_lr)
+ itx->itx_lr.lrc_reclen);
}
-   DTRACE_PROBE1(zil__cw2, zilog_t *, zilog);
 
/* write the last block out */
if (lwb != NULL && lwb->lwb_zio != 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: r323944 - in head/sys: kern sys

2017-09-22 Thread Stephen Hurd
Author: shurd
Date: Sat Sep 23 01:39:16 2017
New Revision: 323944
URL: https://svnweb.freebsd.org/changeset/base/323944

Log:
  Make struct grouptask gt_name member a char array
  
  Previously, it was just a pointer which was copied, but
  some callers pass in a stack variable which will go out of scope.
  Add GROUPTASK_NAMELEN macro (32) and snprintf() the name into it,
  using "grouptask" if name is NULL. We can now safely include
  gtask->gt_name in console messages.
  
  Reviewed by:  sbruno
  Approved by:  sbruno (mentor)
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D12449

Modified:
  head/sys/kern/subr_gtaskqueue.c
  head/sys/sys/_task.h

Modified: head/sys/kern/subr_gtaskqueue.c
==
--- head/sys/kern/subr_gtaskqueue.c Sat Sep 23 01:37:01 2017
(r323943)
+++ head/sys/kern/subr_gtaskqueue.c Sat Sep 23 01:39:16 2017
(r323944)
@@ -666,7 +666,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr
int qid, error;
 
gtask->gt_uniq = uniq;
-   gtask->gt_name = name;
+   snprintf(gtask->gt_name, GROUPTASK_NAMELEN, "%s", name ? name : 
"grouptask");
gtask->gt_irq = irq;
gtask->gt_cpu = -1;
mtx_lock(>tqg_lock);
@@ -703,7 +703,7 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup, 
error = intr_setaffinity(gtask->gt_irq, CPU_WHICH_IRQ, );
mtx_lock(>tqg_lock);
if (error)
-   printf("%s: setaffinity failed: %d\n", __func__, error);
+   printf("%s: %s setaffinity failed: %d\n", __func__, 
gtask->gt_name, error);
 
}
qgroup->tqg_queue[qid].tgc_cnt++;
@@ -724,7 +724,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc
 
qid = -1;
gtask->gt_uniq = uniq;
-   gtask->gt_name = name;
+   snprintf(gtask->gt_name, GROUPTASK_NAMELEN, "%s", name ? name : 
"grouptask");
gtask->gt_irq = irq;
gtask->gt_cpu = cpu;
mtx_lock(>tqg_lock);
@@ -736,7 +736,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc
}
if (qid == -1) {
mtx_unlock(>tqg_lock);
-   printf("%s: qid not found for %s cpu=%d\n", __func__, 
name, cpu);
+   printf("%s: qid not found for %s cpu=%d\n", __func__, 
gtask->gt_name, cpu);
return (EINVAL);
}
} else
@@ -775,7 +775,7 @@ taskqgroup_attach_cpu_deferred(struct taskqgroup *qgro
}
if (qid == -1) {
mtx_unlock(>tqg_lock);
-   printf("%s: qid not found for cpu=%d\n", __func__, cpu);
+   printf("%s: qid not found for %s cpu=%d\n", __func__, 
gtask->gt_name, cpu);
return (EINVAL);
}
qgroup->tqg_queue[qid].tgc_cnt++;
@@ -805,7 +805,7 @@ taskqgroup_detach(struct taskqgroup *qgroup, struct gr
if (qgroup->tqg_queue[i].tgc_taskq == gtask->gt_taskqueue)
break;
if (i == qgroup->tqg_cnt)
-   panic("taskqgroup_detach: task not in group\n");
+   panic("taskqgroup_detach: task %s not in group\n", 
gtask->gt_name);
qgroup->tqg_queue[i].tgc_cnt--;
LIST_REMOVE(gtask, gt_list);
mtx_unlock(>tqg_lock);

Modified: head/sys/sys/_task.h
==
--- head/sys/sys/_task.hSat Sep 23 01:37:01 2017(r323943)
+++ head/sys/sys/_task.hSat Sep 23 01:39:16 2017(r323944)
@@ -65,7 +65,8 @@ struct grouptask {
void*gt_taskqueue;
LIST_ENTRY(grouptask)   gt_list;
void*gt_uniq;
-   char*gt_name;
+#define GROUPTASK_NAMELEN  32
+   chargt_name[GROUPTASK_NAMELEN];
int16_t gt_irq;
int16_t gt_cpu;
 };
___
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: r323941 - in head/sys: dev/e1000 net

2017-09-22 Thread Stephen Hurd
Author: shurd
Date: Sat Sep 23 01:33:20 2017
New Revision: 323941
URL: https://svnweb.freebsd.org/changeset/base/323941

Log:
  Some small packet performance improvements
  
  If the packet is smaller than MTU, disable the TSO flags.
  Move TCP header parsing inside the IS_TSO?() test.
  Add a new IFLIB_NEED_ZERO_CSUM flag to indicate the checksums need to be 
zeroed before TX.
  
  Reviewed by:  sbruno
  Approved by:  sbruno (mentor)
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D12442

Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/net/iflib.c
  head/sys/net/iflib.h

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Fri Sep 22 22:19:56 2017(r323940)
+++ head/sys/dev/e1000/if_em.c  Sat Sep 23 01:33:20 2017(r323941)
@@ -483,7 +483,7 @@ static struct if_shared_ctx em_sctx_init = {
.isc_vendor_info = em_vendor_info_array,
.isc_driver_version = em_driver_version,
.isc_driver = _if_driver,
-   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_TSO_INIT_IP,
+   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_TSO_INIT_IP | 
IFLIB_NEED_ZERO_CSUM,
 
.isc_nrxd_min = {EM_MIN_RXD},
.isc_ntxd_min = {EM_MIN_TXD},
@@ -511,7 +511,7 @@ static struct if_shared_ctx igb_sctx_init = {
.isc_vendor_info = igb_vendor_info_array,
.isc_driver_version = em_driver_version,
.isc_driver = _if_driver,
-   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_TSO_INIT_IP,
+   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_TSO_INIT_IP | 
IFLIB_NEED_ZERO_CSUM,
 
.isc_nrxd_min = {EM_MIN_RXD},
.isc_ntxd_min = {EM_MIN_TXD},

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cFri Sep 22 22:19:56 2017(r323940)
+++ head/sys/net/iflib.cSat Sep 23 01:33:20 2017(r323941)
@@ -2696,6 +2696,10 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, 
pi->ipi_ehdrlen = ETHER_HDR_LEN;
}
 
+   if (if_getmtu(txq->ift_ctx->ifc_ifp) >= pi->ipi_len) {
+   pi->ipi_csum_flags &= ~(CSUM_IP_TSO|CSUM_IP6_TSO);
+   }
+
switch (pi->ipi_etype) {
 #ifdef INET
case ETHERTYPE_IP:
@@ -2740,21 +2744,21 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, 
pi->ipi_ipproto = ip->ip_p;
pi->ipi_flags |= IPI_TX_IPV4;
 
-   if (pi->ipi_csum_flags & CSUM_IP)
+   if ((sctx->isc_flags & IFLIB_NEED_ZERO_CSUM) && 
(pi->ipi_csum_flags & CSUM_IP))
ip->ip_sum = 0;
 
-   if (pi->ipi_ipproto == IPPROTO_TCP) {
-   if (__predict_false(th == NULL)) {
-   txq->ift_pullups++;
-   if (__predict_false((m = m_pullup(m, (ip->ip_hl 
<< 2) + sizeof(*th))) == NULL))
-   return (ENOMEM);
-   th = (struct tcphdr *)((caddr_t)ip + 
pi->ipi_ip_hlen);
-   }
-   pi->ipi_tcp_hflags = th->th_flags;
-   pi->ipi_tcp_hlen = th->th_off << 2;
-   pi->ipi_tcp_seq = th->th_seq;
-   }
if (IS_TSO4(pi)) {
+   if (pi->ipi_ipproto == IPPROTO_TCP) {
+   if (__predict_false(th == NULL)) {
+   txq->ift_pullups++;
+   if (__predict_false((m = m_pullup(m, 
(ip->ip_hl << 2) + sizeof(*th))) == NULL))
+   return (ENOMEM);
+   th = (struct tcphdr *)((caddr_t)ip + 
pi->ipi_ip_hlen);
+   }
+   pi->ipi_tcp_hflags = th->th_flags;
+   pi->ipi_tcp_hlen = th->th_off << 2;
+   pi->ipi_tcp_seq = th->th_seq;
+   }
if (__predict_false(ip->ip_p != IPPROTO_TCP))
return (ENXIO);
th->th_sum = in_pseudo(ip->ip_src.s_addr,
@@ -2785,15 +2789,15 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, 
pi->ipi_ipproto = ip6->ip6_nxt;
pi->ipi_flags |= IPI_TX_IPV6;
 
-   if (pi->ipi_ipproto == IPPROTO_TCP) {
-   if (__predict_false(m->m_len < pi->ipi_ehdrlen + 
sizeof(struct ip6_hdr) + sizeof(struct tcphdr))) {
-   if (__predict_false((m = m_pullup(m, 
pi->ipi_ehdrlen + sizeof(struct ip6_hdr) + sizeof(struct tcphdr))) == NULL))
-   return (ENOMEM);
-   }
-   pi->ipi_tcp_hflags = th->th_flags;
-   pi->ipi_tcp_hlen = th->th_off << 2;

Re: svn commit: r323942 - head/sys/net

2017-09-22 Thread Bjoern A. Zeeb
On 23 Sep 2017, at 1:35, Stephen Hurd wrote:

> Author: shurd
> Date: Sat Sep 23 01:35:14 2017
> New Revision: 323942
> URL: https://svnweb.freebsd.org/changeset/base/323942
>
> Log:
>   Chain mbufs before passing to if_input()
>
>   Build a list of mbufs to pass to if_input() after LRO. Results in
>   12% small packet forwarding rate improvement.

forwarding seems a confusing word here..


>   Reviewed by:sbruno
>   Approved by:sbruno (mentor)
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D12444
>
> Modified:
>   head/sys/net/iflib.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"


svn commit: r323942 - head/sys/net

2017-09-22 Thread Stephen Hurd
Author: shurd
Date: Sat Sep 23 01:35:14 2017
New Revision: 323942
URL: https://svnweb.freebsd.org/changeset/base/323942

Log:
  Chain mbufs before passing to if_input()
  
  Build a list of mbufs to pass to if_input() after LRO. Results in
  12% small packet forwarding rate improvement.
  
  Reviewed by:  sbruno
  Approved by:  sbruno (mentor)
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D12444

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cSat Sep 23 01:33:20 2017(r323941)
+++ head/sys/net/iflib.cSat Sep 23 01:35:14 2017(r323942)
@@ -2470,7 +2470,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
 * XXX early demux data packets so that if_input processing only handles
 * acks in interrupt context
 */
-   struct mbuf *m, *mh, *mt;
+   struct mbuf *m, *mh, *mt, *mf;
 
ifp = ctx->ifc_ifp;
mh = mt = NULL;
@@ -2541,8 +2541,11 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
__iflib_fl_refill_lt(ctx, fl, budget + 8);
 
lro_enabled = (if_getcapenable(ifp) & IFCAP_LRO);
+   mt = mf = NULL;
while (mh != NULL) {
m = mh;
+   if (mf == NULL)
+   mf = m;
mh = mh->m_nextpkt;
m->m_nextpkt = NULL;
 #ifndef __NO_STRICT_ALIGNMENT
@@ -2552,11 +2555,19 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
rx_bytes += m->m_pkthdr.len;
rx_pkts++;
 #if defined(INET6) || defined(INET)
-   if (lro_enabled && tcp_lro_rx(>ifr_lc, m, 0) == 0)
+   if (lro_enabled && tcp_lro_rx(>ifr_lc, m, 0) == 0) {
+   if (mf == m)
+   mf = NULL;
continue;
+   }
 #endif
+   if (mt != NULL)
+   mt->m_nextpkt = m;
+   mt = m;
+   }
+   if (mf != NULL) {
+   ifp->if_input(ifp, mf);
DBG_COUNTER_INC(rx_if_input);
-   ifp->if_input(ifp, m);
}
 
if_inc_counter(ifp, IFCOUNTER_IBYTES, rx_bytes);
___
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: r323943 - head/sys/net

2017-09-22 Thread Stephen Hurd
Author: shurd
Date: Sat Sep 23 01:37:01 2017
New Revision: 323943
URL: https://svnweb.freebsd.org/changeset/base/323943

Log:
  Make the rx budget a tunable
  
  This allows tuning the rx budget for special load profiles
  as well as more easily testing to determine sane defaults.
  
  Reviewed by:  sbruno
  Approved by:  sbruno (mentor)
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D12445

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cSat Sep 23 01:35:14 2017(r323942)
+++ head/sys/net/iflib.cSat Sep 23 01:37:01 2017(r323943)
@@ -185,6 +185,7 @@ struct iflib_ctx {
uint16_t ifc_sysctl_ntxqs;
uint16_t ifc_sysctl_nrxqs;
uint16_t ifc_sysctl_qs_eq_override;
+   uint16_t ifc_sysctl_rx_budget;
 
qidx_t ifc_sysctl_ntxds[8];
qidx_t ifc_sysctl_nrxds[8];
@@ -3531,6 +3532,7 @@ _task_fn_rx(void *context)
if_ctx_t ctx = rxq->ifr_ctx;
bool more;
int rc;
+   uint16_t budget;
 
 #ifdef IFLIB_DIAGNOSTICS
rxq->ifr_cpu_exec_count[curcpu]++;
@@ -3547,7 +3549,10 @@ _task_fn_rx(void *context)
}
}
 #endif
-   if (more == false || (more = iflib_rxeof(rxq, 16 /* XXX */)) == false) {
+   budget = ctx->ifc_sysctl_rx_budget;
+   if (budget == 0)
+   budget = 16;/* XXX */
+   if (more == false || (more = iflib_rxeof(rxq, budget)) == false) {
if (ctx->ifc_flags & IFC_LEGACY)
IFDI_INTR_ENABLE(ctx);
else {
@@ -5486,9 +5491,12 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx)
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_qs_enable",
   CTLFLAG_RWTUN, >ifc_sysctl_qs_eq_override, 0,
"permit #txq != #rxq");
-   SYSCTL_ADD_INT(ctx_list, oid_list, OID_AUTO, "disable_msix",
+   SYSCTL_ADD_INT(ctx_list, oid_list, OID_AUTO, "disable_msix",
   CTLFLAG_RWTUN, >ifc_softc_ctx.isc_disable_msix, 0,
   "disable MSIX (default 0)");
+   SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "rx_budget",
+  CTLFLAG_RWTUN, >ifc_sysctl_rx_budget, 0,
+   "set the rx budget");
 
/* XXX change for per-queue sizes */
SYSCTL_ADD_PROC(ctx_list, oid_list, OID_AUTO, "override_ntxds",
___
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: r323393 - in head/sys: sys vm

2017-09-22 Thread Mateusz Guzik
On Thu, Sep 14, 2017 at 12:32 AM, Gleb Smirnoff  wrote:

> On Mon, Sep 11, 2017 at 09:30:10AM +0200, Mateusz Guzik wrote:
> M> First, there is a bunch of counter(9) fields. I don't know the original
> M> reasoning. I would expect these counters to be statically defined in a
> M> per-cpu struct.
>
> The reasoning was to remove 'struct vmmeter' from the 'struct pcpu', which
> sounds inline with your desire to remote struct vmmeter from the kernel
> at all.
>
> Maintainance wise, it is much easier not to bloat 'struct pcpu' with
> various global statistics, but keep them as counter(9)s instead. Indeed,
> what's the big difference between TCP statistics and VM statistics, why
> treat them differently?
>
> Performance wise, I haven't seen any regressions when collapsed
> multiple entities of struct vmmeter sitting in struct pcpu, into
> single one with counter(9)s.
>

My general point is that low-level primitives are weirdly heavier than
they need to be. Notable example is critical_enter/exit which are both
function calls.

As for counter(9), it adds an avoidable read. You are not going to measure
the impact as it is due to the kernel being rather pessimized in general.
pmc
will probably show slight increase in cache misses, but that's it.

That said, if maintenance is easier (I don't see why though) that's fine,
I'm
definitely not interested in fighting over this one.

-- 
Mateusz Guzik 
___
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: r323923 - in head: lib/libufs sbin/dumpfs sbin/fsck_ffs sbin/fsdb sbin/newfs sys/kern sys/libkern sys/sys sys/ufs/ffs

2017-09-22 Thread Ed Maste
)On 22 September 2017 at 14:45, Kirk McKusick  wrote:
> Author: mckusick
> Date: Fri Sep 22 12:45:15 2017
> New Revision: 323923
> URL: https://svnweb.freebsd.org/changeset/base/323923
>
> Log:
>   Continuing efforts to provide hardening of FFS, this change adds a

i386 and others are broken after this change (from
https://ci.freebsd.org/job/FreeBSD-head-i386-build/4050/console):

13:25:09 /usr/src/sys/ufs/ffs/ffs_alloc.c:2619:27: error: format
specifies type 'unsigned long' but the argument has type 'uint64_t'
(aka 'unsigned long long') [-Werror,-Wformat]
13:25:09 cg, cgp->cg_ckhash, bp->b_ckhash);
13:25:09 ^~~~
___
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: r323923 - in head: lib/libufs sbin/dumpfs sbin/fsck_ffs sbin/fsdb sbin/newfs sys/kern sys/libkern sys/sys sys/ufs/ffs

2017-09-22 Thread Kirk McKusick
Author: mckusick
Date: Fri Sep 22 12:45:15 2017
New Revision: 323923
URL: https://svnweb.freebsd.org/changeset/base/323923

Log:
  Continuing efforts to provide hardening of FFS, this change adds a
  check hash to cylinder groups. If a check hash fails when a cylinder
  group is read, no further allocations are attempted in that cylinder
  group until it has been fixed by fsck. This avoids a class of
  filesystem panics related to corrupted cylinder group maps. The
  hash is done using crc32c.
  
  Check hases are added only to UFS2 and not to UFS1 as UFS1 is primarily
  used in embedded systems with small memories and low-powered processors
  which need as light-weight a filesystem as possible.
  
  Specifics of the changes:
  
  sys/sys/buf.h:
  Add BX_FSPRIV to reserve a set of eight b_xflags that may be used
  by individual filesystems for their own purpose. Their specific
  definitions are found in the header files for each filesystem
  that uses them. Also add fields to struct buf as noted below.
  
  sys/kern/vfs_bio.c:
  It is only necessary to compute a check hash for a cylinder
  group when it is actually read from disk. When calling bread,
  you do not know whether the buffer was found in the cache or
  read. So a new flag (GB_CKHASH) and a pointer to a function to
  perform the hash has been added to breadn_flags to say that the
  function should be called to calculate a hash if the data has
  been read. The check hash is placed in b_ckhash and the B_CKHASH
  flag is set to indicate that a read was done and a check hash
  calculated. Though a rather elaborate mechanism, it should
  also work for check hashing other metadata in the future. A
  kernel internal API change was to change breada into a static
  fucntion and add flags and a function pointer to a check-hash
  function.
  
  sys/ufs/ffs/fs.h:
  Add flags for types of check hashes; stored in a new word in the
  superblock. Define corresponding BX_ flags for the different types
  of check hashes. Add a check hash word in the cylinder group.
  
  sys/ufs/ffs/ffs_alloc.c:
  In ffs_getcg do the dance with breadn_flags to get a check hash and
  if one is provided, check it.
  
  sys/ufs/ffs/ffs_vfsops.c:
  Copy across the BX_FFSTYPES flags in background writes.
  Update the check hash when writing out buffers that need them.
  
  sys/ufs/ffs/ffs_snapshot.c:
  Recompute check hash when updating snapshot cylinder groups.
  
  sys/libkern/crc32.c:
  lib/libufs/Makefile:
  lib/libufs/libufs.h:
  lib/libufs/cgroup.c:
  Include libkern/crc32.c in libufs and use it to compute check
  hashes when updating cylinder groups.
  
  Four utilities are affected:
  
  sbin/newfs/mkfs.c:
  Add the check hashes when building the cylinder groups.
  
  sbin/fsck_ffs/fsck.h:
  sbin/fsck_ffs/fsutil.c:
  Verify and update check hashes when checking and writing cylinder groups.
  
  sbin/fsck_ffs/pass5.c:
  Offer to add check hashes to existing filesystems.
  Precompute check hashes when rebuilding cylinder group
  (although this will be done when it is written in fsutil.c
  it is necessary to do it early before comparing with the old
  cylinder group)
  
  sbin/dumpfs/dumpfs.c
  Print out the new check hash flag(s)
  
  sbin/fsdb/Makefile:
  Needs to add libufs now used by pass5.c imported from fsck_ffs.
  
  Reviewed by: kib
  Tested by: Peter Holm (pho)

Modified:
  head/lib/libufs/Makefile
  head/lib/libufs/cgroup.c
  head/lib/libufs/libufs.h
  head/sbin/dumpfs/dumpfs.c
  head/sbin/fsck_ffs/fsutil.c
  head/sbin/fsck_ffs/pass5.c
  head/sbin/fsdb/Makefile
  head/sbin/newfs/mkfs.c
  head/sys/kern/vfs_bio.c
  head/sys/libkern/crc32.c
  head/sys/sys/buf.h
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_inode.c
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ffs/fs.h

Modified: head/lib/libufs/Makefile
==
--- head/lib/libufs/MakefileFri Sep 22 12:07:03 2017(r323922)
+++ head/lib/libufs/MakefileFri Sep 22 12:45:15 2017(r323923)
@@ -5,7 +5,7 @@ LIB=ufs
 SHLIBDIR?= /lib
 SHLIB_MAJOR=   6
 
-SRCS=  block.c cgroup.c inode.c sblock.c type.c ffs_subr.c ffs_tables.c
+SRCS=  block.c cgroup.c crc32.c inode.c sblock.c type.c ffs_subr.c ffs_tables.c
 INCS=  libufs.h
 
 MAN=   bread.3 cgread.3 libufs.3 sbread.3 ufs_disk_close.3
@@ -18,7 +18,7 @@ MLINKS+= ufs_disk_close.3 ufs_disk_fillout.3
 MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3
 MLINKS+= ufs_disk_close.3 ufs_disk_write.3
 
-.PATH:  ${SRCTOP}/sys/ufs/ffs
+.PATH:  ${SRCTOP}/sys/libkern ${SRCTOP}/sys/ufs/ffs
 
 WARNS?=2
 

Modified: head/lib/libufs/cgroup.c
==
--- head/lib/libufs/cgroup.cFri Sep 22 12:07:03 2017

svn commit: r323922 - in head/sys/dev: mpr mps

2017-09-22 Thread Scott Long
Author: scottl
Date: Fri Sep 22 12:07:03 2017
New Revision: 323922
URL: https://svnweb.freebsd.org/changeset/base/323922

Log:
  Clean up error messages related to device discovery
  
  Sponsored by: Netflix

Modified:
  head/sys/dev/mpr/mpr_sas_lsi.c
  head/sys/dev/mps/mps_sas_lsi.c

Modified: head/sys/dev/mpr/mpr_sas_lsi.c
==
--- head/sys/dev/mpr/mpr_sas_lsi.c  Fri Sep 22 10:51:32 2017
(r323921)
+++ head/sys/dev/mpr/mpr_sas_lsi.c  Fri Sep 22 12:07:03 2017
(r323922)
@@ -781,9 +781,11 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8
 
sassc = sc->sassc;
mprsas_startup_increment(sassc);
-   if ((mpr_config_get_sas_device_pg0(sc, _reply, _page,
-MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
-   printf("%s: error reading SAS device page0\n", __func__);
+   if (mpr_config_get_sas_device_pg0(sc, _reply, _page,
+   MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle) != 0) {
+   mpr_dprint(sc, MPR_INFO|MPR_MAPPING|MPR_FAULT,
+   "Error reading SAS device %#x page0, iocstatus= 0x%x\n",
+   handle, mpi_reply.IOCStatus);
error = ENXIO;
goto out;
}
@@ -795,12 +797,14 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8
Mpi2ConfigReply_t tmp_mpi_reply;
Mpi2SasDevicePage0_t parent_config_page;
 
-   if ((mpr_config_get_sas_device_pg0(sc, _mpi_reply,
-_config_page, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
-le16toh(config_page.ParentDevHandle {
+   if (mpr_config_get_sas_device_pg0(sc, _mpi_reply,
+   _config_page, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
+   le16toh(config_page.ParentDevHandle)) != 0) {
mpr_dprint(sc, MPR_MAPPING|MPR_FAULT,
-  "%s: error reading SAS device %#x page0\n",
-   __func__, le16toh(config_page.ParentDevHandle));
+   "Error reading parent SAS device %#x page0, "
+   "iocstatus= 0x%x\n",
+   le16toh(config_page.ParentDevHandle),
+   tmp_mpi_reply.IOCStatus);
} else {
parent_sas_address = parent_config_page.SASAddress.High;
parent_sas_address = (parent_sas_address << 32) |
@@ -1148,8 +1152,9 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 han
 * If the request returns an error then we need to do a diag
 * reset
 */
-   printf("%s: request for page completed with error %d",
-   __func__, error);
+   mpr_dprint(sc, MPR_INFO|MPR_FAULT|MPR_MAPPING,
+   "Request for SATA PASSTHROUGH page completed with error %d",
+   error);
error = ENXIO;
goto out;
}
@@ -1157,8 +1162,9 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 han
bcopy(reply, mpi_reply, sizeof(Mpi2SataPassthroughReply_t));
if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) !=
MPI2_IOCSTATUS_SUCCESS) {
-   printf("%s: error reading SATA PASSTHRU; iocstatus = 0x%x\n",
-   __func__, reply->IOCStatus);
+   mpr_dprint(sc, MPR_INFO|MPR_MAPPING|MPR_FAULT,
+   "Error reading device %#x SATA PASSTHRU; iocstatus= 0x%x\n",
+   handle, reply->IOCStatus);
error = ENXIO;
goto out;
}

Modified: head/sys/dev/mps/mps_sas_lsi.c
==
--- head/sys/dev/mps/mps_sas_lsi.c  Fri Sep 22 10:51:32 2017
(r323921)
+++ head/sys/dev/mps/mps_sas_lsi.c  Fri Sep 22 12:07:03 2017
(r323922)
@@ -628,9 +628,11 @@ mpssas_add_device(struct mps_softc *sc, u16 handle, u8
 
sassc = sc->sassc;
mpssas_startup_increment(sassc);
-   if ((mps_config_get_sas_device_pg0(sc, _reply, _page,
-MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
-   printf("%s: error reading SAS device page0\n", __func__);
+   if (mps_config_get_sas_device_pg0(sc, _reply, _page,
+   MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle) != 0) {
+   mps_dprint(sc, MPS_INFO|MPS_MAPPING|MPS_FAULT,
+   "Error reading SAS device %#x page0, iocstatus= 0x%x\n",
+   handle, mpi_reply.IOCStatus);
error = ENXIO;
goto out;
}
@@ -642,12 +644,14 @@ mpssas_add_device(struct mps_softc *sc, u16 handle, u8
Mpi2ConfigReply_t tmp_mpi_reply;
Mpi2SasDevicePage0_t parent_config_page;
 
-   if ((mps_config_get_sas_device_pg0(sc, _mpi_reply,
-_config_page, 

svn commit: r323902 - head/sys/netinet

2017-09-22 Thread Michael Tuexen
Author: tuexen
Date: Fri Sep 22 06:07:47 2017
New Revision: 323902
URL: https://svnweb.freebsd.org/changeset/base/323902

Log:
  Add missing socket lock.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Fri Sep 22 05:14:11 2017(r323901)
+++ head/sys/netinet/sctp_pcb.c Fri Sep 22 06:07:47 2017(r323902)
@@ -2484,7 +2484,9 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
inp->sctp_flags = (SCTP_PCB_FLAGS_TCPTYPE |
SCTP_PCB_FLAGS_UNBOUND);
/* Be sure we have blocking IO by default */
+   SOCK_LOCK(so);
SCTP_CLEAR_SO_NBIO(so);
+   SOCK_UNLOCK(so);
} else {
/*
 * unsupported socket type (RAW, etc)- in case we missed it
___
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: r323903 - stable/11/usr.bin/grep/regex

2017-09-22 Thread Ed Maste
Author: emaste
Date: Fri Sep 22 06:16:21 2017
New Revision: 323903
URL: https://svnweb.freebsd.org/changeset/base/323903

Log:
  MFC r323611: fastmatch.h: remove duplicate #defines

Modified:
  stable/11/usr.bin/grep/regex/fastmatch.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/grep/regex/fastmatch.h
==
--- stable/11/usr.bin/grep/regex/fastmatch.hFri Sep 22 06:07:47 2017
(r323902)
+++ stable/11/usr.bin/grep/regex/fastmatch.hFri Sep 22 06:16:21 2017
(r323903)
@@ -92,17 +92,4 @@ tre_fastwnexec(const fastmatch_t *preg, const wchar_t 
 #define fastexec   tre_fastexec
 #define fastwnexec tre_fastwnexec
 #define fastwexec  tre_fastwexec
-#define fixcomptre_fixcomp
-#define fastcomp   tre_fastcomp
-#define fastexec   tre_fastexec
-#define fastfree   tre_fastfree
-#define fixwcomp   tre_fixwcomp
-#define fastwcomp  tre_fastwcomp
-#define fastwexec  tre_fastwexec
-#define fixncomp   tre_fixncomp
-#define fastncomp  tre_fastncomp
-#define fastnexec  tre_fastnexec
-#define fixwncomp  tre_fixwncomp
-#define fastwncomp tre_fastwncomp
-#define fastwnexec tre_fastwnexec
 #endif /* FASTMATCH_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"


svn commit: r323904 - head/sys/netinet

2017-09-22 Thread Michael Tuexen
Author: tuexen
Date: Fri Sep 22 06:33:01 2017
New Revision: 323904
URL: https://svnweb.freebsd.org/changeset/base/323904

Log:
  Add missing locking. Found by Coverity while scanning the usrsctp
  library.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Fri Sep 22 06:16:21 2017
(r323903)
+++ head/sys/netinet/sctp_input.c   Fri Sep 22 06:33:01 2017
(r323904)
@@ -699,6 +699,14 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb)
 */
struct sctpasochead *head;
 
+   if ((SCTP_GET_STATE(>asoc) == SCTP_STATE_COOKIE_WAIT) ||
+   (SCTP_GET_STATE(>asoc) == SCTP_STATE_COOKIE_ECHOED)) {
+   atomic_add_int(>asoc.refcnt, 1);
+   SCTP_TCB_UNLOCK(stcb);
+   SCTP_INP_INFO_WLOCK();
+   SCTP_TCB_LOCK(stcb);
+   atomic_subtract_int(>asoc.refcnt, 1);
+   }
if (SCTP_GET_STATE(>asoc) == SCTP_STATE_COOKIE_WAIT) {
/* generate a new vtag and send init */
LIST_REMOVE(stcb, sctp_asocs);
@@ -710,6 +718,7 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb)
 */
LIST_INSERT_HEAD(head, stcb, sctp_asocs);
sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED);
+   SCTP_INP_INFO_WUNLOCK();
return (1);
}
if (SCTP_GET_STATE(>asoc) == SCTP_STATE_COOKIE_ECHOED) {
@@ -731,6 +740,7 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb)
 */
LIST_INSERT_HEAD(head, stcb, sctp_asocs);
sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED);
+   SCTP_INP_INFO_WUNLOCK();
return (1);
}
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323925 - in stable: 10/release/tools 11/release/tools

2017-09-22 Thread Glen Barber
Author: gjb
Date: Fri Sep 22 14:40:04 2017
New Revision: 323925
URL: https://svnweb.freebsd.org/changeset/base/323925

Log:
  MFC r323924:
   Revert r323812 from release/tools/arm.subr, which has broken the
   build on arm/armv6 images.
  
  Pointyhat:gjb (myself)
  MFC note: releng/10.4 has broken because of this
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/tools/arm.subr
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/release/tools/arm.subr
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/release/tools/arm.subr
==
--- stable/10/release/tools/arm.subrFri Sep 22 14:34:27 2017
(r323924)
+++ stable/10/release/tools/arm.subrFri Sep 22 14:40:04 2017
(r323925)
@@ -99,16 +99,6 @@ arm_install_base() {
TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
DESTDIR=${DESTDIR} KERNCONF=${KERNEL} \
installworld installkernel distribution
-
-   # Bootstrap etcupdate(8) and mergemaster(8) databases.
-   mkdir -p ${DESTDIR}/var/db/etcupdate
-   etcupdate extract -B \
-   -M "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -s ${WORLDDIR} -d ${DESTDIR}/var/db/etcupdate
-   sh ${WORLDDIR}/release/scripts/mm-mtree.sh -m ${WORLDDIR} \
-   -F "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -D ${DESTDIR}
-
chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos
 
arm_create_user
___
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: r323924 - head/release/tools

2017-09-22 Thread Glen Barber
Author: gjb
Date: Fri Sep 22 14:34:27 2017
New Revision: 323924
URL: https://svnweb.freebsd.org/changeset/base/323924

Log:
  Revert r323812 from release/tools/arm.subr, which has broken the
  build on arm/armv6 images.
  
  Pointyhat:gjb (myself)
  MFC after:immediate
  MFC note: releng/10.4 has broken because of this
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/tools/arm.subr

Modified: head/release/tools/arm.subr
==
--- head/release/tools/arm.subr Fri Sep 22 12:45:15 2017(r323923)
+++ head/release/tools/arm.subr Fri Sep 22 14:34:27 2017(r323924)
@@ -99,16 +99,6 @@ arm_install_base() {
TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
DESTDIR=${DESTDIR} KERNCONF=${KERNEL} \
installworld installkernel distribution
-
-   # Bootstrap etcupdate(8) and mergemaster(8) databases.
-   mkdir -p ${DESTDIR}/var/db/etcupdate
-   etcupdate extract -B \
-   -M "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -s ${WORLDDIR} -d ${DESTDIR}/var/db/etcupdate
-   sh ${WORLDDIR}/release/scripts/mm-mtree.sh -m ${WORLDDIR} \
-   -F "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -D ${DESTDIR}
-
chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos
 
arm_create_user
___
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: r323923 - in head: lib/libufs sbin/dumpfs sbin/fsck_ffs sbin/fsdb sbin/newfs sys/kern sys/libkern sys/sys sys/ufs/ffs

2017-09-22 Thread Conrad Meyer
On Fri, Sep 22, 2017 at 5:45 AM, Kirk McKusick  wrote:
> Author: mckusick
> Date: Fri Sep 22 12:45:15 2017
> New Revision: 323923
> URL: https://svnweb.freebsd.org/changeset/base/323923
>
> Log:
>   Continuing efforts to provide hardening of FFS, this change adds a
>   check hash to cylinder groups. If a check hash fails when a cylinder
>   group is read, no further allocations are attempted in that cylinder
>   group until it has been fixed by fsck. This avoids a class of
>   filesystem panics related to corrupted cylinder group maps. The
>   hash is done using crc32c.
>
> ...
>
> Modified: head/sys/libkern/crc32.c
> ==
> --- head/sys/libkern/crc32.cFri Sep 22 12:07:03 2017(r323922)
> +++ head/sys/libkern/crc32.cFri Sep 22 12:45:15 2017(r323923)
> @@ -759,6 +762,7 @@ calculate_crc32c(uint32_t crc32c,
>  const unsigned char *buffer,
>  unsigned int length)
>  {
> +#ifdef _KERNEL
>  #if defined(__amd64__) || defined(__i386__)
> if ((cpu_feature2 & CPUID2_SSE42) != 0) {
> return (sse42_crc32c(crc32c, buffer, length));
> @@ -776,6 +780,7 @@ calculate_crc32c(uint32_t crc32c,
> return (armv8_crc32c(crc32c, buffer, length));
> } else
>  #endif
> +#endif /* _KERNEL */
> if (length < 4) {
> return (singletable_crc32c(crc32c, buffer, length));
> } else {

Userspace x86 ought to be able to use the SSE-enhanced implementation,
too.  It will just need a cpuid check, and can skip the FPU context
manipulation.

Best,
Conrad
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323926 - releng/10.4/release/tools

2017-09-22 Thread Glen Barber
Author: gjb
Date: Fri Sep 22 14:56:43 2017
New Revision: 323926
URL: https://svnweb.freebsd.org/changeset/base/323926

Log:
  MFS10 r323925:
   MFC r323924:
   Revert r323812 from release/tools/arm.subr, which has broken the
   build on arm/armv6 images.
  
  Pointyhat:gjb (myself)
  Approved by:  re (marius)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/10.4/release/tools/arm.subr
Directory Properties:
  releng/10.4/   (props changed)

Modified: releng/10.4/release/tools/arm.subr
==
--- releng/10.4/release/tools/arm.subr  Fri Sep 22 14:40:04 2017
(r323925)
+++ releng/10.4/release/tools/arm.subr  Fri Sep 22 14:56:43 2017
(r323926)
@@ -99,16 +99,6 @@ arm_install_base() {
TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
DESTDIR=${DESTDIR} KERNCONF=${KERNEL} \
installworld installkernel distribution
-
-   # Bootstrap etcupdate(8) and mergemaster(8) databases.
-   mkdir -p ${DESTDIR}/var/db/etcupdate
-   etcupdate extract -B \
-   -M "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -s ${WORLDDIR} -d ${DESTDIR}/var/db/etcupdate
-   sh ${WORLDDIR}/release/scripts/mm-mtree.sh -m ${WORLDDIR} \
-   -F "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -D ${DESTDIR}
-
chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos
 
arm_create_user
___
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: r323925 - in stable: 10/release/tools 11/release/tools

2017-09-22 Thread Glen Barber
Author: gjb
Date: Fri Sep 22 14:40:04 2017
New Revision: 323925
URL: https://svnweb.freebsd.org/changeset/base/323925

Log:
  MFC r323924:
   Revert r323812 from release/tools/arm.subr, which has broken the
   build on arm/armv6 images.
  
  Pointyhat:gjb (myself)
  MFC note: releng/10.4 has broken because of this
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/tools/arm.subr
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/release/tools/arm.subr
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/release/tools/arm.subr
==
--- stable/11/release/tools/arm.subrFri Sep 22 14:34:27 2017
(r323924)
+++ stable/11/release/tools/arm.subrFri Sep 22 14:40:04 2017
(r323925)
@@ -99,16 +99,6 @@ arm_install_base() {
TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
DESTDIR=${DESTDIR} KERNCONF=${KERNEL} \
installworld installkernel distribution
-
-   # Bootstrap etcupdate(8) and mergemaster(8) databases.
-   mkdir -p ${DESTDIR}/var/db/etcupdate
-   etcupdate extract -B \
-   -M "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -s ${WORLDDIR} -d ${DESTDIR}/var/db/etcupdate
-   sh ${WORLDDIR}/release/scripts/mm-mtree.sh -m ${WORLDDIR} \
-   -F "TARGET=${EMBEDDED_TARGET} 
TARGET_ARCH=${EMBEDDED_TARGET_ARCH}" \
-   -D ${DESTDIR}
-
chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos
 
arm_create_user
___
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: r323930 - stable/11/usr.sbin/i2c

2017-09-22 Thread Ian Lepore
Author: ian
Date: Fri Sep 22 15:47:35 2017
New Revision: 323930
URL: https://svnweb.freebsd.org/changeset/base/323930

Log:
  MFC r323465:
  
  Make i2c -s (device scan) work on hardware that supports only full xfers.
  
  The existing scan code is based on sending an i2c START condition and if
  there is no error it assumes there is a device at that i2c address.  Some
  i2c controllers don't support sending individual start/stop signals on the
  bus, they can only perform complete data transfers with start/stop handled
  in the silicon.
  
  This adds a fallback mechanism that attempts to read a single byte from each
  i2c address.  It's less reliable than looking for an an ACK repsonse to a
  start, because some devices will NAK an attempt to read that isn't preceeded
  by a write of a register address.  Writing to devices to probe them is too
  dangerous to even consider.  The user is told that a less-reliable scan is
  being done, so even if the read-scan comes up empty too, it's still a vast
  improvement over the old situation where it would just claim there were no
  devices on the bus even though the devices were there and working fine.
  
  If the i2c controller responds with a proper ENODEV (device doesn't support
  operation) or an almost-proper EOPNOTSUPP, the START/STOP scan is switched
  to a read-scan right away.  Most controllers respond with ENXIO or EIO if
  they don't support START/STOP, so no quick-out is available.  For those,
  if a scan of all 127 addresses and come up empty, the scan is re-done using
  the read method.
  
  Reported by:  Maxim Filimonov 

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

Modified: stable/11/usr.sbin/i2c/i2c.c
==
--- stable/11/usr.sbin/i2c/i2c.cFri Sep 22 15:40:56 2017
(r323929)
+++ stable/11/usr.sbin/i2c/i2c.cFri Sep 22 15:47:35 2017
(r323930)
@@ -121,9 +121,12 @@ skip_get_tokens(char *skip_addr, int *sk_addr, int max
 static int
 scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr)
 {
+   struct iic_msg rdmsg;
+   struct iic_rdwr_data rdwrdata;
struct skip_range addr_range = { 0, 0 };
int *tokens, fd, error, i, index, j;
-   int len = 0, do_skip = 0, no_range = 1;
+   int len = 0, do_skip = 0, no_range = 1, num_found = 0, use_read_xfer = 
0;
+   uint8_t rdbyte;
 
fd = open(dev, O_RDWR);
if (fd == -1) {
@@ -157,6 +160,14 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char 
}
 
printf("Scanning I2C devices on %s: ", dev);
+
+start_over:
+   if (use_read_xfer) {
+   fprintf(stderr, 
+   "Hardware may not support START/STOP scanning; "
+   "trying less-reliable read method.\n");
+   }
+
for (i = 1; i < 127; i++) {
 
if (skip && ( addr_range.start < addr_range.end)) {
@@ -180,17 +191,46 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char 
cmd.last = 1;
cmd.count = 0;
error = ioctl(fd, I2CRSTCARD, );
-   if (error)
+   if (error) {
+   fprintf(stderr, "Controller reset failed\n");
goto out;
-
-   cmd.slave = i << 1;
-   cmd.last = 1;
-   error = ioctl(fd, I2CSTART, );
-   if (!error)
-   printf("%x ", i);
-   cmd.slave = i << 1;
-   cmd.last = 1;
-   error = ioctl(fd, I2CSTOP, );
+   }
+   if (use_read_xfer) {
+   rdmsg.buf = 
+   rdmsg.len = 1;
+   rdmsg.flags = IIC_M_RD;
+   rdmsg.slave = i << 1;
+   rdwrdata.msgs = 
+   rdwrdata.nmsgs = 1;
+   error = ioctl(fd, I2CRDWR, );
+   } else {
+   cmd.slave = i << 1;
+   cmd.last = 1;
+   error = ioctl(fd, I2CSTART, );
+   if (errno == ENODEV || errno == EOPNOTSUPP) {
+   /* If START not supported try reading. */
+   use_read_xfer = 1;
+   goto start_over;
+   }
+   cmd.slave = i << 1;
+   cmd.last = 1;
+   ioctl(fd, I2CSTOP, );
+   }
+   if (error == 0) {
+   ++num_found;
+   printf("%02x ", i);
+   }
+   }
+   /*
+* If we found nothing, maybe START is not supported and returns a
+* generic error code such as EIO or ENXIO, so try again using reads.
+*/
+   if (num_found == 0) {
+   if (!use_read_xfer) {
+   

svn commit: r323932 - head/sys/ufs/ffs

2017-09-22 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 22 16:42:41 2017
New Revision: 323932
URL: https://svnweb.freebsd.org/changeset/base/323932

Log:
  Fix 32bit build.
  
  Reported by:  emaste
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/ufs/ffs/ffs_alloc.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cFri Sep 22 15:53:22 2017
(r323931)
+++ head/sys/ufs/ffs/ffs_alloc.cFri Sep 22 16:42:41 2017
(r323932)
@@ -2615,8 +2615,8 @@ ffs_getcg(fs, devvp, cg, bpp, cgpp)
(bp->b_flags & B_CKHASH) != 0 &&
cgp->cg_ckhash != bp->b_ckhash) ||
!cg_chkmagic(cgp) || cgp->cg_cgx != cg) {
-   printf("checksum failed: cg %u, cgp: 0x%x != bp: 0x%lx\n",
-   cg, cgp->cg_ckhash, bp->b_ckhash);
+   printf("checksum failed: cg %u, cgp: 0x%x != bp: 0x%jx\n",
+   cg, cgp->cg_ckhash, (uintmax_t)bp->b_ckhash);
bp->b_flags &= ~B_CKHASH;
bp->b_flags |= B_INVAL | B_NOCACHE;
brelse(bp);
___
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: r323928 - releng/10.4/sys/conf

2017-09-22 Thread Marius Strobl
Author: marius
Date: Fri Sep 22 15:27:50 2017
New Revision: 323928
URL: https://svnweb.freebsd.org/changeset/base/323928

Log:
  Update releng/10.4 to RC2 again so the revision of sys/conf/newvers.sh
  will reflect the (hopefully) final 10.4-RC2 builds.
  
  Approved by:  re (implicit)

Modified:
  releng/10.4/sys/conf/newvers.sh

Modified: releng/10.4/sys/conf/newvers.sh
==
--- releng/10.4/sys/conf/newvers.sh Fri Sep 22 15:27:02 2017
(r323927)
+++ releng/10.4/sys/conf/newvers.sh Fri Sep 22 15:27:50 2017
(r323928)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.4"
-BRANCH="RC1"
+BRANCH="RC2"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 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: r323929 - in stable/11/sys/modules/i2c: ds1307 ds13rtc ds3231 isl12xx nxprtc s35390a

2017-09-22 Thread Ian Lepore
Author: ian
Date: Fri Sep 22 15:40:56 2017
New Revision: 323929
URL: https://svnweb.freebsd.org/changeset/base/323929

Log:
  MFC r323642:
  
  Add a missing header file to SRCS to fix out-of-kernel builds.
  
  PR:   222354
  Submitted by: eugen@
  Pointy hat:   ian@

Modified:
  stable/11/sys/modules/i2c/ds1307/Makefile
  stable/11/sys/modules/i2c/ds13rtc/Makefile
  stable/11/sys/modules/i2c/ds3231/Makefile
  stable/11/sys/modules/i2c/isl12xx/Makefile
  stable/11/sys/modules/i2c/nxprtc/Makefile
  stable/11/sys/modules/i2c/s35390a/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/modules/i2c/ds1307/Makefile
==
--- stable/11/sys/modules/i2c/ds1307/Makefile   Fri Sep 22 15:27:50 2017
(r323928)
+++ stable/11/sys/modules/i2c/ds1307/Makefile   Fri Sep 22 15:40:56 2017
(r323929)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = ds1307
-SRCS   = ds1307.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = ds1307.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: stable/11/sys/modules/i2c/ds13rtc/Makefile
==
--- stable/11/sys/modules/i2c/ds13rtc/Makefile  Fri Sep 22 15:27:50 2017
(r323928)
+++ stable/11/sys/modules/i2c/ds13rtc/Makefile  Fri Sep 22 15:40:56 2017
(r323929)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = ds13rtc
-SRCS   = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h 
+SRCS   = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: stable/11/sys/modules/i2c/ds3231/Makefile
==
--- stable/11/sys/modules/i2c/ds3231/Makefile   Fri Sep 22 15:27:50 2017
(r323928)
+++ stable/11/sys/modules/i2c/ds3231/Makefile   Fri Sep 22 15:40:56 2017
(r323929)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = ds3231
-SRCS   = ds3231.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = ds3231.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: stable/11/sys/modules/i2c/isl12xx/Makefile
==
--- stable/11/sys/modules/i2c/isl12xx/Makefile  Fri Sep 22 15:27:50 2017
(r323928)
+++ stable/11/sys/modules/i2c/isl12xx/Makefile  Fri Sep 22 15:40:56 2017
(r323929)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = isl12xx
-SRCS   = isl12xx.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = isl12xx.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: stable/11/sys/modules/i2c/nxprtc/Makefile
==
--- stable/11/sys/modules/i2c/nxprtc/Makefile   Fri Sep 22 15:27:50 2017
(r323928)
+++ stable/11/sys/modules/i2c/nxprtc/Makefile   Fri Sep 22 15:40:56 2017
(r323929)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = nxprtc
-SRCS   = nxprtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = nxprtc.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .include 

Modified: stable/11/sys/modules/i2c/s35390a/Makefile
==
--- stable/11/sys/modules/i2c/s35390a/Makefile  Fri Sep 22 15:27:50 2017
(r323928)
+++ stable/11/sys/modules/i2c/s35390a/Makefile  Fri Sep 22 15:40:56 2017
(r323929)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/iicbus
 KMOD   = s35390a
-SRCS   = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h
+SRCS   = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h 
ofw_bus_if.h opt_platform.h
 
 .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: r323927 - releng/10.4/sys/conf

2017-09-22 Thread Marius Strobl
Author: marius
Date: Fri Sep 22 15:27:02 2017
New Revision: 323927
URL: https://svnweb.freebsd.org/changeset/base/323927

Log:
  Revert releng/10.4 to RC1 again.
  
  Approved by:  re (implicit)

Modified:
  releng/10.4/sys/conf/newvers.sh

Modified: releng/10.4/sys/conf/newvers.sh
==
--- releng/10.4/sys/conf/newvers.sh Fri Sep 22 14:56:43 2017
(r323926)
+++ releng/10.4/sys/conf/newvers.sh Fri Sep 22 15:27:02 2017
(r323927)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.4"
-BRANCH="RC2"
+BRANCH="RC1"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 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: r323931 - in stable/11/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/ti dev/glxiic dev/iicbus modules/i2c modules/i2c/icee

2017-09-22 Thread Ian Lepore
Author: ian
Date: Fri Sep 22 15:53:22 2017
New Revision: 323931
URL: https://svnweb.freebsd.org/changeset/base/323931

Log:
  MFC r323474, r323553, r323691
  
  r323474:
  Add a default implementation that returns ENODEV for start, repeat_start,
  stop, read, and write methods.  Some controllers don't implement these
  individual operations and have only a transfer method.  In that case, we
  should return an indication that the device is present but doesn't support
  the method, as opposed to the kobj default error ENXIO which makes it
  look like the whole device is missing.  Userland tools such as i2c(8) can
  use the differing return values to switch between the two different i2c
  IO mechanisms.
  
  r323553:
  Defer attaching and probing iicbus and its children until interrupts are
  available, in i2c controller drivers that require interrupts for transfers.
  
  This is the result of auditing all 22 existing drivers that attach iicbus.
  These drivers were the only ones remaining that require interrupts and were
  not using config_intrhook to defer attachment.  That has led, over the
  years, to various i2c slave device drivers needing to use config_intrhook
  themselves rather than performing bus transactions in their probe() and
  attach() methods, just in case they were attached too early.
  
  r323691:
  Give icee(4) a detach() method so it can be used as a module.  Add a
  module makefile for it.

Added:
  stable/11/sys/modules/i2c/icee/
 - copied from r323691, head/sys/modules/i2c/icee/
Modified:
  stable/11/sys/arm/at91/at91_twi.c
  stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  stable/11/sys/arm/freescale/imx/imx_i2c.c
  stable/11/sys/arm/ti/ti_i2c.c
  stable/11/sys/dev/glxiic/glxiic.c
  stable/11/sys/dev/iicbus/icee.c
  stable/11/sys/dev/iicbus/iicbus_if.m
  stable/11/sys/modules/i2c/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/at91/at91_twi.c
==
--- stable/11/sys/arm/at91/at91_twi.c   Fri Sep 22 15:47:35 2017
(r323930)
+++ stable/11/sys/arm/at91/at91_twi.c   Fri Sep 22 15:53:22 2017
(r323931)
@@ -161,8 +161,8 @@ at91_twi_attach(device_t dev)
 
if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL)
device_printf(dev, "could not allocate iicbus instance\n");
-   /* probe and attach the iicbus */
-   bus_generic_attach(dev);
+   /* Probe and attach the iicbus when interrupts are available. */
+   config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
 out:
if (err)
at91_twi_deactivate(dev);

Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.cFri Sep 22 15:47:35 
2017(r323930)
+++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.cFri Sep 22 15:53:22 
2017(r323931)
@@ -308,7 +308,10 @@ bcm_bsc_attach(device_t dev)
return (ENXIO);
}
 
-   return (bus_generic_attach(dev));
+   /* Probe and attach the iicbus when interrupts are available. */
+   config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
+
+   return (0);
 }
 
 static int

Modified: stable/11/sys/arm/freescale/imx/imx_i2c.c
==
--- stable/11/sys/arm/freescale/imx/imx_i2c.c   Fri Sep 22 15:47:35 2017
(r323930)
+++ stable/11/sys/arm/freescale/imx/imx_i2c.c   Fri Sep 22 15:53:22 2017
(r323931)
@@ -444,7 +444,8 @@ no_recovery:
 
/* We don't do a hardware reset here because iicbus_attach() does it. */
 
-   bus_generic_attach(dev);
+   /* Probe and attach the iicbus when interrupts are available. */
+   config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
return (0);
 }
 

Modified: stable/11/sys/arm/ti/ti_i2c.c
==
--- stable/11/sys/arm/ti/ti_i2c.c   Fri Sep 22 15:47:35 2017
(r323930)
+++ stable/11/sys/arm/ti/ti_i2c.c   Fri Sep 22 15:53:22 2017
(r323931)
@@ -37,11 +37,6 @@
  * incorporate that sometime in the future.  The idea being that for 
transaction
  * larger than a certain size the DMA engine is used, for anything less the
  * normal interrupt/fifo driven option is used.
- *
- *
- * WARNING: This driver uses mtx_sleep and interrupts to perform transactions,
- * which means you can't do a transaction during startup before the interrupts
- * have been enabled.  Hint - the freebsd function config_intrhook_establish().
  */
 
 #include 
@@ -909,8 +904,8 @@ ti_i2c_attach(device_t dev)
goto out;
}
 
-   /* Probe and attach the iicbus */
-   bus_generic_attach(dev);
+   /* Probe and attach the iicbus when interrupts are available. */
+   

svn commit: r323933 - head/sys/arm/include

2017-09-22 Thread John Baldwin
Author: jhb
Date: Fri Sep 22 17:57:38 2017
New Revision: 323933
URL: https://svnweb.freebsd.org/changeset/base/323933

Log:
  Correct HWCAP_VFP3* values to match Linux.
  
  Reviewed by:  andrew, ian
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D12388

Modified:
  head/sys/arm/include/elf.h

Modified: head/sys/arm/include/elf.h
==
--- head/sys/arm/include/elf.h  Fri Sep 22 16:42:41 2017(r323932)
+++ head/sys/arm/include/elf.h  Fri Sep 22 17:57:38 2017(r323933)
@@ -117,8 +117,8 @@ __ElfType(Auxinfo);
 
 /* Flags passed in AT_HWCAP. */
 #defineHWCAP_VFP   0x0040
-#defineHWCAP_VFPv3 0x0200
-#defineHWCAP_VFPv3D16  0x0400
+#defineHWCAP_VFPv3 0x2000
+#defineHWCAP_VFPv3D16  0x4000
 #defineHWCAP_VFPD320x0008
 
 #endif /* !_MACHINE_ELF_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"


svn commit: r323934 - in head/sys/arm: arm include

2017-09-22 Thread John Baldwin
Author: jhb
Date: Fri Sep 22 17:58:57 2017
New Revision: 323934
URL: https://svnweb.freebsd.org/changeset/base/323934

Log:
  Detect NEON and set HWCAP_NEON if present.
  
  Reviewed by:  andrew, ian
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D12389

Modified:
  head/sys/arm/arm/vfp.c
  head/sys/arm/include/elf.h

Modified: head/sys/arm/arm/vfp.c
==
--- head/sys/arm/arm/vfp.c  Fri Sep 22 17:57:38 2017(r323933)
+++ head/sys/arm/arm/vfp.c  Fri Sep 22 17:58:57 2017(r323934)
@@ -144,6 +144,11 @@ vfp_init(void)
initial_fpscr;
}
}
+
+   if ((tmp & VMVFR1_LS_MASK) >> VMVFR1_LS_OFF == 1 &&
+   (tmp & VMVFR1_I_MASK) >> VMVFR1_I_OFF == 1 &&
+   (tmp & VMVFR1_SP_MASK) >> VMVFR1_SP_OFF == 1)
+   elf_hwcap |= HWCAP_NEON;
}
 
/* initialize the coprocess 10 and 11 calls

Modified: head/sys/arm/include/elf.h
==
--- head/sys/arm/include/elf.h  Fri Sep 22 17:57:38 2017(r323933)
+++ head/sys/arm/include/elf.h  Fri Sep 22 17:58:57 2017(r323934)
@@ -117,6 +117,7 @@ __ElfType(Auxinfo);
 
 /* Flags passed in AT_HWCAP. */
 #defineHWCAP_VFP   0x0040
+#defineHWCAP_NEON  0x1000
 #defineHWCAP_VFPv3 0x2000
 #defineHWCAP_VFPv3D16  0x4000
 #defineHWCAP_VFPD320x0008
___
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"