svn commit: r300480 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 23 07:06:53 2016
New Revision: 300480
URL: https://svnweb.freebsd.org/changeset/base/300480

Log:
  hyperv: Move Hypercall setup to an early place.
  
  It does not belong to the vmbus.
  
  While I'm here rework the Hypercall setup, e.g. use busdma(9)
  and avoid bit fields.
  
  Discussed with:   Jun Su 
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6445

Added:
  head/sys/dev/hyperv/vmbus/hyperv_reg.h   (contents, props changed)
Modified:
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_hv.c
==
--- head/sys/dev/hyperv/vmbus/hv_hv.c   Mon May 23 06:52:42 2016
(r300479)
+++ head/sys/dev/hyperv/vmbus/hv_hv.c   Mon May 23 07:06:53 2016
(r300480)
@@ -43,8 +43,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-
-#include "hv_vmbus_priv.h"
+#include 
+#include 
+#include 
 
 #define HV_NANOSECONDS_PER_SEC 10L
 
@@ -79,6 +80,13 @@ __FBSDID("$FreeBSD$");
 (((uint64_t)__FreeBSD_version) << 16) |\
 ((uint64_t)((id) & 0x00)))
 
+struct hypercall_ctx {
+   void*hc_addr;
+   struct hyperv_dma   hc_dma;
+};
+
+static struct hypercall_ctxhypercall_context;
+
 static u_int hv_get_timecount(struct timecounter *tc);
 
 u_int  hyperv_features;
@@ -92,7 +100,6 @@ static u_int hyperv_features3;
  */
 hv_vmbus_context hv_vmbus_g_context = {
.syn_ic_initialized = FALSE,
-   .hypercall_page = NULL,
 };
 
 static struct timecounter hv_timecounter = {
@@ -116,7 +123,7 @@ hv_vmbus_do_hypercall(uint64_t control, 
uint64_t hv_status = 0;
uint64_t input_address = (input) ? hv_get_phys_addr(input) : 0;
uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0;
-   volatile void* hypercall_page = hv_vmbus_g_context.hypercall_page;
+   volatile void *hypercall_page = hypercall_context.hc_addr;
 
__asm__ __volatile__ ("mov %0, %%r8" : : "r" (output_address): "r8");
__asm__ __volatile__ ("call *%3" : "=a"(hv_status):
@@ -134,7 +141,7 @@ hv_vmbus_do_hypercall(uint64_t control, 
uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0;
uint32_t output_address_high = output_address >> 32;
uint32_t output_address_low = output_address & 0x;
-   volatile void* hypercall_page = hv_vmbus_g_context.hypercall_page;
+   volatile void *hypercall_page = hypercall_context.hc_addr;
 
__asm__ __volatile__ ("call *%8" : "=d"(hv_status_high),
"=a"(hv_status_low) : "d" (control_high),
@@ -147,84 +154,6 @@ hv_vmbus_do_hypercall(uint64_t control, 
 }
 
 /**
- *  @brief Main initialization routine.
- *
- *  This routine must be called
- *  before any other routines in here are called
- */
-int
-hv_vmbus_init(void) 
-{
-   hv_vmbus_x64_msr_hypercall_contents hypercall_msr;
-   void*   virt_addr = NULL;
-
-   memset(
-   hv_vmbus_g_context.syn_ic_event_page,
-   0,
-   sizeof(hv_vmbus_handle) * MAXCPU);
-
-   memset(
-   hv_vmbus_g_context.syn_ic_msg_page,
-   0,
-   sizeof(hv_vmbus_handle) * MAXCPU);
-
-   if (vm_guest != VM_GUEST_HV)
-   goto cleanup;
-
-   /*
-* See if the hypercall page is already set
-*/
-   hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL);
-   virt_addr = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO);
-
-   hypercall_msr.u.enable = 1;
-   hypercall_msr.u.guest_physical_address =
-   (hv_get_phys_addr(virt_addr) >> PAGE_SHIFT);
-   wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t);
-
-   /*
-* Confirm that hypercall page did get set up
-*/
-   hypercall_msr.as_uint64_t = 0;
-   hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL);
-
-   if (!hypercall_msr.u.enable)
-   goto cleanup;
-
-   hv_vmbus_g_context.hypercall_page = virt_addr;
-
-   return (0);
-
-   cleanup:
-   if (virt_addr != NULL) {
-   if (hypercall_msr.u.enable) {
-   hypercall_msr.as_uint64_t = 0;
-   wrmsr(HV_X64_MSR_HYPERCALL,
-   hypercall_msr.as_uint64_t);
-   }
-
-   free(virt_addr, M_DEVBUF);
-   }
-   return (ENOTSUP);
-}
-
-/**
- * @brief Cleanup routine, called normally during driver unloading or exiting
- */
-void
-hv_vmbus_cleanup(void) 
-{
-   if (hv_vmbus_g_context.hypercall_page != NULL) {
-   hv_vmbus_x64_msr_hypercall_contents hypercall_msr;
-
-   hypercall_msr.as_uint64_t = 0;
-   wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t);
-   free(h

svn commit: r300481 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 23 07:14:04 2016
New Revision: 300481
URL: https://svnweb.freebsd.org/changeset/base/300481

Log:
  hyperv/vmbus: Declare Synic message and event w/ proper types
  
  Avoid ugly casts.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6446

Modified:
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Mon May 23 07:06:53 2016
(r300480)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Mon May 23 07:14:04 2016
(r300481)
@@ -333,8 +333,8 @@ vmbus_event_proc(struct vmbus_softc *sc,
 {
hv_vmbus_synic_event_flags *event;
 
-   event = ((hv_vmbus_synic_event_flags *)
-   hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT;
+   event = hv_vmbus_g_context.syn_ic_event_page[cpu] +
+   HV_VMBUS_MESSAGE_SINT;
 
/*
 * On Host with Win8 or above, the event page can be checked directly
@@ -349,8 +349,8 @@ vmbus_event_proc_compat(struct vmbus_sof
 {
hv_vmbus_synic_event_flags *event;
 
-   event = ((hv_vmbus_synic_event_flags *)
-   hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT;
+   event = hv_vmbus_g_context.syn_ic_event_page[cpu] +
+   HV_VMBUS_MESSAGE_SINT;
 
if (atomic_testandclear_int(&event->flags32[0], 0)) {
vmbus_event_flags_proc(

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon May 23 07:06:53 
2016(r300480)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon May 23 07:14:04 
2016(r300481)
@@ -79,8 +79,9 @@ vmbus_msg_task(void *arg __unused, int p
 {
hv_vmbus_message *msg;
 
-   msg = ((hv_vmbus_message *)hv_vmbus_g_context.syn_ic_msg_page[curcpu]) +
+   msg = hv_vmbus_g_context.syn_ic_msg_page[curcpu] +
HV_VMBUS_MESSAGE_SINT;
+
for (;;) {
const hv_vmbus_channel_msg_table_entry *entry;
hv_vmbus_channel_msg_header *hdr;
@@ -134,9 +135,8 @@ static inline int
 hv_vmbus_isr(struct trapframe *frame)
 {
struct vmbus_softc *sc = vmbus_get_softc();
+   hv_vmbus_message *msg, *msg_base;
int cpu = curcpu;
-   hv_vmbus_message *msg;
-   void *page_addr;
 
/*
 * The Windows team has advised that we check for events
@@ -146,8 +146,8 @@ hv_vmbus_isr(struct trapframe *frame)
sc->vmbus_event_proc(sc, cpu);
 
/* Check if there are actual msgs to be process */
-   page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
-   msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_TIMER_SINT;
+   msg_base = hv_vmbus_g_context.syn_ic_msg_page[cpu];
+   msg = msg_base + HV_VMBUS_TIMER_SINT;
 
/* we call eventtimer process the message */
if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) {
@@ -178,7 +178,7 @@ hv_vmbus_isr(struct trapframe *frame)
}
}
 
-   msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_MESSAGE_SINT;
+   msg = msg_base + HV_VMBUS_MESSAGE_SINT;
if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu],
&hv_vmbus_g_context.hv_msg_task[cpu]);

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon May 23 07:06:53 2016
(r300480)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon May 23 07:14:04 2016
(r300481)
@@ -197,11 +197,14 @@ enum {
 
 #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t)
 
+struct vmbus_message;
+union vmbus_event_flags;
+
 typedef struct {
hv_bool_uint8_t syn_ic_initialized;
 
-   hv_vmbus_handle syn_ic_msg_page[MAXCPU];
-   hv_vmbus_handle syn_ic_event_page[MAXCPU];
+   struct vmbus_message*syn_ic_msg_page[MAXCPU];
+   union vmbus_event_flags *syn_ic_event_page[MAXCPU];
/*
 * For FreeBSD cpuid to Hyper-V vcpuid mapping.
 */
@@ -303,7 +306,7 @@ typedef struct {
 /*
  *  Define synthetic interrupt controller message format
  */
-typedef struct {
+typedef struct vmbus_message {
hv_vmbus_msg_header header;
union {
uint64_tpayload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
@@ -578,7 +581,7 @@ typedef struct {
 /*
  * Define the synthetic interrupt controller event flags format
  */
-typedef union {
+typedef union vmbus_event_flags {
uint8_t flags8[HV_EVENT_FLAGS_BYTE_COUNT];
uint32_tflags32[HV

svn commit: r300486 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 23 07:23:19 2016
New Revision: 300486
URL: https://svnweb.freebsd.org/changeset/base/300486

Log:
  hyperv/vmbus: Get rid of vmbus_devp
  
  While I'm here, nuke useless print in vmbus_attach().
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6447

Modified:
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon May 23 07:21:16 
2016(r300485)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon May 23 07:23:19 
2016(r300486)
@@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$");
 
 struct vmbus_softc *vmbus_sc;
 
-static device_t vmbus_devp;
 static int vmbus_inited;
 static hv_setup_args setup_args; /* only CPU 0 supported at this time */
 
@@ -324,7 +323,7 @@ hv_vmbus_child_device_register(struct hv
printf("VMBUS: Class ID: %s\n", name);
}
 
-   child = device_add_child(vmbus_devp, NULL, -1);
+   child = device_add_child(vmbus_get_device(), NULL, -1);
child_dev->device = child;
device_set_ivars(child, child_dev);
 
@@ -340,7 +339,7 @@ hv_vmbus_child_device_unregister(struct 
 * device_add_child()
 */
mtx_lock(&Giant);
-   ret = device_delete_child(vmbus_devp, child_dev->device);
+   ret = device_delete_child(vmbus_get_device(), child_dev->device);
mtx_unlock(&Giant);
return(ret);
 }
@@ -471,8 +470,8 @@ vmbus_bus_init(void)
hv_vmbus_request_channel_offers();
 
vmbus_scan();
-   bus_generic_attach(vmbus_devp);
-   device_printf(vmbus_devp, "device scan, probe and attach done\n");
+   bus_generic_attach(sc->vmbus_dev);
+   device_printf(sc->vmbus_dev, "device scan, probe and attach done\n");
 
return (ret);
 
@@ -508,11 +507,8 @@ vmbus_event_proc_dummy(struct vmbus_soft
 static int
 vmbus_attach(device_t dev)
 {
-   if(bootverbose)
-   device_printf(dev, "VMBUS: attach dev: %p\n", dev);
-
-   vmbus_devp = dev;
vmbus_sc = device_get_softc(dev);
+   vmbus_sc->vmbus_dev = dev;
 
/*
 * Event processing logic will be configured:

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_var.h   Mon May 23 07:21:16 2016
(r300485)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h   Mon May 23 07:23:19 2016
(r300486)
@@ -38,6 +38,7 @@ struct vmbus_pcpu_data {
 struct vmbus_softc {
void(*vmbus_event_proc)(struct vmbus_softc *, int);
struct vmbus_pcpu_data  vmbus_pcpu[MAXCPU];
+   device_tvmbus_dev;
 };
 
 extern struct vmbus_softc  *vmbus_sc;
@@ -48,6 +49,12 @@ vmbus_get_softc(void)
return vmbus_sc;
 }
 
+static __inline device_t
+vmbus_get_device(void)
+{
+   return vmbus_sc->vmbus_dev;
+}
+
 #define VMBUS_SC_PCPU_GET(sc, field, cpu)  (sc)->vmbus_pcpu[(cpu)].field
 #define VMBUS_SC_PCPU_PTR(sc, field, cpu)  &(sc)->vmbus_pcpu[(cpu)].field
 #define VMBUS_PCPU_GET(field, cpu) \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300487 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 23 07:32:34 2016
New Revision: 300487
URL: https://svnweb.freebsd.org/changeset/base/300487

Log:
  hyperv/vmbus: Move IDT vector to vmbus_softc
  
  Prepare to get rid of the hv_setup_arg.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6449

Modified:
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_hv.c
==
--- head/sys/dev/hyperv/vmbus/hv_hv.c   Mon May 23 07:23:19 2016
(r300486)
+++ head/sys/dev/hyperv/vmbus/hv_hv.c   Mon May 23 07:32:34 2016
(r300487)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define HV_NANOSECONDS_PER_SEC 10L
 
@@ -220,8 +221,8 @@ hv_vmbus_signal_event(void *con_id)
  */
 void
 hv_vmbus_synic_init(void *arg)
-
 {
+   struct vmbus_softc *sc = vmbus_get_softc();
int cpu;
uint64_thv_vcpu_index;
hv_vmbus_synic_simp simp;
@@ -266,7 +267,7 @@ hv_vmbus_synic_init(void *arg)
 
/*HV_SHARED_SINT_IDT_VECTOR + 0x20; */
shared_sint.as_uint64_t = 0;
-   shared_sint.u.vector = setup_args->vector;
+   shared_sint.u.vector = sc->vmbus_idtvec;
shared_sint.u.masked = FALSE;
shared_sint.u.auto_eoi = TRUE;
 

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon May 23 07:23:19 
2016(r300486)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon May 23 07:32:34 
2016(r300487)
@@ -385,25 +385,18 @@ vmbus_bus_init(void)
sc = vmbus_get_softc();
 
/*
-* Find a free IDT slot for vmbus callback.
+* Find a free IDT vector for vmbus messages/events.
 */
-   hv_vmbus_g_context.hv_cb_vector = 
lapic_ipi_alloc(IDTVEC(hv_vmbus_callback));
-   if (hv_vmbus_g_context.hv_cb_vector < 0) {
-   if(bootverbose)
-   printf("Error VMBUS: Cannot find free IDT slot for "
-   "vmbus callback!\n");
+   sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback));
+   if (sc->vmbus_idtvec < 0) {
+   device_printf(sc->vmbus_dev, "cannot find free IDT vector\n");
ret = ENXIO;
goto cleanup;
}
-
-   if(bootverbose)
-   printf("VMBUS: vmbus callback vector %d\n",
-   hv_vmbus_g_context.hv_cb_vector);
-
-   /*
-* Notify the hypervisor of our vector.
-*/
-   setup_args.vector = hv_vmbus_g_context.hv_cb_vector;
+   if(bootverbose) {
+   device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n",
+   sc->vmbus_idtvec);
+   }
 
CPU_FOREACH(j) {
snprintf(buf, sizeof(buf), "cpu%d:hyperv", j);
@@ -493,7 +486,7 @@ vmbus_bus_init(void)
}
}
 
-   lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector);
+   lapic_ipi_free(sc->vmbus_idtvec);
 
cleanup:
return (ret);
@@ -553,6 +546,7 @@ vmbus_sysinit(void *arg __unused)
 static int
 vmbus_detach(device_t dev)
 {
+   struct vmbus_softc *sc = device_get_softc(dev);
int i;
 
hv_vmbus_release_unattached_channels();
@@ -573,7 +567,7 @@ vmbus_detach(device_t dev)
}
}
 
-   lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector);
+   lapic_ipi_free(sc->vmbus_idtvec);
 
return (0);
 }

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon May 23 07:23:19 2016
(r300486)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon May 23 07:32:34 2016
(r300487)
@@ -216,11 +216,6 @@ typedef struct {
struct taskqueue*hv_event_queue[MAXCPU];
struct taskqueue*hv_msg_tq[MAXCPU];
struct task hv_msg_task[MAXCPU];
-   /*
-* Host use this vector to interrupt guest for vmbus channel
-* event and msg.
-*/
-   int hv_cb_vector;
 } hv_vmbus_context;
 
 /*
@@ -763,7 +758,6 @@ voidhv_et_intr(struct trapframe*);
 void   vmbus_scan(void);
 
 typedef struct {
-   unsigned intvector;
void*page_buffers[2 * MAXCPU];
 } hv_setup_args;
 

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_var.h   Mon May 23 07:23:19 2016
(r300486)
+++ head/s

svn commit: r300489 - head/sys/kern

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 10:31:54 2016
New Revision: 300489
URL: https://svnweb.freebsd.org/changeset/base/300489

Log:
  Use DELAY() instead of _sleep() when SCHEDULER_STOPPED() is set inside
  pause_sbt(). This allows pause() to continue working during a panic()
  which is not invoking KDB. This is useful when debugging graphics
  drivers using the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week

Modified:
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Mon May 23 09:44:06 2016(r300488)
+++ head/sys/kern/kern_synch.c  Mon May 23 10:31:54 2016(r300489)
@@ -327,7 +327,7 @@ pause_sbt(const char *wmesg, sbintime_t 
if (sbt == 0)
sbt = tick_sbt;
 
-   if (cold || kdb_active) {
+   if (cold || kdb_active || SCHEDULER_STOPPED()) {
/*
 * We delay one second at a time to avoid overflowing the
 * system specific DELAY() function(s):
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300348 - head

2016-05-23 Thread Andrew Turner
On Sat, 21 May 2016 01:32:04 + (UTC)
Bryan Drewery  wrote:

> Author: bdrewery
> Date: Sat May 21 01:32:04 2016
> New Revision: 300348
> URL: https://svnweb.freebsd.org/changeset/base/300348
> 
> Log:
>   Move external toolchain support earlier.
>   
>   This is to consolidate external toolchain and
> WITHOUT_CROSS_COMPILER support. 
>   Reviewed by:brooks, bapt
>   Sponsored by:   EMC / Isilon Storage Division
>   Differential Revision:  https://reviews.freebsd.org/D6353
> 

This seems to have broken the arm64 build. My guess is the wrong linker
is being used, but I haven't looked into the issue too far.

Andrew

--
>>> stage 4.2: building libraries
--
===> gnu/lib/libssp/libssp_nonshared (obj,all,install)
===> gnu/lib/libgcc (obj,all,install)
===> lib/libcompiler_rt (obj,all,install)
===> gnu/lib/csu (obj,all,install)
===> lib/csu (obj,all,install)
===> lib/libcompiler_rt (obj,all,install)
===> lib/libc (obj,all,install)
===> lib/libc_nonshared (obj,all,install)
===> lib/csu/aarch64 (obj)
===> lib/csu/aarch64 (all)
===> lib/csu/aarch64 (install)
/scratch/tmp/andrew/obj/arm64.aarch64/scratch/tmp/andrew/head-git/tmp/usr/lib/crti.o:
 file not recognized: File format not recognized
cc: error: linker command failed with exit code 1 (use -v to see invocation)
--- libc.so.7.full ---
*** [libc.so.7.full] Error code 1

make[4]: stopped in /scratch/tmp/andrew/head-git/lib/libc
1 error

make[4]: stopped in /scratch/tmp/andrew/head-git/lib/libc
--- lib/libc__L ---
*** [lib/libc__L] Error code 2

make[3]: stopped in /scratch/tmp/andrew/head-git
1 error

make[3]: stopped in /scratch/tmp/andrew/head-git
--- libraries ---
*** [libraries] Error code 2

make[2]: stopped in /scratch/tmp/andrew/head-git
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300348 - head

2016-05-23 Thread Andrew Turner
On Mon, 23 May 2016 11:34:00 +0100
Andrew Turner  wrote:

> On Sat, 21 May 2016 01:32:04 + (UTC)
> Bryan Drewery  wrote:
> 
> > Author: bdrewery
> > Date: Sat May 21 01:32:04 2016
> > New Revision: 300348
> > URL: https://svnweb.freebsd.org/changeset/base/300348
> > 
> > Log:
> >   Move external toolchain support earlier.
> >   
> >   This is to consolidate external toolchain and
> > WITHOUT_CROSS_COMPILER support. 
> >   Reviewed by:  brooks, bapt
> >   Sponsored by: EMC / Isilon Storage Division
> >   Differential Revision:https://reviews.freebsd.org/D6353
> >   
> 
> This seems to have broken the arm64 build. My guess is the wrong
> linker is being used, but I haven't looked into the issue too far.

The issue is you moved a block that depends on BROKEN_OPTIONS being
defined to before the point we include share/mk/src.opts.mk, the place
it is defined.

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


svn commit: r300490 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 11:41:35 2016
New Revision: 300490
URL: https://svnweb.freebsd.org/changeset/base/300490

Log:
  Add support for atomic_long_inc_not_zero() to the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon May 23 
10:31:54 2016(r300489)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon May 23 
11:41:35 2016(r300490)
@@ -46,7 +46,7 @@
 #defineBITS_TO_LONGS(n)howmany((n), BITS_PER_LONG)
 #defineBIT_MASK(nr)(1UL << ((nr) & (BITS_PER_LONG - 1)))
 #define BIT_WORD(nr)   ((nr) / BITS_PER_LONG)
-#defineGENMASK(lo, hi) (((2UL << ((hi) - (lo))) - 1UL) << (lo))
+#defineGENMASK(h, l)   (((~0UL) >> (BITS_PER_LONG - (h) - 1)) 
& ((~0UL) << (l)))
 #define BITS_PER_BYTE   8
 
 static inline int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300490 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky

On 05/23/16 13:41, Hans Petter Selasky wrote:

Author: hselasky
Date: Mon May 23 11:41:35 2016
New Revision: 300490
URL: https://svnweb.freebsd.org/changeset/base/300490

Log:
  Add support for atomic_long_inc_not_zero() to the LinuxKPI.

  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h



Correct commit message:

Correct GENMASK() macro in the LinuxKPI.

Else the same.

--HPS

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


svn commit: r300491 - head/sys/compat/linuxkpi/common/include/asm

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 11:44:46 2016
New Revision: 300491
URL: https://svnweb.freebsd.org/changeset/base/300491

Log:
  Add support for atomic_long_inc_not_zero() to the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic-long.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Mon May 23 
11:41:35 2016(r300490)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Mon May 23 
11:44:46 2016(r300491)
@@ -41,6 +41,7 @@ typedef struct {
 
 #defineatomic_long_add(i, v)   atomic_long_add_return((i), (v))
 #defineatomic_long_inc_return(v)   atomic_long_add_return(1, (v))
+#defineatomic_long_inc_not_zero(v) atomic_long_inc_not_zero(v)
 
 static inline long
 atomic_long_add_return(long i, atomic_long_t *v)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300492 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 11:47:54 2016
New Revision: 300492
URL: https://svnweb.freebsd.org/changeset/base/300492

Log:
  Add more GFP related defines to the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/gfp.h

Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h
==
--- head/sys/compat/linuxkpi/common/include/linux/gfp.h Mon May 23 11:44:46 
2016(r300491)
+++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Mon May 23 11:47:54 
2016(r300492)
@@ -46,6 +46,14 @@
 #define__GFP_NOWARN0
 #define__GFP_HIGHMEM   0
 #define__GFP_ZERO  M_ZERO
+#define__GFP_NORETRY   0
+#define__GFP_RECLAIM   0
+#define__GFP_RECLAIMABLE   0
+
+#define__GFP_IO0
+#define__GFP_NO_KSWAPD 0
+#define__GFP_WAIT  M_WAITOK
+#define__GFP_DMA32 0
 
 #defineGFP_NOWAIT  M_NOWAIT
 #defineGFP_ATOMIC  (M_NOWAIT | M_USE_RESERVE)
@@ -55,6 +63,8 @@
 #defineGFP_HIGHUSER_MOVABLEM_WAITOK
 #defineGFP_IOFSM_NOWAIT
 #defineGFP_NOIOM_NOWAIT
+#defineGFP_DMA32   0
+#defineGFP_TEMPORARY   0
 
 static inline void *
 page_address(struct page *page)
@@ -147,4 +157,7 @@ static inline uintptr_t __get_free_pages
 
 #define kmalloc_node(chunk, mask, node) kmalloc(chunk, mask)
 
+#defineSetPageReserved(page)   do { } while (0)/* NOP */
+#defineClearPageReserved(page) do { } while (0)/* NOP */
+
 #endif /* _LINUX_GFP_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300493 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 11:50:05 2016
New Revision: 300493
URL: https://svnweb.freebsd.org/changeset/base/300493

Log:
  Add support for "cdev_add_ext()" to the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/cdev.h

Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h
==
--- head/sys/compat/linuxkpi/common/include/linux/cdev.hMon May 23 
11:47:54 2016(r300492)
+++ head/sys/compat/linuxkpi/common/include/linux/cdev.hMon May 23 
11:50:05 2016(r300493)
@@ -91,6 +91,18 @@ cdev_add(struct linux_cdev *cdev, dev_t 
return (0);
 }
 
+static inline int
+cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int 
mode)
+{
+   cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), uid, gid, mode, 
+   "%s/%d", kobject_name(&cdev->kobj), MINOR(dev));
+   cdev->dev = dev;
+   cdev->cdev->si_drv1 = cdev;
+
+   kobject_get(cdev->kobj.parent);
+   return (0);
+}
+
 static inline void
 cdev_del(struct linux_cdev *cdev)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300494 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 11:53:00 2016
New Revision: 300494
URL: https://svnweb.freebsd.org/changeset/base/300494

Log:
  Implement "_outb()" to the LinuxKPI for i386 and amd64 only.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/io.h

Modified: head/sys/compat/linuxkpi/common/include/linux/io.h
==
--- head/sys/compat/linuxkpi/common/include/linux/io.h  Mon May 23 11:50:05 
2016(r300493)
+++ head/sys/compat/linuxkpi/common/include/linux/io.h  Mon May 23 11:53:00 
2016(r300494)
@@ -172,6 +172,14 @@ readl(const volatile void *addr)
 }
 
 #if defined(__i386__) || defined(__amd64__)
+static inline void
+_outb(u_char data, u_int port)
+{
+   __asm __volatile("outb %0, %w1" : : "a" (data), "Nd" (port));
+}
+#endif
+
+#if defined(__i386__) || defined(__amd64__)
 void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
 #else
 #define_ioremap_attr(...) NULL
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300495 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 11:57:23 2016
New Revision: 300495
URL: https://svnweb.freebsd.org/changeset/base/300495

Log:
  Make header file standalone by including definitions for needed
  linux_wait_xxx() functions.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/completion.h

Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h
==
--- head/sys/compat/linuxkpi/common/include/linux/completion.h  Mon May 23 
11:53:00 2016(r300494)
+++ head/sys/compat/linuxkpi/common/include/linux/completion.h  Mon May 23 
11:57:23 2016(r300495)
@@ -32,6 +32,7 @@
 #define_LINUX_COMPLETION_H_
 
 #include 
+#include 
 
 struct completion {
unsigned int done;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300496 - in head/sys/compat/linuxkpi/common: include/linux src

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 12:03:40 2016
New Revision: 300496
URL: https://svnweb.freebsd.org/changeset/base/300496

Log:
  Add more list_xxx() functions to the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/list.h
==
--- head/sys/compat/linuxkpi/common/include/linux/list.hMon May 23 
11:57:23 2016(r300495)
+++ head/sys/compat/linuxkpi/common/include/linux/list.hMon May 23 
12:03:40 2016(r300496)
@@ -109,6 +109,13 @@ list_replace(struct list_head *old, stru
 }
 
 static inline void
+list_replace_init(struct list_head *old, struct list_head *new)
+{
+   list_replace(old, new);
+   INIT_LIST_HEAD(old);
+}
+
+static inline void
 linux_list_add(struct list_head *new, struct list_head *prev,
 struct list_head *next)
 {
@@ -132,9 +139,18 @@ list_del_init(struct list_head *entry)
 #define list_first_entry(ptr, type, member) \
 list_entry((ptr)->next, type, member)
 
+#definelist_last_entry(ptr, type, member)  \
+   list_entry((ptr)->prev, type, member)
+
+#definelist_first_entry_or_null(ptr, type, member) \
+   (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
+
 #definelist_next_entry(ptr, member)
\
list_entry(((ptr)->member.next), typeof(*(ptr)), member)
 
+#definelist_prev_entry(ptr, member)
\
+   list_entry(((ptr)->member.prev), typeof(*(ptr)), member)
+
 #definelist_for_each(p, head)  
\
for (p = (head)->next; p != (head); p = (p)->next)
 
@@ -436,4 +452,7 @@ static inline int list_is_last(const str
 (pos) && ({ n = (pos)->member.next; 1; }); \
 pos = hlist_entry_safe(n, typeof(*(pos)), member))
 
+extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void 
*priv,
+struct list_head *a, struct list_head *b));
+
 #endif /* _LINUX_LIST_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May 23 11:57:23 
2016(r300495)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May 23 12:03:40 
2016(r300496)
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1358,6 +1359,47 @@ unregister_inetaddr_notifier(struct noti
 return (0);
 }
 
+struct list_sort_thunk {
+   int (*cmp)(void *, struct list_head *, struct list_head *);
+   void *priv;
+};
+
+static inline int
+linux_le_cmp(void *priv, const void *d1, const void *d2)
+{
+   struct list_head *le1, *le2;
+   struct list_sort_thunk *thunk;
+
+   thunk = priv;
+   le1 = *(__DECONST(struct list_head **, d1));
+   le2 = *(__DECONST(struct list_head **, d2));
+   return ((thunk->cmp)(thunk->priv, le1, le2));
+}
+
+void
+list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv,
+struct list_head *a, struct list_head *b))
+{
+   struct list_sort_thunk thunk;
+   struct list_head **ar, *le;
+   size_t count, i;
+
+   count = 0;
+   list_for_each(le, head)
+   count++;
+   ar = malloc(sizeof(struct list_head *) * count, M_KMALLOC, M_WAITOK);
+   i = 0;
+   list_for_each(le, head)
+   ar[i++] = le;
+   thunk.cmp = cmp;
+   thunk.priv = priv;
+   qsort_r(ar, count, sizeof(struct list_head *), &thunk, linux_le_cmp);
+   INIT_LIST_HEAD(head);
+   for (i = 0; i < count; i++)
+   list_add_tail(ar[i], head);
+   free(ar, M_KMALLOC);
+}
+
 void
 linux_irq_handler(void *ent)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300497 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 12:06:34 2016
New Revision: 300497
URL: https://svnweb.freebsd.org/changeset/base/300497

Log:
  Implement "kref_put_mutex()" for the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kref.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kref.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kref.hMon May 23 
12:03:40 2016(r300496)
+++ head/sys/compat/linuxkpi/common/include/linux/kref.hMon May 23 
12:06:34 2016(r300497)
@@ -36,6 +36,9 @@
 #include 
 
 #include 
+#include 
+#include 
+
 #include 
 
 struct kref {
@@ -88,4 +91,20 @@ kref_get_unless_zero(struct kref *kref)
return atomic_add_unless(&kref->refcount, 1, 0);
 }
 
+static inline int kref_put_mutex(struct kref *kref,
+void (*release)(struct kref *kref), struct mutex *lock)
+{
+   WARN_ON(release == NULL);
+   if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) {
+   mutex_lock(lock);
+   if (unlikely(!atomic_dec_and_test(&kref->refcount))) {
+   mutex_unlock(lock);
+   return 0;
+   }
+   release(kref);
+   return 1;
+   }
+   return 0;
+}
+
 #endif /* _LINUX_KREF_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300498 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 12:10:28 2016
New Revision: 300498
URL: https://svnweb.freebsd.org/changeset/base/300498

Log:
  Add more ktime related functions to the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/ktime.h

Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h
==
--- head/sys/compat/linuxkpi/common/include/linux/ktime.h   Mon May 23 
12:06:34 2016(r300497)
+++ head/sys/compat/linuxkpi/common/include/linux/ktime.h   Mon May 23 
12:10:28 2016(r300498)
@@ -51,6 +51,24 @@ ktime_to_ns(ktime_t kt)
return kt.tv64;
 }
 
+static inline int64_t
+ktime_divns(const ktime_t kt, int64_t div)
+{
+   return kt.tv64 / div;
+}
+
+static inline int64_t
+ktime_to_us(ktime_t kt)
+{
+return ktime_divns(kt, NSEC_PER_USEC);
+}
+
+static inline int64_t
+ktime_to_ms(ktime_t kt)
+{
+return ktime_divns(kt, NSEC_PER_MSEC);
+}
+
 static inline struct timeval
 ktime_to_timeval(ktime_t kt)
 {
@@ -89,6 +107,20 @@ ktime_sub(ktime_t lhs, ktime_t rhs)
return (lhs);
 }
 
+static inline int64_t
+ktime_us_delta(ktime_t later, ktime_t earlier)
+{
+ktime_t diff = ktime_sub(later, earlier);
+return ktime_to_us(diff);
+}
+
+static inline int64_t
+ktime_ms_delta(ktime_t later, ktime_t earlier)
+{
+ktime_t diff = ktime_sub(later, earlier);
+return ktime_to_ms(diff);
+}
+
 static inline ktime_t
 ktime_add(ktime_t lhs, ktime_t rhs)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300499 - head/sys/compat/linuxkpi/common/src

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 12:13:16 2016
New Revision: 300499
URL: https://svnweb.freebsd.org/changeset/base/300499

Log:
  Set an invalid IRQ number when no PCI IRQ is available in the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_pci.c

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Mon May 23 12:10:28 
2016(r300498)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Mon May 23 12:13:16 
2016(r300499)
@@ -139,7 +139,7 @@ linux_pci_attach(device_t dev)
if (rle)
pdev->dev.irq = rle->start;
else
-   pdev->dev.irq = 0;
+   pdev->dev.irq = 255;
pdev->irq = pdev->dev.irq;
mtx_unlock(&Giant);
spin_lock(&pci_lock);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300500 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 12:35:07 2016
New Revision: 300500
URL: https://svnweb.freebsd.org/changeset/base/300500

Log:
  Add more printf() related functions to the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Mon May 23 
12:13:16 2016(r300499)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Mon May 23 
12:35:07 2016(r300500)
@@ -52,6 +52,8 @@
 #include  
 #include 
 
+#include 
+
 #define KERN_CONT   ""
 #defineKERN_EMERG  "<0>"
 #defineKERN_ALERT  "<1>"
@@ -124,7 +126,37 @@
 #defineDIV_ROUND_UP_ULL(x, n)  DIV_ROUND_UP((unsigned long long)(x), 
(n))
 #defineFIELD_SIZEOF(t, f)  sizeof(((t *)0)->f)
 
-#defineprintk(X...)printf(X)
+#defineprintk(...) printf(__VA_ARGS__)
+#definevprintk(f, a)   vprintf(f, a)
+
+struct va_format {
+   const char *fmt;
+   va_list *va;
+};
+
+static inline int
+vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
+{
+   ssize_t ssize = size;
+   int i;
+
+   i = vsnprintf(buf, size, fmt, args);
+
+   return ((i >= ssize) ? (ssize - 1) : i);
+}
+
+static inline int
+scnprintf(char *buf, size_t size, const char *fmt, ...)
+{
+   va_list args;
+   int i;
+
+   va_start(args, fmt);
+   i = vscnprintf(buf, size, fmt, args);
+   va_end(args);
+
+   return (i);
+}
 
 /*
  * The "pr_debug()" and "pr_devel()" macros should produce zero code
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300501 - head/sys/netpfil/pf

2016-05-23 Thread Kristof Provost
Author: kp
Date: Mon May 23 12:41:29 2016
New Revision: 300501
URL: https://svnweb.freebsd.org/changeset/base/300501

Log:
  pf: Fix ICMP translation
  
  Fix ICMP source address rewriting in rdr scenarios.
  
  PR:   201519
  Submitted by: Max 
  MFC after:1 week

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cMon May 23 12:35:07 2016(r300500)
+++ head/sys/netpfil/pf/pf.cMon May 23 12:41:29 2016(r300501)
@@ -4784,8 +4784,7 @@ pf_test_state_icmp(struct pf_state **sta
&nk->addr[pd2.didx], pd2.af) ||
nk->port[pd2.didx] != th.th_dport)
pf_change_icmp(pd2.dst, &th.th_dport,
-   NULL, /* XXX Inbound NAT? */
-   &nk->addr[pd2.didx],
+   saddr, &nk->addr[pd2.didx],
nk->port[pd2.didx], NULL,
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, pd2.af);
@@ -4857,8 +4856,7 @@ pf_test_state_icmp(struct pf_state **sta
&nk->addr[pd2.didx], pd2.af) ||
nk->port[pd2.didx] != uh.uh_dport)
pf_change_icmp(pd2.dst, &uh.uh_dport,
-   NULL, /* XXX Inbound NAT? */
-   &nk->addr[pd2.didx],
+   saddr, &nk->addr[pd2.didx],
nk->port[pd2.didx], &uh.uh_sum,
pd2.ip_sum, icmpsum,
pd->ip_sum, 1, pd2.af);
@@ -4925,8 +4923,7 @@ pf_test_state_icmp(struct pf_state **sta
&nk->addr[pd2.didx], pd2.af) ||
nk->port[pd2.didx] != iih.icmp_id)
pf_change_icmp(pd2.dst, &iih.icmp_id,
-   NULL, /* XXX Inbound NAT? */
-   &nk->addr[pd2.didx],
+   saddr, &nk->addr[pd2.didx],
nk->port[pd2.didx], NULL,
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, AF_INET);
@@ -4978,8 +4975,7 @@ pf_test_state_icmp(struct pf_state **sta
&nk->addr[pd2.didx], pd2.af) ||
nk->port[pd2.didx] != iih.icmp6_id)
pf_change_icmp(pd2.dst, &iih.icmp6_id,
-   NULL, /* XXX Inbound NAT? */
-   &nk->addr[pd2.didx],
+   saddr, &nk->addr[pd2.didx],
nk->port[pd2.didx], NULL,
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, AF_INET6);
@@ -5018,8 +5014,7 @@ pf_test_state_icmp(struct pf_state **sta
 
if (PF_ANEQ(pd2.dst,
&nk->addr[pd2.didx], pd2.af))
-   pf_change_icmp(pd2.src, NULL,
-   NULL, /* XXX Inbound NAT? */
+   pf_change_icmp(pd2.src, NULL, saddr,
&nk->addr[pd2.didx], 0, NULL,
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, pd2.af);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300502 - head/sys/compat/linuxkpi/common/include/asm

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 12:52:22 2016
New Revision: 300502
URL: https://svnweb.freebsd.org/changeset/base/300502

Log:
  Define more copy to/from userspace functions in the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/uaccess.h

Modified: head/sys/compat/linuxkpi/common/include/asm/uaccess.h
==
--- head/sys/compat/linuxkpi/common/include/asm/uaccess.h   Mon May 23 
12:41:29 2016(r300501)
+++ head/sys/compat/linuxkpi/common/include/asm/uaccess.h   Mon May 23 
12:52:22 2016(r300502)
@@ -40,6 +40,7 @@ copy_to_user(void *to, const void *from,
return n;
return 0;
 }
+#define__copy_to_user(...) copy_to_user(__VA_ARGS__)
 
 static inline long
 copy_from_user(void *to, const void *from, unsigned long n)
@@ -48,5 +49,7 @@ copy_from_user(void *to, const void *fro
return n;
return 0;
 }
+#define__copy_from_user(...)   copy_from_user(__VA_ARGS__)
+#define__copy_in_user(...) copy_from_user(__VA_ARGS__)
 
 #endif /* _ASM_UACCESS_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300503 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 12:53:17 2016
New Revision: 300503
URL: https://svnweb.freebsd.org/changeset/base/300503

Log:
  Implement ror32() in the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon May 23 
12:52:22 2016(r300502)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon May 23 
12:53:17 2016(r300503)
@@ -73,6 +73,12 @@ __flsl(long mask)
return (flsl(mask) - 1);
 }
 
+static inline uint32_t
+ror32(uint32_t word, unsigned int shift)
+{
+
+   return ((word >> shift) | (word << (32 - shift)));
+}
 
 #defineffz(mask)   __ffs(~(mask))
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300504 - head/usr.sbin/iscsid

2016-05-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon May 23 12:58:24 2016
New Revision: 300504
URL: https://svnweb.freebsd.org/changeset/base/300504

Log:
  Build iscsid(8) with ICL_KERNEL_PROXY defined by default, as required
  for iSER.
  
  Obtained from:Mellanox Technologies
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/iscsid/Makefile

Modified: head/usr.sbin/iscsid/Makefile
==
--- head/usr.sbin/iscsid/Makefile   Mon May 23 12:53:17 2016
(r300503)
+++ head/usr.sbin/iscsid/Makefile   Mon May 23 12:58:24 2016
(r300504)
@@ -6,7 +6,7 @@ SRCS=   chap.c discovery.c iscsid.c keys.
 CFLAGS+=   -I${.CURDIR}
 CFLAGS+=   -I${.CURDIR}/../../sys/cam
 CFLAGS+=   -I${.CURDIR}/../../sys/dev/iscsi
-#CFLAGS+=  -DICL_KERNEL_PROXY
+CFLAGS+=   -DICL_KERNEL_PROXY
 MAN=   iscsid.8
 
 LIBADD=md util
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300505 - head/sys/dev/sfxge/common

2016-05-23 Thread Andrew Rybchenko
Author: arybchik
Date: Mon May 23 13:17:37 2016
New Revision: 300505
URL: https://svnweb.freebsd.org/changeset/base/300505

Log:
  sfxge(4): cleanup: remove unused EFX preempt macros
  
  The EFSYS_PREEMPT_DISABLE() and EFSYS_PREEMPT_ENABLE() macros
  were used to ensure correct timing of I2C operations. The APIs
  for I2C operations have been removed, so these macros have no
  callers.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/common/efsys.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Mon May 23 12:58:24 2016
(r300504)
+++ head/sys/dev/sfxge/common/efsys.h   Mon May 23 13:17:37 2016
(r300505)
@@ -1110,22 +1110,6 @@ typedef struct efsys_lock_s {
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
-/* PREEMPT */
-
-#defineEFSYS_PREEMPT_DISABLE(_state)   
\
-   do {\
-   (_state) = (_state);\
-   critical_enter();   \
-   _NOTE(CONSTANTCONDITION)\
-   } while (B_FALSE)
-
-#defineEFSYS_PREEMPT_ENABLE(_state)
\
-   do {\
-   (_state) = (_state);\
-   critical_exit(_state);  \
-   _NOTE(CONSTANTCONDITION)\
-   } while (B_FALSE)
-
 /* STAT */
 
 typedef uint64_t   efsys_stat_t;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300506 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 13:18:15 2016
New Revision: 300506
URL: https://svnweb.freebsd.org/changeset/base/300506

Log:
  Fix some data types and add "inline" keyword for __reg_op() function.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon May 23 
13:17:37 2016(r300505)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon May 23 
13:18:15 2016(r300506)
@@ -93,7 +93,7 @@ static inline int get_count_order(unsign
 }
 
 static inline unsigned long
-find_first_bit(unsigned long *addr, unsigned long size)
+find_first_bit(const unsigned long *addr, unsigned long size)
 {
long mask;
int bit;
@@ -115,7 +115,7 @@ find_first_bit(unsigned long *addr, unsi
 }
 
 static inline unsigned long
-find_first_zero_bit(unsigned long *addr, unsigned long size)
+find_first_zero_bit(const unsigned long *addr, unsigned long size)
 {
long mask;
int bit;
@@ -137,7 +137,7 @@ find_first_zero_bit(unsigned long *addr,
 }
 
 static inline unsigned long
-find_last_bit(unsigned long *addr, unsigned long size)
+find_last_bit(const unsigned long *addr, unsigned long size)
 {
long mask;
int offs;
@@ -163,7 +163,7 @@ find_last_bit(unsigned long *addr, unsig
 }
 
 static inline unsigned long
-find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
+find_next_bit(const unsigned long *addr, unsigned long size, unsigned long 
offset)
 {
long mask;
int offs;
@@ -202,7 +202,7 @@ find_next_bit(unsigned long *addr, unsig
 }
 
 static inline unsigned long
-find_next_zero_bit(unsigned long *addr, unsigned long size,
+find_next_zero_bit(const unsigned long *addr, unsigned long size,
 unsigned long offset)
 {
long mask;
@@ -306,23 +306,23 @@ bitmap_empty(unsigned long *addr, int si
 }
 
 #define__set_bit(i, a) 
\
-atomic_set_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i))
+atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i))
 
 #defineset_bit(i, a)   
\
-atomic_set_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i))
+atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i))
 
 #define__clear_bit(i, a)   
\
-atomic_clear_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i))
+atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], 
BIT_MASK(i))
 
 #defineclear_bit(i, a) 
\
-atomic_clear_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i))
+atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], 
BIT_MASK(i))
 
 #definetest_bit(i, a)  
\
-!!(atomic_load_acq_long(&((volatile long *)(a))[BIT_WORD(i)]) &\
+!!(atomic_load_acq_long(&((volatile unsigned long *)(a))[BIT_WORD(i)]) &   
\
 BIT_MASK(i))
 
-static inline long
-test_and_clear_bit(long bit, long *var)
+static inline int
+test_and_clear_bit(long bit, volatile unsigned long *var)
 {
long val;
 
@@ -330,14 +330,14 @@ test_and_clear_bit(long bit, long *var)
bit %= BITS_PER_LONG;
bit = (1UL << bit);
do {
-   val = *(volatile long *)var;
+   val = *var;
} while (atomic_cmpset_long(var, val, val & ~bit) == 0);
 
return !!(val & bit);
 }
 
-static inline long
-test_and_set_bit(long bit, long *var)
+static inline int
+test_and_set_bit(long bit, volatile unsigned long *var)
 {
long val;
 
@@ -345,7 +345,7 @@ test_and_set_bit(long bit, long *var)
bit %= BITS_PER_LONG;
bit = (1UL << bit);
do {
-   val = *(volatile long *)var;
+   val = *var;
} while (atomic_cmpset_long(var, val, val | bit) == 0);
 
return !!(val & bit);
@@ -399,7 +399,8 @@ enum {
 REG_OP_RELEASE,
 };
 
-static int __reg_op(unsigned long *bitmap, int pos, int order, int reg_op)
+static inline int
+__reg_op(unsigned long *bitmap, int pos, int order, int reg_op)
 {
 int nbits_reg;
 int index;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300507 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 13:19:20 2016
New Revision: 300507
URL: https://svnweb.freebsd.org/changeset/base/300507

Log:
  A missing definition needed by ktime_to_ms().
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/time.h

Modified: head/sys/compat/linuxkpi/common/include/linux/time.h
==
--- head/sys/compat/linuxkpi/common/include/linux/time.hMon May 23 
13:18:15 2016(r300506)
+++ head/sys/compat/linuxkpi/common/include/linux/time.hMon May 23 
13:19:20 2016(r300507)
@@ -29,6 +29,7 @@
 #define_LINUX_TIME_H_
 
 #defineNSEC_PER_USEC   1000L
+#defineNSEC_PER_MSEC   100L
 #defineNSEC_PER_SEC10L
 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300508 - head/sys/netpfil/pf

2016-05-23 Thread Kristof Provost
Author: kp
Date: Mon May 23 13:59:48 2016
New Revision: 300508
URL: https://svnweb.freebsd.org/changeset/base/300508

Log:
  pf: Fix more ICMP mistranslation
  
  In the default case fix the substitution of the destination address.
  
  PR:   201519
  Submitted by: Max 
  MFC after:1 week

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cMon May 23 13:19:20 2016(r300507)
+++ head/sys/netpfil/pf/pf.cMon May 23 13:59:48 2016(r300508)
@@ -5014,7 +5014,7 @@ pf_test_state_icmp(struct pf_state **sta
 
if (PF_ANEQ(pd2.dst,
&nk->addr[pd2.didx], pd2.af))
-   pf_change_icmp(pd2.src, NULL, saddr,
+   pf_change_icmp(pd2.dst, NULL, saddr,
&nk->addr[pd2.didx], 0, NULL,
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, pd2.af);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300509 - head/usr.sbin/bsdinstall/scripts

2016-05-23 Thread Allan Jude
Author: allanjude
Date: Mon May 23 15:11:01 2016
New Revision: 300509
URL: https://svnweb.freebsd.org/changeset/base/300509

Log:
  Fix error in bsdinstall where additional filesystems cannot be mounted
  
  Do not set canmount=noauto on the boot environment at create time, because
  this causes / to not be mounted, and since the chroot is read only, new
  mountpoints cannot be created.
  
  The property is set later, when other properties are adjusted
  
  Reported by:  HardenedBSD
  Sponsored by: ScaleEngine Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootMon May 23 13:59:48 2016
(r300508)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootMon May 23 15:11:01 2016
(r300509)
@@ -143,7 +143,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATA
 
# Boot Environment [BE] root and default boot dataset
/$ZFSBOOT_BEROOT_NAME   mountpoint=none
-   /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME  
mountpoint=/,canmount=noauto
+   /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME  mountpoint=/
 
# Compress /tmp, allow exec but not setuid
/tmpmountpoint=/tmp,exec=on,setuid=off
@@ -1310,6 +1310,10 @@ zfs_create_boot()
"mountpoint=/$zroot_name" "$zroot_name" ||
return $FAILURE
 
+   f_dprintf "$funcname: Set canmount=noauto for the root of the pool..."
+   f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
+   "$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
+
# Touch up permissions on the tmp directories
f_dprintf "$funcname: Modifying directory permissions..."
local dir
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300510 - head/sys/kern

2016-05-23 Thread Andrew Turner
Author: andrew
Date: Mon May 23 15:26:35 2016
New Revision: 300510
URL: https://svnweb.freebsd.org/changeset/base/300510

Log:
  Add the needed hwpmc hooks to subr_intr.c. This is needed for the correct
  operation of hwpmc on, for example, arm64 with intrng.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Mon May 23 15:11:01 2016(r300509)
+++ head/sys/kern/subr_intr.c   Mon May 23 15:26:35 2016(r300510)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
 #include "opt_ddb.h"
+#include "opt_hwpmc_hooks.h"
 #include "opt_platform.h"
 
 #include 
@@ -53,6 +54,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef HWPMC_HOOKS
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -311,6 +316,10 @@ intr_irq_handler(struct trapframe *tf)
irq_root_filter(irq_root_arg);
td->td_intr_frame = oldframe;
critical_exit();
+#ifdef HWPMC_HOOKS
+   if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+   pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
+#endif
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300491 - head/sys/compat/linuxkpi/common/include/asm

2016-05-23 Thread Ngie Cooper

> On May 23, 2016, at 04:44, Hans Petter Selasky  wrote:
> 
> Author: hselasky
> Date: Mon May 23 11:44:46 2016
> New Revision: 300491
> URL: https://svnweb.freebsd.org/changeset/base/300491
> 
> Log:
>  Add support for atomic_long_inc_not_zero() to the LinuxKPI.
> 
>  Obtained from:kmacy @
>  MFC after:1 week
>  Sponsored by:Mellanox Technologies
> 
> Modified:
>  head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
> 
> Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
> ==
> --- head/sys/compat/linuxkpi/common/include/asm/atomic-long.hMon May 23 
> 11:41:35 2016(r300490)
> +++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.hMon May 23 
> 11:44:46 2016(r300491)
> @@ -41,6 +41,7 @@ typedef struct {
> 
> #defineatomic_long_add(i, v)atomic_long_add_return((i), (v))
> #defineatomic_long_inc_return(v)atomic_long_add_return(1, (v))
> +#defineatomic_long_inc_not_zero(v)atomic_long_inc_not_zero(v)

The same function name is used twice..? This seems a bit odd...

> static inline long
> atomic_long_add_return(long i, atomic_long_t *v)
> 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300418 - head/sys/kern

2016-05-23 Thread John Nielsen
> On May 23, 2016, at 9:20 AM, John Nielsen  wrote:
> 
>> On May 22, 2016, at 7:04 AM, Baptiste Daroussin  wrote:
>> 
>> - * of date.  We could have received a reset packet in an interrupt or
>> + * of date.  We could have recived a reset packet in an interrupt or
> 
> Not sure if there's another error in this line that I'm not seeing but 
> "received" was spelled right to begin with and is now incorrect.

Oops, already fixed in a subsequent commit. Thanks and sorry for the noise.

JN

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


svn commit: r300512 - head/release/doc/en_US.ISO8859-1/relnotes

2016-05-23 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Mon May 23 15:37:12 2016
New Revision: 300512
URL: https://svnweb.freebsd.org/changeset/base/300512

Log:
  Document r298161, sqlite3 updated to 3.12.1.
  
  Approved by:  gjb@ (implicit with re@ hat on)

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
15:33:56 2016(r300511)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
15:37:12 2016(r300512)
@@ -563,9 +563,9 @@
   The &man.svnlite.1; utility has been
updated to version 1.8.14.
 
-  The sqlite3
+  The sqlite3
library used by &man.svnlite.1; and &man.kerberos.8; has been
-   updated to version 3.8.11.1.
+   updated to version 3.12.1.
 
   Timezone data files have been updated to
version 2015f.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300513 - head/release/doc/en_US.ISO8859-1/relnotes

2016-05-23 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Mon May 23 15:44:39 2016
New Revision: 300513
URL: https://svnweb.freebsd.org/changeset/base/300513

Log:
  Document r296190, openresolv updated to 3.7.3.
  
  Approved by:  gjb@ (implicit with re@ hat on)

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
15:37:12 2016(r300512)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
15:44:39 2016(r300513)
@@ -514,9 +514,9 @@
&man.hostapd.8; utilities have been updated to version
2.4.
 
-  The
+  The
&man.resolvconf.8; utility has been updated to version
-   3.7.0.
+   3.7.3.
 
   bmake has
been updated to version 20150606.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300418 - head/sys/kern

2016-05-23 Thread John Nielsen
> On May 22, 2016, at 7:04 AM, Baptiste Daroussin  wrote:
> 
> -  * of date.  We could have received a reset packet in an interrupt or
> +  * of date.  We could have recived a reset packet in an interrupt or

Not sure if there's another error in this line that I'm not seeing but 
"received" was spelled right to begin with and is now incorrect.

JN

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


svn commit: r300511 - head/release/doc/en_US.ISO8859-1/relnotes

2016-05-23 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Mon May 23 15:33:56 2016
New Revision: 300511
URL: https://svnweb.freebsd.org/changeset/base/300511

Log:
  Document r298192, file(1) updated to 5.26.
  
  Approved by:  gjb@ (implicit with re@ hat on)

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
15:26:35 2016(r300510)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
15:33:56 2016(r300511)
@@ -579,8 +579,8 @@
   &man.jemalloc.3; has been updated to
version 4.0.2.
 
-  The &man.file.1; utility has been
-   updated to version 5.25.
+  The &man.file.1; utility has been
+   updated to version 5.26.
 
   The &man.nc.1; utility has been updated
to the OpenBSD 5.8 version.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300348 - head

2016-05-23 Thread Bryan Drewery
On 5/23/16 4:01 AM, Andrew Turner wrote:
> On Mon, 23 May 2016 11:34:00 +0100
> Andrew Turner  wrote:
> 
>> On Sat, 21 May 2016 01:32:04 + (UTC)
>> Bryan Drewery  wrote:
>>
>>> Author: bdrewery
>>> Date: Sat May 21 01:32:04 2016
>>> New Revision: 300348
>>> URL: https://svnweb.freebsd.org/changeset/base/300348
>>>
>>> Log:
>>>   Move external toolchain support earlier.
>>>   
>>>   This is to consolidate external toolchain and
>>> WITHOUT_CROSS_COMPILER support. 
>>>   Reviewed by:  brooks, bapt
>>>   Sponsored by: EMC / Isilon Storage Division
>>>   Differential Revision:https://reviews.freebsd.org/D6353
>>>   
>>
>> This seems to have broken the arm64 build. My guess is the wrong
>> linker is being used, but I haven't looked into the issue too far.
> 
> The issue is you moved a block that depends on BROKEN_OPTIONS being
> defined to before the point we include share/mk/src.opts.mk, the place
> it is defined.
> 

Looking at it now.


-- 
Regards,
Bryan Drewery
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300491 - head/sys/compat/linuxkpi/common/include/asm

2016-05-23 Thread Hans Petter Selasky

On 05/23/16 17:27, Ngie Cooper wrote:



On May 23, 2016, at 04:44, Hans Petter Selasky  wrote:

Author: hselasky
Date: Mon May 23 11:44:46 2016
New Revision: 300491
URL: https://svnweb.freebsd.org/changeset/base/300491




Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic-long.hMon May 23 
11:41:35 2016(r300490)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.hMon May 23 
11:44:46 2016(r300491)
@@ -41,6 +41,7 @@ typedef struct {

#defineatomic_long_add(i, v)atomic_long_add_return((i), (v))
#defineatomic_long_inc_return(v)atomic_long_add_return(1, (v))
+#defineatomic_long_inc_not_zero(v)atomic_long_inc_not_zero(v)


The same function name is used twice..? This seems a bit odd...



Yes, it is odd. Fixed by r300517.

Thank you!

--HPS

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


Re: svn commit: r300348 - head

2016-05-23 Thread Bryan Drewery
On 5/23/16 9:04 AM, Bryan Drewery wrote:
> On 5/23/16 4:01 AM, Andrew Turner wrote:
>> On Mon, 23 May 2016 11:34:00 +0100
>> Andrew Turner  wrote:
>>
>>> On Sat, 21 May 2016 01:32:04 + (UTC)
>>> Bryan Drewery  wrote:
>>>
 Author: bdrewery
 Date: Sat May 21 01:32:04 2016
 New Revision: 300348
 URL: https://svnweb.freebsd.org/changeset/base/300348

 Log:
   Move external toolchain support earlier.
   
   This is to consolidate external toolchain and
 WITHOUT_CROSS_COMPILER support. 
   Reviewed by: brooks, bapt
   Sponsored by:EMC / Isilon Storage Division
   Differential Revision:   https://reviews.freebsd.org/D6353
   
>>>
>>> This seems to have broken the arm64 build. My guess is the wrong
>>> linker is being used, but I haven't looked into the issue too far.
>>
>> The issue is you moved a block that depends on BROKEN_OPTIONS being
>> defined to before the point we include share/mk/src.opts.mk, the place
>> it is defined.
>>
> 
> Looking at it now.
> 
> 

Fixed in r300519.  Sorry about that.  I've installed the
aarch64-binutils now to be sure I'm testing it as well.

-- 
Regards,
Bryan Drewery
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300519 - head

2016-05-23 Thread Bryan Drewery
Author: bdrewery
Date: Mon May 23 16:24:34 2016
New Revision: 300519
URL: https://svnweb.freebsd.org/changeset/base/300519

Log:
  Move binutils handling after src.opts.mk.
  
  This fixes the arm64 build after r300348.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon May 23 16:20:50 2016(r300518)
+++ head/Makefile.inc1  Mon May 23 16:24:34 2016(r300519)
@@ -59,20 +59,6 @@ CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLC
 .endif
 .if defined(CROSS_TOOLCHAIN_PREFIX)
 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
-CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
-.endif
-# If we do not have a bootstrap binutils (because the in-tree one does not
-# support the target architecture), provide a default cross-binutils prefix.
-# This allows aarch64 builds, for example, to automatically use the
-# aarch64-binutils port or package.
-.if !make(showconfig)
-.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
-!defined(CROSS_BINUTILS_PREFIX)
-CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
-.if !exists(${CROSS_BINUTILS_PREFIX})
-.error In-tree binutils does not support the ${TARGET_ARCH} architecture. 
Install the ${TARGET_ARCH}-binutils port or package or set 
CROSS_BINUTILS_PREFIX.
-.endif
-.endif
 .endif
 
 XCOMPILERS=CC CXX CPP
@@ -83,15 +69,6 @@ X${COMPILER}?=   ${CROSS_COMPILER_PREFIX}$
 X${COMPILER}?= ${${COMPILER}}
 .endif
 .endfor
-XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
-.for BINUTIL in ${XBINUTILS}
-.if defined(CROSS_BINUTILS_PREFIX) && \
-exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}})
-X${BINUTIL}?=  ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
-.else
-X${BINUTIL}?=  ${${BINUTIL}}
-.endif
-.endfor
 # If a full path to an external cross compiler is given, don't build
 # a cross compiler.
 .if ${XCC:N${CCACHE_BIN}:M/*}
@@ -151,6 +128,33 @@ CROSSENV+= COMPILER_VERSION=${COMPILER_V
 .endif # ${_expected_compiler_type} == ${COMPILER_TYPE}
 .endif # ${XCC:N${CCACHE_BIN}:M/*}
 
+# Handle external binutils.
+.if defined(CROSS_TOOLCHAIN_PREFIX)
+CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
+.endif
+# If we do not have a bootstrap binutils (because the in-tree one does not
+# support the target architecture), provide a default cross-binutils prefix.
+# This allows aarch64 builds, for example, to automatically use the
+# aarch64-binutils port or package.
+.if !make(showconfig)
+.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
+!defined(CROSS_BINUTILS_PREFIX)
+CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
+.if !exists(${CROSS_BINUTILS_PREFIX})
+.error In-tree binutils does not support the ${TARGET_ARCH} architecture. 
Install the ${TARGET_ARCH}-binutils port or package or set 
CROSS_BINUTILS_PREFIX.
+.endif
+.endif
+.endif
+XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
+.for BINUTIL in ${XBINUTILS}
+.if defined(CROSS_BINUTILS_PREFIX) && \
+exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}})
+X${BINUTIL}?=  ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
+.else
+X${BINUTIL}?=  ${${BINUTIL}}
+.endif
+.endfor
+
 
 # We must do lib/ and libexec/ before bin/ in case of a mid-install error to
 # keep the users system reasonably usable.  For static->dynamic root upgrades,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300517 - head/sys/compat/linuxkpi/common/include/asm

2016-05-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 23 16:19:51 2016
New Revision: 300517
URL: https://svnweb.freebsd.org/changeset/base/300517

Log:
  Implement "atomic_long_add_unless()" in the LinuxKPI and fix the
  implementation of "atomic_long_inc_not_zero()".
  
  Found by: ngie @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic-long.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Mon May 23 
16:12:11 2016(r300516)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Mon May 23 
16:19:51 2016(r300517)
@@ -41,7 +41,7 @@ typedef struct {
 
 #defineatomic_long_add(i, v)   atomic_long_add_return((i), (v))
 #defineatomic_long_inc_return(v)   atomic_long_add_return(1, (v))
-#defineatomic_long_inc_not_zero(v) atomic_long_inc_not_zero(v)
+#defineatomic_long_inc_not_zero(v) atomic_long_add_unless((v), 1, 
0)
 
 static inline long
 atomic_long_add_return(long i, atomic_long_t *v)
@@ -73,6 +73,21 @@ atomic_long_dec(atomic_long_t *v)
return atomic_fetchadd_long(&v->counter, -1) - 1;
 }
 
+static inline int
+atomic_long_add_unless(atomic_long_t *v, long a, long u)
+{
+   long c;
+
+   for (;;) {
+   c = atomic_long_read(v);
+   if (unlikely(c == u))
+   break;
+   if (likely(atomic_cmpset_long(&v->counter, c, c + a)))
+   break;
+   }
+   return (c != u);
+}
+
 static inline long
 atomic_long_dec_and_test(atomic_long_t *v)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300521 - head/usr.sbin/bsdinstall/scripts

2016-05-23 Thread Allan Jude
Author: allanjude
Date: Mon May 23 16:49:26 2016
New Revision: 300521
URL: https://svnweb.freebsd.org/changeset/base/300521

Log:
  Fix missing pool name in zfs set command

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootMon May 23 16:37:04 2016
(r300520)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootMon May 23 16:49:26 2016
(r300521)
@@ -1312,7 +1312,7 @@ zfs_create_boot()
 
f_dprintf "$funcname: Set canmount=noauto for the root of the pool..."
f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
-   "$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
+   "$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
 
# Touch up permissions on the tmp directories
f_dprintf "$funcname: Modifying directory permissions..."
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300522 - head/sys/vm

2016-05-23 Thread Alan Cox
Author: alc
Date: Mon May 23 16:59:05 2016
New Revision: 300522
URL: https://svnweb.freebsd.org/changeset/base/300522

Log:
  Correct an error in a comment: One of the conditions for page allocation
  is actually the opposite of that stated in the comment.
  
  Remove an unnecessary assignment.  Use an assertion to document the fact
  that no assignment is needed.
  
  Rewrite another comment to clarify that the page is not completely valid.
  
  Reviewed by:  kib

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Mon May 23 16:49:26 2016(r300521)
+++ head/sys/vm/vm_fault.c  Mon May 23 16:59:05 2016(r300522)
@@ -496,11 +496,13 @@ fast_failed:
goto readrest;
break;
}
+   KASSERT(fs.m == NULL, ("fs.m should be NULL, not %p", fs.m));
 
/*
-* Page is not resident.  If this is the search termination
-* or the pager might contain the page, allocate a new page.
-* Default objects are zero-fill, there is no real pager.
+* Page is not resident.  If the pager might contain the page
+* or this is the beginning of the search, allocate a new
+* page.  (Default objects are zero-fill, so there is no real
+* pager for them.)
 */
if (fs.object->type != OBJT_DEFAULT ||
fs.object == fs.first_object) {
@@ -517,7 +519,6 @@ fast_failed:
 * there, and allocation can fail, causing
 * restart and new reading of the p_flag.
 */
-   fs.m = NULL;
if (!vm_page_count_severe() || P_KILLED(curproc)) {
 #if VM_NRESERVLEVEL > 0
vm_object_color(fs.object, atop(vaddr) -
@@ -541,14 +542,12 @@ fast_failed:
 
 readrest:
/*
-* We have found a valid page or we have allocated a new page.
-* The page thus may not be valid or may not be entirely 
-* valid.
+* We have either allocated a new page or found an existing
+* page that is only partially valid.
 *
 * Attempt to fault-in the page if there is a chance that the
 * pager has it, and potentially fault in additional pages
-* at the same time.  For default objects simply provide
-* zero-filled pages.
+* at the same time.
 */
if (fs.object->type != OBJT_DEFAULT) {
int rv;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300523 - head/usr.sbin/bsdinstall/scripts

2016-05-23 Thread Allan Jude
Author: allanjude
Date: Mon May 23 17:04:13 2016
New Revision: 300523
URL: https://svnweb.freebsd.org/changeset/base/300523

Log:
  Only export and re-import the root pool if installing on MBR
  
  This step is required in order to dd the boot2 bits into the ZFS partition
  
  Sponsored by: ScaleEngine Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootMon May 23 16:59:05 2016
(r300522)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootMon May 23 17:04:13 2016
(r300523)
@@ -1310,10 +1310,6 @@ zfs_create_boot()
"mountpoint=/$zroot_name" "$zroot_name" ||
return $FAILURE
 
-   f_dprintf "$funcname: Set canmount=noauto for the root of the pool..."
-   f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
-   "$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
-
# Touch up permissions on the tmp directories
f_dprintf "$funcname: Modifying directory permissions..."
local dir
@@ -1338,17 +1334,17 @@ zfs_create_boot()
"bootfs=\"$zroot_name/$zroot_bootfs\"" "$zroot_name" ||
return $FAILURE
 
-   # Export the pool(s)
-   f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..."
-   f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" ||
-return $FAILURE
-   if [ "$ZFSBOOT_BOOT_POOL" ]; then
-   f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \
-"$bootpool_name" || return $FAILURE
-   fi
-
# MBR boot loader touch-up
if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then
+   # Export the pool(s)
+   f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..."
+   f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" ||
+return $FAILURE
+   if [ "$ZFSBOOT_BOOT_POOL" ]; then
+   f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \
+"$bootpool_name" || return $FAILURE
+   fi
+
f_dprintf "$funcname: Updating MBR boot loader on disks..."
# Stick the ZFS boot loader in the "convenient hole" after
# the ZFS internal metadata
@@ -1357,17 +1353,17 @@ zfs_create_boot()
 /boot/zfsboot /dev/$disk$bootpart \
 "skip=1 seek=1024" || return $FAILURE
done
-   fi
 
-   # Re-import the ZFS pool(s)
-   f_dprintf "$funcname: Re-importing ZFS pool(s)..."
-   f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
-"-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" ||
-return $FAILURE
-   if [ "$ZFSBOOT_BOOT_POOL" ]; then
+   # Re-import the ZFS pool(s)
+   f_dprintf "$funcname: Re-importing ZFS pool(s)..."
f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
-"-o altroot=\"$BSDINSTALL_CHROOT\"" \
-"$bootpool_name" || return $FAILURE
+"-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" 
||
+return $FAILURE
+   if [ "$ZFSBOOT_BOOT_POOL" ]; then
+   f_eval_catch $funcname zpool 
"$ZPOOL_IMPORT_WITH_OPTIONS" \
+"-o altroot=\"$BSDINSTALL_CHROOT\"" \
+"$bootpool_name" || return $FAILURE
+   fi
fi
 
# While this is apparently not needed, it seems to help MBR
@@ -1378,6 +1374,14 @@ zfs_create_boot()
 "cachefile=\"$BSDINSTALL_CHROOT/boot/zfs/zpool.cache\"" \
 "$zroot_name" || return $FAILURE
 
+   #
+   # Set canmount=noauto so that the default Boot Environment (BE) does not
+   # get mounted if a different BE is selected from the beastie menu
+   #
+   f_dprintf "$funcname: Set canmount=noauto for the root of the pool..."
+   f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
+   "$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
+
# Last, but not least... required lines for rc.conf(5)/loader.conf(5)
# NOTE: We later concatenate these into their destination
f_dprintf "%s: Configuring rc.conf(5)/loader.conf(5) additions..." \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300524 - head/release/doc/en_US.ISO8859-1/relnotes

2016-05-23 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Mon May 23 17:06:46 2016
New Revision: 300524
URL: https://svnweb.freebsd.org/changeset/base/300524

Log:
  Document r298998, OpenSSL updated to  1.0.2h.
  
  Approved by:  gjb@ (implicit with re@ hat on)

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
17:04:13 2016(r300523)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Mon May 23 
17:06:46 2016(r300524)
@@ -540,8 +540,8 @@
   The &man.tcpdump.1; utility has been
updated to version 4.7.4.
 
-  OpenSSL has
-   been updated to version 1.0.1p.
+  OpenSSL has
+   been updated to version 1.0.2h.
 
   The
&man.ssh.1; utility has been updated to re-implement hostname
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300525 - head/share/mk

2016-05-23 Thread Bryan Drewery
Author: bdrewery
Date: Mon May 23 17:11:32 2016
New Revision: 300525
URL: https://svnweb.freebsd.org/changeset/base/300525

Log:
  Use sed(1) to determine cc version rather than tail(1) since it is already in 
ITOOLS.
  
  This fixes 'tail: not found' warnings in installworld after r300351.
  
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Mon May 23 17:06:46 2016
(r300524)
+++ head/share/mk/bsd.compiler.mk   Mon May 23 17:11:32 2016
(r300525)
@@ -156,7 +156,7 @@ ${X_}COMPILER_VERSION!=echo "${_v:M[1-9]
 .undef _v
 .endif
 .if !defined(${X_}COMPILER_FREEBSD_VERSION)
-${X_}COMPILER_FREEBSD_VERSION!={ echo "__FreeBSD_cc_version" | 
${${cc}} -E - 2>/dev/null || echo __FreeBSD_cc_version; } | tail -n 1
+${X_}COMPILER_FREEBSD_VERSION!={ echo "__FreeBSD_cc_version" | 
${${cc}} -E - 2>/dev/null || echo __FreeBSD_cc_version; } | sed -n '$$p'
 # If we get a literal "__FreeBSD_cc_version" back then the compiler
 # is a non-FreeBSD build that doesn't support it or some other error
 # occurred.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300493 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread John Baldwin
On Monday, May 23, 2016 11:50:05 AM Hans Petter Selasky wrote:
> Author: hselasky
> Date: Mon May 23 11:50:05 2016
> New Revision: 300493
> URL: https://svnweb.freebsd.org/changeset/base/300493
> 
> Log:
>   Add support for "cdev_add_ext()" to the LinuxKPI.
>   
>   Obtained from:  kmacy @
>   MFC after:  1 week
>   Sponsored by:   Mellanox Technologies
> 
> Modified:
>   head/sys/compat/linuxkpi/common/include/linux/cdev.h
> 
> Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/cdev.h  Mon May 23 
> 11:47:54 2016(r300492)
> +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h  Mon May 23 
> 11:50:05 2016(r300493)
> @@ -91,6 +91,18 @@ cdev_add(struct linux_cdev *cdev, dev_t 
>   return (0);
>  }
>  
> +static inline int
> +cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int 
> mode)
> +{
> + cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), uid, gid, mode, 
> + "%s/%d", kobject_name(&cdev->kobj), MINOR(dev));
> + cdev->dev = dev;
> + cdev->cdev->si_drv1 = cdev;
> +
> + kobject_get(cdev->kobj.parent);
> + return (0);

This should use make_dev_s() instead?

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


svn commit: r300526 - head/share/mk

2016-05-23 Thread Bryan Drewery
Author: bdrewery
Date: Mon May 23 17:27:42 2016
New Revision: 300526
URL: https://svnweb.freebsd.org/changeset/base/300526

Log:
  Properly allow META_MODE to be set from environment.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/sys.mk

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkMon May 23 17:11:32 2016(r300525)
+++ head/share/mk/sys.mkMon May 23 17:27:42 2016(r300526)
@@ -46,7 +46,7 @@ __ENV_ONLY_OPTIONS:= \
 .sinclude 
 .elif ${MK_META_MODE} == "yes" && defined(.MAKEFLAGS) && ${.MAKEFLAGS:M-B} == 
""
 # verbose will show .MAKE.META.PREFIX for each target.
-META_MODE= meta verbose
+META_MODE+=meta verbose
 # silent will hide command output if a .meta file is created.
 .if !defined(NO_SILENT)
 META_MODE+=silent=yes
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac

2016-05-23 Thread Warner Losh
On Sun, May 22, 2016 at 1:12 PM, Justin Hibbits  wrote:
>
> On May 22, 2016 13:51, "Ravi Pokala"  wrote:
>>
>> -Original Message-
>> From:  on behalf of Luiz Otavio O Souza
>> 
>> Date: 2016-05-22, Sunday at 06:58
>> To: , ,
>> 
>> Subject: svn commit: r300421 - in head/sys: arm/allwinner
>> arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica
>> dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac
>>
>> >Author: loos
>> >Date: Sun May 22 13:58:32 2016
>> >New Revision: 300421
>> >URL: https://svnweb.freebsd.org/changeset/base/300421
>> >
>> >Log:
>> >  Fix the deciKelvin to Celsius conversion in kernel.
>> >
>> >  After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as
>> > 0C
>> >  reference and as result, the temperature read in sysctl(8) now exibits
>> > a
>> >  +0.1C difference.
>>
>> Out of morbid curiosity, why do these things report in deciKelvin anyway?
>> Are there sensors we support out there which report native Kelvin, or that
>> report sub-degree precision?
>>
>> Thanks,
>>
>> Ravi (rpokala@)
>>
>
> There are many i2c sensors which report in sub-degree centigrade. Though
> some of them are in 1/8 (or other power of 2) degree precision, not 1/10.

ACPI reports in decikelvin, and it was the first thing we supported. Some 1 wire
devices support 1/16th a degree, and we support it in millikelvin since 1/16th
is 0.0625. So the precision needed is actually greater than what we're
reporting.
However, the accuracy of the measurement isn't +/- 0.001, it's closer
to +/1 0.063
or so (well, that's a relative accuracy, absolute accuracy is closer
to +/- 1 degree).
We report the higher level of precision so that applications that use
the relative
temperature can use it to inform a control loop. We have no good way to report
relative precision for a measurement, or the absolute accuracy.

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


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

2016-05-23 Thread Svatopluk Kraus
Author: skra
Date: Mon May 23 18:12:52 2016
New Revision: 300528
URL: https://svnweb.freebsd.org/changeset/base/300528

Log:
  INTRNG - use gpio generic interrupt modes definitions added in r298738.
  
  Reviewed by:  ian

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

Modified: head/sys/arm/freescale/imx/imx_gpio.c
==
--- head/sys/arm/freescale/imx/imx_gpio.c   Mon May 23 17:41:53 2016
(r300527)
+++ head/sys/arm/freescale/imx/imx_gpio.c   Mon May 23 18:12:52 2016
(r300528)
@@ -95,8 +95,7 @@ __FBSDID("$FreeBSD$");
 struct gpio_irqsrc {
struct intr_irqsrc  gi_isrc;
u_int   gi_irq;
-   enum intr_polarity  gi_pol;
-   enum intr_trigger   gi_trig;
+   uint32_tgi_mode;
 };
 #endif
 
@@ -158,12 +157,11 @@ static int imx51_gpio_pin_toggle(device_
 #ifdef INTRNG
 static int
 gpio_pic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp,
-enum intr_polarity *polp, enum intr_trigger *trigp)
+uint32_t *modep)
 {
struct imx51_gpio_softc *sc;
u_int irq, tripol;
-   enum intr_polarity pol;
-   enum intr_trigger trig;
+   uint32_t mode;
 
sc = device_get_softc(dev);
 
@@ -191,31 +189,25 @@ gpio_pic_map_fdt(device_t dev, u_int nce
}
switch (tripol) {
case 1:
-   trig = INTR_TRIGGER_EDGE;
-   pol  = INTR_POLARITY_HIGH;
+   mode = GPIO_INTR_EDGE_RISING;
break;
case 2:
-   trig = INTR_TRIGGER_EDGE;
-   pol  = INTR_POLARITY_LOW;
+   mode = GPIO_INTR_EDGE_FALLING;
break;
case 4:
-   trig = INTR_TRIGGER_LEVEL;
-   pol  = INTR_POLARITY_HIGH;
+   mode = GPIO_INTR_LEVEL_HIGH;
break;
case 8:
-   trig = INTR_TRIGGER_LEVEL;
-   pol  = INTR_POLARITY_LOW;
+   mode = GPIO_INTR_LEVEL_LOW;
break;
default:
-   device_printf(sc->dev, "Unsupported trigger/polarity 0x%2x\n",
+   device_printf(sc->dev, "Unsupported interrupt mode 0x%2x\n",
tripol);
return (ENOTSUP);
}
*irqp = irq;
-   if (polp != NULL)
-   *polp = pol;
-   if (trigp != NULL)
-   *trigp = trig;
+   if (modep != NULL)
+   *modep = mode;
return (0);
 }
 
@@ -232,8 +224,7 @@ gpio_pic_map_intr(device_t dev, struct i
return (ENOTSUP);
 
daf = (struct intr_map_data_fdt *)data;
-   error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, NULL,
-   NULL);
+   error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, NULL);
if (error == 0) {
sc = device_get_softc(dev);
*isrcp = &sc->gpio_pic_irqsrc[irq].gi_isrc;
@@ -251,8 +242,7 @@ gpio_pic_teardown_intr(device_t dev, str
sc = device_get_softc(dev);
if (isrc->isrc_handlers == 0) {
gi = (struct gpio_irqsrc *)isrc;
-   gi->gi_pol = INTR_POLARITY_CONFORM;
-   gi->gi_trig = INTR_TRIGGER_CONFORM;
+   gi->gi_mode = GPIO_INTR_CONFORM;
 
// XXX Not sure this is necessary
mtx_lock_spin(&sc->sc_mtx);
@@ -272,8 +262,7 @@ gpio_pic_setup_intr(device_t dev, struct
struct gpio_irqsrc *gi;
int error, icfg;
u_int irq, reg, shift, wrk;
-   enum intr_trigger trig;
-   enum intr_polarity pol;
+   uint32_t mode;
 
sc = device_get_softc(dev);
gi = (struct gpio_irqsrc *)isrc;
@@ -282,34 +271,30 @@ gpio_pic_setup_intr(device_t dev, struct
if (data == NULL || data->type != INTR_MAP_DATA_FDT)
return (ENOTSUP);
daf = (struct intr_map_data_fdt *)data;
-   error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, &pol,
-   &trig);
+   error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, &mode);
if (error != 0)
return (error);
if (gi->gi_irq != irq)
return (EINVAL);
 
/* Compare config if this is not first setup. */
-   if (isrc->isrc_handlers != 0) {
-   if (pol != gi->gi_pol || trig != gi->gi_trig)
-   return (EINVAL);
-   else
-   return (0);
-   }
+   if (isrc->isrc_handlers != 0)
+   return (gi->gi_mode == mode ? 0 : EINVAL);
 
-   gi->gi_pol = pol;
-   gi->gi_trig = trig;
-
-   if (trig == INTR_TRIGGER_LEVEL) {
-   if (pol == INTR_POLARITY_LOW)
-   icfg = GPIO_ICR_COND_LOW;
-   else
-   icfg = GPIO_ICR_COND_HIGH;
-   } else {
-   if (pol == INTR_POLARITY_HIGH)
-   icfg = GPIO_ICR_COND_FALL;
-  

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

2016-05-23 Thread Svatopluk Kraus
Author: skra
Date: Mon May 23 18:16:21 2016
New Revision: 300529
URL: https://svnweb.freebsd.org/changeset/base/300529

Log:
  INTRNG - support new interrupt mapping type INTR_MAP_DATA_GPIO
  introduced in r298738.
  
  Reviewed by:  ian

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

Modified: head/sys/arm/freescale/imx/imx_gpio.c
==
--- head/sys/arm/freescale/imx/imx_gpio.c   Mon May 23 18:12:52 2016
(r300528)
+++ head/sys/arm/freescale/imx/imx_gpio.c   Mon May 23 18:16:21 2016
(r300529)
@@ -88,7 +88,14 @@ __FBSDID("$FreeBSD$");
 #defineIMX_GPIO_ISR_REG0x018 /* Interrupt Status Register */
 #defineIMX_GPIO_EDGE_REG   0x01C /* Edge Detect Register */
 
+#ifdef INTRNG
+#defineDEFAULT_CAPS(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \
+GPIO_INTR_LEVEL_LOW | GPIO_INTR_LEVEL_HIGH | GPIO_INTR_EDGE_RISING | \
+GPIO_INTR_EDGE_FALLING )
+#else
 #defineDEFAULT_CAPS(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)
+#endif
+
 #defineNGPIO   32
 
 #ifdef INTRNG
@@ -156,15 +163,12 @@ static int imx51_gpio_pin_toggle(device_
 
 #ifdef INTRNG
 static int
-gpio_pic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp,
-uint32_t *modep)
+gpio_pic_map_fdt(struct imx51_gpio_softc *sc, struct intr_map_data_fdt *daf,
+u_int *irqp, uint32_t *modep)
 {
-   struct imx51_gpio_softc *sc;
-   u_int irq, tripol;
+   u_int irq;
uint32_t mode;
 
-   sc = device_get_softc(dev);
-
/*
 * From devicetree/bindings/gpio/fsl-imx-gpio.txt:
 *  #interrupt-cells:  2. The first cell is the GPIO number. The second
@@ -176,18 +180,17 @@ gpio_pic_map_fdt(device_t dev, u_int nce
  * We can do any single one of these modes, but nothing in combo.
 */
 
-   if (ncells != 2) {
+   if (daf->ncells != 2) {
device_printf(sc->dev, "Invalid #interrupt-cells\n");
return (EINVAL);
}
 
-   irq = cells[0];
-   tripol = cells[1];
+   irq = daf->cells[0];
if (irq >= sc->gpio_npins) {
device_printf(sc->dev, "Invalid interrupt number %u\n", irq);
return (EINVAL);
}
-   switch (tripol) {
+   switch (daf->cells[1]) {
case 1:
mode = GPIO_INTR_EDGE_RISING;
break;
@@ -202,7 +205,7 @@ gpio_pic_map_fdt(device_t dev, u_int nce
break;
default:
device_printf(sc->dev, "Unsupported interrupt mode 0x%2x\n",
-   tripol);
+   daf->cells[1]);
return (ENOTSUP);
}
*irqp = irq;
@@ -212,23 +215,61 @@ gpio_pic_map_fdt(device_t dev, u_int nce
 }
 
 static int
+gpio_pic_map_gpio(struct imx51_gpio_softc *sc, struct intr_map_data_gpio *dag,
+u_int *irqp, uint32_t *modep)
+{
+   u_int irq;
+   uint32_t mode;
+
+   irq = dag->gpio_pin_num;
+   if (irq >= sc->gpio_npins) {
+   device_printf(sc->dev, "Invalid interrupt number %u\n", irq);
+   return (EINVAL);
+   }
+
+   mode = dag->gpio_intr_mode;
+   if (mode != GPIO_INTR_LEVEL_LOW && mode != GPIO_INTR_LEVEL_HIGH &&
+   mode != GPIO_INTR_EDGE_RISING && mode != GPIO_INTR_EDGE_FALLING) {
+   device_printf(sc->dev, "Unsupported interrupt mode 0x%8x\n",
+   mode);
+   return (EINVAL);
+   }
+
+   *irqp = irq;
+   if (modep != NULL)
+   *modep = mode;
+   return (0);
+}
+
+static int
+gpio_pic_map(struct imx51_gpio_softc *sc, struct intr_map_data *data,
+u_int *irqp, uint32_t *modep)
+{
+
+   switch (data->type) {
+   case INTR_MAP_DATA_FDT:
+   return (gpio_pic_map_fdt(sc, (struct intr_map_data_fdt *)data,
+   irqp, modep));
+   case INTR_MAP_DATA_GPIO:
+   return (gpio_pic_map_gpio(sc, (struct intr_map_data_gpio *)data,
+   irqp, modep));
+   default:
+   return (ENOTSUP);
+   }
+}
+
+static int
 gpio_pic_map_intr(device_t dev, struct intr_map_data *data,
 struct intr_irqsrc **isrcp)
 {
int error;
u_int irq;
-   struct intr_map_data_fdt *daf;
struct imx51_gpio_softc *sc;
 
-   if (data->type != INTR_MAP_DATA_FDT)
-   return (ENOTSUP);
-
-   daf = (struct intr_map_data_fdt *)data;
-   error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, NULL);
-   if (error == 0) {
-   sc = device_get_softc(dev);
+   sc = device_get_softc(dev);
+   error = gpio_pic_map(sc, data, &irq, NULL);
+   if (error == 0)
*isrcp = &sc->gpio_pic_irqsrc[irq].gi_isrc;
-   }
return (error);
 }
 
@@ -257,21 +298,20 @@ static int
 gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc,
 struct resource *res, struct intr_map_data *data)
 {
- 

Re: svn commit: r300372 - in head/sys: kern sys

2016-05-23 Thread John Baldwin
On Saturday, May 21, 2016 02:51:50 PM Andriy Gapon wrote:
> Author: avg
> Date: Sat May 21 14:51:49 2016
> New Revision: 300372
> URL: https://svnweb.freebsd.org/changeset/base/300372
> 
> Log:
>   fix loss of taskqueue wakeups (introduced in r300113)
>   
>   Submitted by:   kmacy
>   Tested by:  dchagin
> 
> Modified: head/sys/sys/taskqueue.h
> ==
> --- head/sys/sys/taskqueue.h  Sat May 21 11:40:41 2016(r300371)
> +++ head/sys/sys/taskqueue.h  Sat May 21 14:51:49 2016(r300372)
> @@ -114,7 +113,6 @@ void  taskqueue_thread_enqueue(void *cont
>   */
>  #define TASK_INIT(task, priority, func, context) do {\
>   (task)->ta_pending = 0; \
> - (task)->ta_flags = 0;   \
>   (task)->ta_priority = (priority);   \
>   (task)->ta_func = (func);   \
>   (task)->ta_context = (context); \
> @@ -224,7 +222,6 @@ int   taskqgroup_adjust(struct taskqgroup 
>  
>  #define GTASK_INIT(task, priority, func, context) do {   \
>   (task)->ta_pending = 0; \
> - (task)->ta_flags = TASK_SKIP_WAKEUP;\
>   (task)->ta_priority = (priority);   \
>   (task)->ta_func = (func);   \
>   (task)->ta_context = (context); \

Do we still need GTASK_INIT() now or can relevant tasks now use
TASK_INIT instead and GTASK_INIT be retired?

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


Re: svn commit: r300496 - in head/sys/compat/linuxkpi/common: include/linux src

2016-05-23 Thread Conrad Meyer
Didn't we already have list_sort in linuxkpi?  Maybe I'm confused.

On Mon, May 23, 2016 at 5:03 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Mon May 23 12:03:40 2016
> New Revision: 300496
> URL: https://svnweb.freebsd.org/changeset/base/300496
>
> Log:
>   Add more list_xxx() functions to the LinuxKPI.
>
>   Obtained from:kmacy @
>   MFC after:1 week
>   Sponsored by: Mellanox Technologies
>
> Modified:
>   head/sys/compat/linuxkpi/common/include/linux/list.h
>   head/sys/compat/linuxkpi/common/src/linux_compat.c
>
> Modified: head/sys/compat/linuxkpi/common/include/linux/list.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/list.hMon May 23 
> 11:57:23 2016(r300495)
> +++ head/sys/compat/linuxkpi/common/include/linux/list.hMon May 23 
> 12:03:40 2016(r300496)
> @@ -109,6 +109,13 @@ list_replace(struct list_head *old, stru
>  }
>
>  static inline void
> +list_replace_init(struct list_head *old, struct list_head *new)
> +{
> +   list_replace(old, new);
> +   INIT_LIST_HEAD(old);
> +}
> +
> +static inline void
>  linux_list_add(struct list_head *new, struct list_head *prev,
>  struct list_head *next)
>  {
> @@ -132,9 +139,18 @@ list_del_init(struct list_head *entry)
>  #define list_first_entry(ptr, type, member) \
>  list_entry((ptr)->next, type, member)
>
> +#definelist_last_entry(ptr, type, member)  \
> +   list_entry((ptr)->prev, type, member)
> +
> +#definelist_first_entry_or_null(ptr, type, member) \
> +   (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
> +
>  #definelist_next_entry(ptr, member)  
>   \
> list_entry(((ptr)->member.next), typeof(*(ptr)), member)
>
> +#definelist_prev_entry(ptr, member)  
>   \
> +   list_entry(((ptr)->member.prev), typeof(*(ptr)), member)
> +
>  #definelist_for_each(p, head)
>   \
> for (p = (head)->next; p != (head); p = (p)->next)
>
> @@ -436,4 +452,7 @@ static inline int list_is_last(const str
>  (pos) && ({ n = (pos)->member.next; 1; }); \
>  pos = hlist_entry_safe(n, typeof(*(pos)), member))
>
> +extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void 
> *priv,
> +struct list_head *a, struct list_head *b));
> +
>  #endif /* _LINUX_LIST_H_ */
>
> Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
> ==
> --- head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May 23 11:57:23 
> 2016(r300495)
> +++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May 23 12:03:40 
> 2016(r300496)
> @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>
> @@ -1358,6 +1359,47 @@ unregister_inetaddr_notifier(struct noti
>  return (0);
>  }
>
> +struct list_sort_thunk {
> +   int (*cmp)(void *, struct list_head *, struct list_head *);
> +   void *priv;
> +};
> +
> +static inline int
> +linux_le_cmp(void *priv, const void *d1, const void *d2)
> +{
> +   struct list_head *le1, *le2;
> +   struct list_sort_thunk *thunk;
> +
> +   thunk = priv;
> +   le1 = *(__DECONST(struct list_head **, d1));
> +   le2 = *(__DECONST(struct list_head **, d2));
> +   return ((thunk->cmp)(thunk->priv, le1, le2));
> +}
> +
> +void
> +list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv,
> +struct list_head *a, struct list_head *b))
> +{
> +   struct list_sort_thunk thunk;
> +   struct list_head **ar, *le;
> +   size_t count, i;
> +
> +   count = 0;
> +   list_for_each(le, head)
> +   count++;
> +   ar = malloc(sizeof(struct list_head *) * count, M_KMALLOC, M_WAITOK);
> +   i = 0;
> +   list_for_each(le, head)
> +   ar[i++] = le;
> +   thunk.cmp = cmp;
> +   thunk.priv = priv;
> +   qsort_r(ar, count, sizeof(struct list_head *), &thunk, linux_le_cmp);
> +   INIT_LIST_HEAD(head);
> +   for (i = 0; i < count; i++)
> +   list_add_tail(ar[i], head);
> +   free(ar, M_KMALLOC);
> +}
> +
>  void
>  linux_irq_handler(void *ent)
>  {
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac

2016-05-23 Thread Ravi Pokala
-Original Message-
From:  on behalf of Warner Losh 

Date: 2016-05-23, Monday at 10:37
To: Justin Hibbits 
Cc: Ravi Pokala , src-committers , 
"svn-src-head@freebsd.org" , Luiz Otavio O Souza 
, "svn-src-...@freebsd.org" 
Subject: Re: svn commit: r300421 - in head/sys: arm/allwinner 
arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica 
dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac

>On Sun, May 22, 2016 at 1:12 PM, Justin Hibbits  wrote:
>>
>> On May 22, 2016 13:51, "Ravi Pokala"  wrote:
>>>
>>> Out of morbid curiosity, why do these things report in deciKelvin anyway?
>>> Are there sensors we support out there which report native Kelvin, or that
>>> report sub-degree precision?
>>>
>>> Thanks,
>>>
>>> Ravi (rpokala@)
>>>
>>
>> There are many i2c sensors which report in sub-degree centigrade. Though
>> some of them are in 1/8 (or other power of 2) degree precision, not 1/10.
>
>ACPI reports in decikelvin, and it was the first thing we supported. Some 1 
>wire
>devices support 1/16th a degree, and we support it in millikelvin since 1/16th
>is 0.0625. So the precision needed is actually greater than what we're
>reporting.
>However, the accuracy of the measurement isn't +/- 0.001, it's closer
>to +/1 0.063
>or so (well, that's a relative accuracy, absolute accuracy is closer
>to +/- 1 degree).
>We report the higher level of precision so that applications that use
>the relative
>temperature can use it to inform a control loop. We have no good way to report
>relative precision for a measurement, or the absolute accuracy.
>
>Warner

Good to know. Thanks guys.

-Ravi


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


svn commit: r300531 - head/sys/dev/ntb/ntb_hw

2016-05-23 Thread Conrad E. Meyer
Author: cem
Date: Mon May 23 19:46:58 2016
New Revision: 300531
URL: https://svnweb.freebsd.org/changeset/base/300531

Log:
  ntb_hw(4): Only record the first three MSIX vectors
  
  Don't overrun the msix_data array by reading the (unused) link state
  interrupt information.
  
  Reported by:  mav (earlier version)
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6489

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw.c

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==
--- head/sys/dev/ntb/ntb_hw/ntb_hw.cMon May 23 18:20:15 2016
(r300530)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.cMon May 23 19:46:58 2016
(r300531)
@@ -333,7 +333,7 @@ static inline void db_iowrite(struct ntb
 static inline void db_iowrite_raw(struct ntb_softc *, uint64_t regoff, 
uint64_t);
 static int ntb_create_msix_vec(struct ntb_softc *ntb, uint32_t num_vectors);
 static void ntb_free_msix_vec(struct ntb_softc *ntb);
-static void ntb_get_msix_info(struct ntb_softc *ntb, uint32_t num_vectors);
+static void ntb_get_msix_info(struct ntb_softc *ntb);
 static void ntb_exchange_msix(void *);
 static struct ntb_hw_info *ntb_get_device_info(uint32_t device_id);
 static void ntb_detect_max_mw(struct ntb_softc *ntb);
@@ -1067,10 +1067,18 @@ ntb_init_isr(struct ntb_softc *ntb)
ntb->db_vec_shift = XEON_DB_TOTAL_SHIFT;
rc = ntb_setup_legacy_interrupt(ntb);
} else {
+   if (num_vectors - 1 != XEON_NONLINK_DB_MSIX_BITS &&
+   HAS_FEATURE(NTB_SB01BASE_LOCKUP)) {
+   device_printf(ntb->device,
+   "Errata workaround expects %d doorbell bits\n",
+   XEON_NONLINK_DB_MSIX_BITS);
+   return (EINVAL);
+   }
+
ntb_create_msix_vec(ntb, num_vectors);
rc = ntb_setup_msix(ntb, num_vectors);
if (rc == 0 && HAS_FEATURE(NTB_SB01BASE_LOCKUP))
-   ntb_get_msix_info(ntb, num_vectors);
+   ntb_get_msix_info(ntb);
}
if (rc != 0) {
device_printf(ntb->device,
@@ -1335,7 +1343,7 @@ ntb_free_msix_vec(struct ntb_softc *ntb)
 }
 
 static void
-ntb_get_msix_info(struct ntb_softc *ntb, uint32_t num_vectors)
+ntb_get_msix_info(struct ntb_softc *ntb)
 {
struct pci_devinfo *dinfo;
struct pcicfg_msix *msix;
@@ -1346,7 +1354,9 @@ ntb_get_msix_info(struct ntb_softc *ntb,
 
laddr = data = 0;
 
-   for (i = 0; i < num_vectors; i++) {
+   CTASSERT(XEON_NONLINK_DB_MSIX_BITS == nitems(ntb->msix_data));
+
+   for (i = 0; i < XEON_NONLINK_DB_MSIX_BITS; i++) {
offset = msix->msix_table_offset + i * PCI_MSIX_ENTRY_SIZE;
 
laddr = bus_read_4(msix->msix_table_res, offset +
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300532 - head/sys/cam/ata

2016-05-23 Thread Kenneth D. Merry
Author: ken
Date: Mon May 23 19:52:08 2016
New Revision: 300532
URL: https://svnweb.freebsd.org/changeset/base/300532

Log:
  Fix ada(4) trim support quirk setting.
  
  I broke broke the quirk in the ada(4) driver disabling NCQ trim support
  in revision 300207.  The support flags were set before the quirks were
  loaded.
  
  sys/cam/ata/ata_da.c:
Call adasetflags() after loading quirks, so that we'll set the
flags accurately.
  
  Sponsored by: Spectra Logic

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Mon May 23 19:46:58 2016(r300531)
+++ head/sys/cam/ata/ata_da.c   Mon May 23 19:52:08 2016(r300532)
@@ -1639,11 +1639,6 @@ adaregister(struct cam_periph *periph, v
return(CAM_REQ_CMP_ERR);
}
 
-   /*
-* Set support flags based on the Identify data.
-*/
-   adasetflags(softc, cgd);
-
periph->softc = softc;
 
/*
@@ -1683,6 +1678,12 @@ adaregister(struct cam_periph *periph, v
snprintf(announce_buf, sizeof(announce_buf),
"kern.cam.ada.%d.write_cache", periph->unit_number);
TUNABLE_INT_FETCH(announce_buf, &softc->write_cache);
+
+   /*
+* Set support flags based on the Identify data and quirks.
+*/
+   adasetflags(softc, cgd);
+
/* Disable queue sorting for non-rotational media by default. */
if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) {
softc->rotating = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r298946 - head/usr.sbin/bsdinstall/scripts

2016-05-23 Thread Andriy Voskoboinyk
Mon, 23 May 2016 08:00:27 +0300 було написано Allan Jude  
:



On 2016-05-23 00:49, Allan Jude wrote:

On 2016-05-02 17:40, Andriy Voskoboinyk wrote:

Author: avos
Date: Mon May  2 21:40:34 2016
New Revision: 298946
URL: https://svnweb.freebsd.org/changeset/base/298946

Log:
  bsdinstall: fix static address assignment for protected wireless  
networks.


  Filter out IFCONFIG_PREFIX variable (which may contain WPA keyword)
  from ifconfig parameters.

  PR:   169199

Modified:
  head/usr.sbin/bsdinstall/scripts/netconfig_ipv4

Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
==
--- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Mon May  2  
21:23:05 2016	(r298945)
+++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Mon May  2  
21:40:34 2016	(r298946)

@@ -84,7 +84,7 @@ retval=$?

 if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
. $BSDINSTALL_TMPETC/._rc.conf.net
-   ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE`
+	ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed  
"s|$2||"`

if [ "$defaultrouter" ]; then
route delete -inet default
route add -inet default $defaultrouter



This breaks static assignment of IP addresses to wired interfaces:

sed: first RE may not be empty




I wrote this patch for the issue. Unless you see a better way to do it?




No, I have no better ideas.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r300533 - in head/sys/arm: arm at91 cavium/cns11xx include mv

2016-05-23 Thread Ian Lepore
Author: ian
Date: Mon May 23 20:07:17 2016
New Revision: 300533
URL: https://svnweb.freebsd.org/changeset/base/300533

Log:
  Use the new(-ish) CP15_SCTLR macro to generate system control reg accesses
  where possible.  In the places that doesn't work (multi-line inline asm,
  and places where the old armv4 cpufuncs mechanism is used), annotate the
  accesses with a comment that includes SCTLR.  Now a grep -i sctlr can find
  all the system control register manipulations.
  
  No functional changes.

Modified:
  head/sys/arm/arm/cpufunc.c
  head/sys/arm/arm/cpufunc_asm.S
  head/sys/arm/arm/cpufunc_asm_xscale.S
  head/sys/arm/arm/elf_trampoline.c
  head/sys/arm/arm/locore-v4.S
  head/sys/arm/arm/machdep.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/cavium/cns11xx/econa_machdep.c
  head/sys/arm/include/cpu-v4.h
  head/sys/arm/mv/mv_machdep.c

Modified: head/sys/arm/arm/cpufunc.c
==
--- head/sys/arm/arm/cpufunc.c  Mon May 23 19:52:08 2016(r300532)
+++ head/sys/arm/arm/cpufunc.c  Mon May 23 20:07:17 2016(r300533)
@@ -886,7 +886,7 @@ arm9_setup(void)
/* Clear out the cache */
cpu_idcache_wbinv_all();
 
-   /* Set the control register */
+   /* Set the control register (SCTLR)   */
cpu_control(cpuctrlmask, cpuctrl);
 
 }

Modified: head/sys/arm/arm/cpufunc_asm.S
==
--- head/sys/arm/arm/cpufunc_asm.S  Mon May 23 19:52:08 2016
(r300532)
+++ head/sys/arm/arm/cpufunc_asm.S  Mon May 23 20:07:17 2016
(r300533)
@@ -68,7 +68,7 @@ ENTRY(cpu_ident)
 END(cpu_ident)
 
 ENTRY(cpu_get_control)
-   mrc p15, 0, r0, c1, c0, 0
+   mrc CP15_SCTLR(r0)
RET
 END(cpu_get_control)
 
@@ -98,13 +98,6 @@ END(cpu_faultaddress)
  * All other registers are CPU architecture specific
  */
 
-#if 0 /* See below. */
-ENTRY(cpufunc_control)
-   mcr p15, 0, r0, c1, c0, 0
-   RET
-END(cpufunc_control)
-#endif
-
 ENTRY(cpu_domains)
mcr p15, 0, r0, c3, c0, 0
RET
@@ -121,13 +114,13 @@ END(cpu_domains)
  */
 
 ENTRY(cpufunc_control)
-   mrc p15, 0, r3, c1, c0, 0   /* Read the control register */
+   mrc CP15_SCTLR(r3)  /* Read the control register */
bic r2, r3, r0  /* Clear bits */
eor r2, r2, r1  /* XOR bits */
 
 
teq r2, r3  /* Only write if there is a change */
-   mcrne   p15, 0, r2, c1, c0, 0   /* Write new control register */
+   mcrne   CP15_SCTLR(r2)  /* Write new control register */
mov r0, r3  /* Return old value */
 
RET

Modified: head/sys/arm/arm/cpufunc_asm_xscale.S
==
--- head/sys/arm/arm/cpufunc_asm_xscale.S   Mon May 23 19:52:08 2016
(r300532)
+++ head/sys/arm/arm/cpufunc_asm_xscale.S   Mon May 23 20:07:17 2016
(r300533)
@@ -111,13 +111,13 @@ END(xscale_cpwait)
  * changes in the control register.
  */
 ENTRY(xscale_control)
-   mrc p15, 0, r3, c1, c0, 0   /* Read the control register */
+   mrc CP15_SCTLR(r3)  /* Read the control register */
bic r2, r3, r0  /* Clear bits */
eor r2, r2, r1  /* XOR bits */
 
teq r2, r3  /* Only write if there was a change */
mcrne   p15, 0, r0, c7, c5, 6   /* Invalidate the BTB */
-   mcrne   p15, 0, r2, c1, c0, 0   /* Write new control register */
+   mcrne   CP15_SCTLR(r3)  /* Write new control register */
mov r0, r3  /* Return old value */
 
CPWAIT_AND_RETURN(r1)

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Mon May 23 19:52:08 2016
(r300532)
+++ head/sys/arm/arm/elf_trampoline.c   Mon May 23 20:07:17 2016
(r300533)
@@ -227,14 +227,14 @@ _startC(void)
 "bic %0, %0, #0xff00\n"
 "and %1, %1, #0xff00\n"
 "orr %0, %0, %1\n"
-"mrc p15, 0, %1, c1, c0, 0\n"
+"mrc p15, 0, %1, c1, c0, 0\n" /* CP15_SCTLR(%1)*/
 "bic %1, %1, #1\n" /* Disable MMU */
 "orr %1, %1, #(4 | 8)\n" /* Add DC enable,
 WBUF enable */
 "orr %1, %1, #0x1000\n" /* Add IC enable */
 "orr %1, %1, #(0x800)\n" /* BPRD enable */
 
-"mcr p15, 0, %1, c1, c0, 0\n"
+"mcr p15, 0, %1, c1, c0, 0\n" /* CP15_SCTLR(%1)*/
 "nop\n"
 "nop\n"
 "nop\n"
@

svn commit: r300534 - head/sys/arm/arm

2016-05-23 Thread Ian Lepore
Author: ian
Date: Mon May 23 20:12:38 2016
New Revision: 300534
URL: https://svnweb.freebsd.org/changeset/base/300534

Log:
  Oops, fix a paste-o commited in r300533.

Modified:
  head/sys/arm/arm/cpufunc_asm_xscale.S

Modified: head/sys/arm/arm/cpufunc_asm_xscale.S
==
--- head/sys/arm/arm/cpufunc_asm_xscale.S   Mon May 23 20:07:17 2016
(r300533)
+++ head/sys/arm/arm/cpufunc_asm_xscale.S   Mon May 23 20:12:38 2016
(r300534)
@@ -117,7 +117,7 @@ ENTRY(xscale_control)
 
teq r2, r3  /* Only write if there was a change */
mcrne   p15, 0, r0, c7, c5, 6   /* Invalidate the BTB */
-   mcrne   CP15_SCTLR(r3)  /* Write new control register */
+   mcrne   CP15_SCTLR(r2)  /* Write new control register */
mov r0, r3  /* Return old value */
 
CPWAIT_AND_RETURN(r1)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300535 - head/sys/arm/cavium/cns11xx

2016-05-23 Thread Ian Lepore
Author: ian
Date: Mon May 23 20:13:17 2016
New Revision: 300535
URL: https://svnweb.freebsd.org/changeset/base/300535

Log:
  Spaces->tab in comment.

Modified:
  head/sys/arm/cavium/cns11xx/econa_machdep.c

Modified: head/sys/arm/cavium/cns11xx/econa_machdep.c
==
--- head/sys/arm/cavium/cns11xx/econa_machdep.c Mon May 23 20:12:38 2016
(r300534)
+++ head/sys/arm/cavium/cns11xx/econa_machdep.c Mon May 23 20:13:17 2016
(r300535)
@@ -272,7 +272,7 @@ initarm(struct arm_boot_params *abp)
mem_info = ((*ddr) >> 4) & 0x3;
memsize = (8

svn commit: r300536 - head/sys/netinet6

2016-05-23 Thread Mark Johnston
Author: markj
Date: Mon May 23 20:15:08 2016
New Revision: 300536
URL: https://svnweb.freebsd.org/changeset/base/300536

Log:
  Acquire the nd6 lock in the prefix list sysctl handler.
  
  The nd6 lock will be used to synchronize access to the NDP prefix list.
  
  MFC after:2 weeks
  Tested by:Jason Wolfe (as part of a larger change)

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Mon May 23 20:13:17 2016(r300535)
+++ head/sys/netinet6/nd6.c Mon May 23 20:15:08 2016(r300536)
@@ -2610,15 +2610,17 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
if (req->newptr)
return (EPERM);
 
+   error = sysctl_wire_old_buffer(req, 0);
+   if (error != 0)
+   return (error);
+
bzero(&p, sizeof(p));
p.origin = PR_ORIG_RA;
bzero(&s6, sizeof(s6));
s6.sin6_family = AF_INET6;
s6.sin6_len = sizeof(s6);
 
-   /*
-* XXX locking
-*/
+   ND6_RLOCK();
LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) {
p.prefix = pr->ndpr_prefix;
if (sa6_recoverscope(&p.prefix)) {
@@ -2651,7 +2653,7 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
p.advrtrs++;
error = SYSCTL_OUT(req, &p, sizeof(p));
if (error != 0)
-   return (error);
+   break;
LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) {
s6.sin6_addr = pfr->router->rtaddr;
if (sa6_recoverscope(&s6))
@@ -2660,8 +2662,9 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
ip6_sprintf(ip6buf, &pfr->router->rtaddr));
error = SYSCTL_OUT(req, &s6, sizeof(s6));
if (error != 0)
-   return (error);
+   break;
}
}
-   return (0);
+   ND6_RUNLOCK();
+   return (error);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300537 - head/sys/netinet6

2016-05-23 Thread Mark Johnston
Author: markj
Date: Mon May 23 20:18:11 2016
New Revision: 300537
URL: https://svnweb.freebsd.org/changeset/base/300537

Log:
  Mark the prefix and default router list sysctl handlers MPSAFE.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Mon May 23 20:15:08 2016(r300536)
+++ head/sys/netinet6/nd6.c Mon May 23 20:18:11 2016(r300537)
@@ -2548,13 +2548,16 @@ clear_llinfo_pqueue(struct llentry *ln)
 
 static int nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS);
 static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS);
-#ifdef SYSCTL_DECL
+
 SYSCTL_DECL(_net_inet6_icmp6);
-#endif
-SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist,
-   CTLFLAG_RD, nd6_sysctl_drlist, "");
-SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist,
-   CTLFLAG_RD, nd6_sysctl_prlist, "");
+SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist,
+   CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   NULL, 0, nd6_sysctl_drlist, "S,in6_defrouter",
+   "NDP default router list");
+SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist,
+   CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   NULL, 0, nd6_sysctl_prlist, "S,in6_prefix",
+   "NDP prefix list");
 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, nd6_maxqueuelen,
CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1, "");
 SYSCTL_INT(_net_inet6_icmp6, OID_AUTO, nd6_gctimer,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300538 - head/tests/sys/kern

2016-05-23 Thread Alan Somers
Author: asomers
Date: Mon May 23 20:19:07 2016
New Revision: 300538
URL: https://svnweb.freebsd.org/changeset/base/300538

Log:
  Commit a missing change from 299090
  
  tests/sys/kern/Makefile
Reenable a disabled compiler warning, the need for which was
eliminated by r299090.
  
  Reviewed by:  ngie
  MFC after:4 weeks
  X-MFC-With:   299090
  Sponsored by: Spectra Logic Corp

Modified:
  head/tests/sys/kern/Makefile

Modified: head/tests/sys/kern/Makefile
==
--- head/tests/sys/kern/MakefileMon May 23 20:18:11 2016
(r300537)
+++ head/tests/sys/kern/MakefileMon May 23 20:19:07 2016
(r300538)
@@ -26,8 +26,6 @@ LIBADD.mqueue_test+=  rt
 # included in userland.  But as far as subr_unit_test goes, they're effectively
 # static.  So it's ok to disable -Wmissing-prototypes for this program.
 CFLAGS.subr_unit.c+=   -Wno-missing-prototypes
-# XXX: -Wno-sign-compare will be eliminated as part of D6004
-CFLAGS.subr_unit.c+=   -Wno-sign-compare
 SRCS.subr_unit_test+=  subr_unit.c
 
 WARNS?=5
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300496 - in head/sys/compat/linuxkpi/common: include/linux src

2016-05-23 Thread Hans Petter Selasky

On 05/23/16 21:03, Conrad Meyer wrote:

Didn't we already have list_sort in linuxkpi?  Maybe I'm confused.


No, it is new from what I can see.

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


svn commit: r300539 - in head: . share/man/man3 sys/kern sys/sys tests/sys/sys

2016-05-23 Thread Alan Somers
Author: asomers
Date: Mon May 23 20:29:18 2016
New Revision: 300539
URL: https://svnweb.freebsd.org/changeset/base/300539

Log:
  Add bit_count to the bitstring(3) api
  
  Add a bit_count function, which efficiently counts the number of bits set in
  a bitstring.
  
  sys/sys/bitstring.h
  tests/sys/sys/bitstring_test.c
  share/man/man3/bitstring.3
Add bit_alloc
  
  sys/kern/subr_unit.c
Use bit_count instead of a naive counting loop in check_unrhdr, used
when INVARIANTS are enabled. The userland test runs about 6x faster
in a generic build, or 8.5x faster when built for Nehalem, which has
the POPCNT instruction.
  
  sys/sys/param.h
Bump __FreeBSD_version due to the addition of bit_alloc
  
  UPDATING
Add a note about the ABI incompatibility of the bitstring(3)
changes, as suggested by lidl.
  
  Suggested by: gibbs
  Reviewed by:  gibbs, ngie
  MFC after:9 days
  X-MFC-With:   299090, 300538
  Relnotes: yes
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D6255

Modified:
  head/UPDATING
  head/share/man/man3/bitstring.3
  head/sys/kern/subr_unit.c
  head/sys/sys/bitstring.h
  head/sys/sys/param.h
  head/tests/sys/sys/bitstring_test.c

Modified: head/UPDATING
==
--- head/UPDATING   Mon May 23 20:19:07 2016(r300538)
+++ head/UPDATING   Mon May 23 20:29:18 2016(r300539)
@@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20160523:
+   The bitstring(3) API has been updated with new functionality and
+   improved performance.  But it is binary-incompatible with the old API.
+   Objects built with the new headers may not be linked against objects
+   built with the old headers.
+
 20160520:
The brk and sbrk functions have been removed from libc on arm64.
Binutils from ports has been updated to not link to these

Modified: head/share/man/man3/bitstring.3
==
--- head/share/man/man3/bitstring.3 Mon May 23 20:19:07 2016
(r300538)
+++ head/share/man/man3/bitstring.3 Mon May 23 20:29:18 2016
(r300539)
@@ -27,7 +27,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" Copyright (c) 2014 Spectra Logic Corporation
+.\" Copyright (c) 2014,2016 Spectra Logic Corporation
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -58,12 +58,13 @@
 .\" @(#)bitstring.38.1 (Berkeley) 7/19/93
 .\" $FreeBSD$
 .\"
-.Dd May 4, 2016
+.Dd May 23, 2016
 .Dt BITSTRING 3
 .Os
 .Sh NAME
 .Nm bit_alloc ,
 .Nm bit_clear ,
+.Nm bit_count ,
 .Nm bit_decl ,
 .Nm bit_ffc ,
 .Nm bit_ffs ,
@@ -84,6 +85,8 @@
 .Ft void
 .Fn bit_clear "bitstr_t *name" "int bit"
 .Ft void
+.Fn bit_count "bitstr_t *name" "int count" "int nbits" "int *value"
+.Ft void
 .Fn bit_ffc "bitstr_t *name" "int nbits" "int *value"
 .Ft void
 .Fn bit_ffs "bitstr_t *name" "int nbits" "int *value"
@@ -225,6 +228,17 @@ the location referenced by
 .Fa value
 is set to \-1.
 .Pp
+The
+.Fn bit_count
+function stores in the location referenced by
+.Fa value
+the number of bits set in the array of
+.Fa nbits
+bits referenced by
+.Fa name ,
+at or after the zero-based bit index
+.Fa start .
+.Pp
 The arguments in bit string macros are evaluated only once and may safely
 have side effects.
 .Sh EXAMPLES

Modified: head/sys/kern/subr_unit.c
==
--- head/sys/kern/subr_unit.c   Mon May 23 20:19:07 2016(r300538)
+++ head/sys/kern/subr_unit.c   Mon May 23 20:29:18 2016(r300539)
@@ -224,7 +224,8 @@ check_unrhdr(struct unrhdr *uh, int line
 {
struct unr *up;
struct unrb *ub;
-   u_int x, y, z, w;
+   int w;
+   u_int y, z;
 
y = uh->first;
z = 0;
@@ -237,9 +238,7 @@ check_unrhdr(struct unrhdr *uh, int line
up->len, NBITS, line));
z++;
w = 0;
-   for (x = 0; x < up->len; x++)
-   if (bit_test(ub->map, x))
-   w++;
+   bit_count(ub->map, 0, up->len, &w);
y += w;
} else if (up->ptr != NULL) 
y += up->len;

Modified: head/sys/sys/bitstring.h
==

Re: svn commit: r300493 - head/sys/compat/linuxkpi/common/include/linux

2016-05-23 Thread Hans Petter Selasky

On 05/23/16 19:00, John Baldwin wrote:

On Monday, May 23, 2016 11:50:05 AM Hans Petter Selasky wrote:

Author: hselasky
Date: Mon May 23 11:50:05 2016
New Revision: 300493
URL: https://svnweb.freebsd.org/changeset/base/300493

Log:
  Add support for "cdev_add_ext()" to the LinuxKPI.

  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/cdev.h

Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h
==
--- head/sys/compat/linuxkpi/common/include/linux/cdev.hMon May 23 
11:47:54 2016(r300492)
+++ head/sys/compat/linuxkpi/common/include/linux/cdev.hMon May 23 
11:50:05 2016(r300493)
@@ -91,6 +91,18 @@ cdev_add(struct linux_cdev *cdev, dev_t
return (0);
 }

+static inline int
+cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int 
mode)
+{
+   cdev->cdev = make_dev(&linuxcdevsw, MINOR(dev), uid, gid, mode,
+   "%s/%d", kobject_name(&cdev->kobj), MINOR(dev));
+   cdev->dev = dev;
+   cdev->cdev->si_drv1 = cdev;
+
+   kobject_get(cdev->kobj.parent);
+   return (0);


This should use make_dev_s() instead?



Good idea. I'll fix it.

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


Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol

2016-05-23 Thread Alan Somers
On Fri, May 6, 2016 at 8:45 AM, Kurt Lidl  wrote:

> On 5/5/16 12:31 PM, John Baldwin wrote:
>
>> On Wednesday, May 04, 2016 10:34:11 PM Alan Somers wrote:
>>
>>> Author: asomers
>>> Date: Wed May  4 22:34:11 2016
>>> New Revision: 299090
>>> URL: https://svnweb.freebsd.org/changeset/base/299090
>>>
>>> Log:
>>>   Improve performance and functionality of the bitstring(3) api
>>>
>>>   Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which
>>> allow
>>>   for efficient searching of set or cleared bits starting from any bit
>>> offset
>>>   within the bit string.
>>>
>>>   Performance is improved by operating on longs instead of bytes and
>>> using
>>>   ffsl() for searches within a long. ffsl() is a compiler builtin in both
>>>   clang and gcc for most architectures, converting what was a brute force
>>>   while loop search into a couple of instructions.
>>>
>>>   All of the bitstring(3) API continues to be contained in the header
>>> file.
>>>   Some of the functions are large enough that perhaps they should be
>>> uninlined
>>>   and moved to a library, but that is beyond the scope of this commit.
>>>
>>
>> Doesn't switching from bytes to longs break the ABI?  That is, setting
>> bit 9
>> now has a different representation on big-endian systems (0x00 0x01
>> before,
>> now 0x00 0x00 0x01 0x00 on 32-bit BE, and 4 more leading 0 bytes on
>> 64-bit).
>> This means you can't have an object file compiled against the old header
>> pass a bitstring to an object file compiled against the new header on
>> big-endian
>> systems.
>>
>> Even on little-endian systems if an old object file allocates storage for
>> a
>> bitstring the new code might read off the end of it and fault (or return
>> garbage if bits are set in the extra bytes it reads off the end)?
>>
>> Is the API is so little used we don't care?
>>
>>
> Just as a note - at my prior job (Pi-Coral, now defunct) we used this
> API everywhere in the dataplane code of our product.  Since the company
> is gone, that particular use-case doesn't matter anymore.
>
> At the very least, this deserves a mention in the release notes, and
> also UPDATING!
>
> -Kurt
>
>
UPDATING is updated as of r300539.  Any objection to merging this to
stable/10?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300372 - in head/sys: kern sys

2016-05-23 Thread Andriy Gapon

I don't know, I was just a proxy.
Kip is the author.

On 23/05/2016 21:43, John Baldwin wrote:
> On Saturday, May 21, 2016 02:51:50 PM Andriy Gapon wrote:
>> Author: avg
>> Date: Sat May 21 14:51:49 2016
>> New Revision: 300372
>> URL: https://svnweb.freebsd.org/changeset/base/300372
>>
>> Log:
>>   fix loss of taskqueue wakeups (introduced in r300113)
>>   
>>   Submitted by:  kmacy
>>   Tested by: dchagin
>>
>> Modified: head/sys/sys/taskqueue.h
>> ==
>> --- head/sys/sys/taskqueue.h Sat May 21 11:40:41 2016(r300371)
>> +++ head/sys/sys/taskqueue.h Sat May 21 14:51:49 2016(r300372)
>> @@ -114,7 +113,6 @@ void taskqueue_thread_enqueue(void *cont
>>   */
>>  #define TASK_INIT(task, priority, func, context) do {   \
>>  (task)->ta_pending = 0; \
>> -(task)->ta_flags = 0;   \
>>  (task)->ta_priority = (priority);   \
>>  (task)->ta_func = (func);   \
>>  (task)->ta_context = (context); \
>> @@ -224,7 +222,6 @@ int  taskqgroup_adjust(struct taskqgroup 
>>  
>>  #define GTASK_INIT(task, priority, func, context) do {  \
>>  (task)->ta_pending = 0; \
>> -(task)->ta_flags = TASK_SKIP_WAKEUP;\
>>  (task)->ta_priority = (priority);   \
>>  (task)->ta_func = (func);   \
>>  (task)->ta_context = (context); \
> 
> Do we still need GTASK_INIT() now or can relevant tasks now use
> TASK_INIT instead and GTASK_INIT be retired?
> 


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


svn commit: r300540 - head/share/man/man9

2016-05-23 Thread Bryan Drewery
Author: bdrewery
Date: Mon May 23 21:29:57 2016
New Revision: 300540
URL: https://svnweb.freebsd.org/changeset/base/300540

Log:
  Be more clear about LOCKLEAF being exclusive and add LOCKSHARED.

Modified:
  head/share/man/man9/namei.9

Modified: head/share/man/man9/namei.9
==
--- head/share/man/man9/namei.9 Mon May 23 20:29:18 2016(r300539)
+++ head/share/man/man9/namei.9 Mon May 23 21:29:57 2016(r300540)
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 6, 2015
+.Dd May 23, 2015
 .Dt NAMEI 9
 .Os
 .Sh NAME
@@ -121,8 +121,12 @@ function takes the following set of
 that influence its operation:
 .Bl -tag -width ".Dv WANTPARENT"
 .It Dv LOCKLEAF
-Lock vnode on return.
-This is a full lock of the vnode; the
+Lock vnode on return with
+.Dv LK_EXCLUSIVE
+unless
+.Dv LOCKSHARED
+is also set.
+The
 .Xr VOP_UNLOCK 9
 should be used
 to release the lock (or
@@ -149,6 +153,19 @@ or
 .Xr VOP_UNLOCK 9
 and
 .Xr vrele 9 .
+.It Dv LOCKSHARED
+Lock vnode on return with
+.Dv LK_SHARED .
+The
+.Xr VOP_UNLOCK 9
+should be used
+to release the lock (or
+.Xr vput 9
+which is equivalent to calling
+.Xr VOP_UNLOCK 9
+followed by
+.Xr vrele 9 ,
+all in one).
 .It Dv WANTPARENT
 This flag allows the
 .Fn namei
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300542 - head/share/misc

2016-05-23 Thread Baptiste Daroussin
Author: bapt
Date: Mon May 23 22:01:06 2016
New Revision: 300542
URL: https://svnweb.freebsd.org/changeset/base/300542

Log:
  Update pci_vendors to 2016.05.23

Modified:
  head/share/misc/pci_vendors

Modified: head/share/misc/pci_vendors
==
--- head/share/misc/pci_vendors Mon May 23 21:58:47 2016(r300541)
+++ head/share/misc/pci_vendors Mon May 23 22:01:06 2016(r300542)
@@ -3,8 +3,8 @@
 #
 #  List of PCI ID's
 #
-#  Version: 2016.02.27
-#  Date:2016-02-27 03:15:01
+#  Version: 2016.05.23
+#  Date:2016-05-23 03:15:02
 #
 #  Maintained by Albert Pool, Martin Mares, and other volunteers from
 #  the PCI ID Project at http://pci-ids.ucw.cz/.
@@ -273,6 +273,7 @@
103c 12c5  Ultra320 SCSI [A7173A]
103c 1323  Core I/O LAN/SCSI Combo [AB314A]
103c 3108  Single Channel Ultra320 SCSI HBA G2
+   103c 322a  SC11Xe Ultra320 Single Channel PCIe x4 SCSI Host Bus 
Adapter (412911-B21)
124b 1170  PMC-USCSI320
 # VMware's emulation of this device. Was missing from the list.
15ad 1976  LSI Logic Parallel SCSI Controller
@@ -480,6 +481,21 @@
007c  MegaRAID SAS 1078DE
1014 0395  ServeRAID-AR10is SAS/SATA Controller
007e  SSS6200 PCI-Express Flash SSD
+   1000 0504  Nytro NWD-BLP4-800
+   1000 0507  Nytro NWD-BLP4-1600
+   1000 0581  Nytro NWD-BLP4-400
+   1000 100d  Nytro NWD-BFH6-1200
+   1000 100e  Nytro NWD-BFH8-1600
+   1000 107e  Nytro NWD-BFH8-3200
+   1000 1310  Nytro XP6302-8B1536
+   1000 1311  Nytro XP6302-8B2048
+   1000 1314  Nytro XP6302-8B4096
+   1000 150c  Nytro XP6210-4A2048
+   1000 150f  Nytro XP6210-4B2048
+   1000 160b  Nytro XP6209-4A1024
+   1000 1613  Nytro XP6209-4B2048
+   108e 050a  Nytro ELP4x200_4d_n
+   108e 0581  Nytro ELP4x100_4d_n
0080  SAS2208 PCI-Express Fusion-MPT SAS-2
0081  SAS2208 PCI-Express Fusion-MPT SAS-2
0082  SAS2208 PCI-Express Fusion-MPT SAS-2
@@ -1509,6 +1525,8 @@
6646  Bonaire XT [Radeon R9 M280X]
6647  Bonaire PRO [Radeon R9 M270X]
6649  Bonaire [FirePro W5100]
+   1002 0b0c  FirePro W4300
+   103c 0b0c  Bonaire [FirePro W4300]
6650  Bonaire
6651  Bonaire
6658  Bonaire XTX [Radeon R7 260X/360]
@@ -2085,6 +2103,7 @@
679f  Tahiti
67a0  Hawaii XT GL [FirePro W9100]
1002 0335  FirePro S9150
+   1002 0735  FirePro S9170
1028 031f  FirePro W9100
1028 0335  FirePro S9150
67a1  Hawaii PRO GL [FirePro W8100]
@@ -2094,30 +2113,53 @@
67a8  Hawaii
67a9  Hawaii
67aa  Hawaii
-   67b0  Hawaii XT [Radeon R9 290X]
+   67b0  Hawaii XT / Grenada XT [Radeon R9 290X/390X]
+   1028 0b00  Grenada XT [Radeon R9 390X]
+   103c 6566  Radeon R9 390X
1043 046a  R9 290X DirectCU II
1043 046c  R9 290X DirectCU II OC
1043 0474  Matrix R9 290X Platinum
1043 0476  ARES III
+   1043 04d7  Radeon R9 390X
+   1043 04db  Radeon R9 390X
+   1043 04df  Radeon R9 390X
+   1043 04e9  Radeon R9 390X
1458 227c  R9 290X WindForce 3X OC
1458 2281  R9 290X WindForce 3X OC
1458 228c  R9 290X WindForce 3X
1458 228d  R9 290X WindForce 3X OC
1458 2290  R9 290X WindForce 3X
+   1458 22bc  Radeon R9 390X
1458 22c1  Grenada PRO [Radeon R9 390]
+   1462 2015  Radeon R9 390X
1462 3070  R9 290X Lightning
1462 3071  R9 290X Lightning
1462 3072  R9 290X Lightning LE
1462 3080  R9 290X Gaming
1462 3082  R9 290X Gaming OC
148c 2347  Devil 13 Dual Core R9 290X
+   148c 2357  Grenada XT [Radeon R9 390X]
1682 9290  Double Dissipation R9 290X
+   1682 9395  Grenada XT [Radeon R9 390X]
+   174b 0e34  Radeon R9 390X
174b e282  Vapor-X R9 290X Tri-X OC
174b e285  R9 290X Tri-X OC
+   174b e324  Grenada XT2 [Radeon R9 390X]
1787 2020  R9 290X IceQ X² Turbo
-   67b1  Hawaii PRO [Radeon R9 290]
+   1787 2357  Grenada XT [Radeon R9 390X]
+   67b1  Hawaii PRO [Radeon R9 290/390]
+   1043 04dd  STRIX R9 390
+   148c 2358  Radeon R9 390
67b9  Vesuvius [Radeon R9 295X2]
67be  Hawaii LE
+   67c0  Ellesmere [Polaris10]
+   67df  Ellesmere [Polaris10]
+   67e0  Baffin [Polaris11]
+   67e1  Ba

Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol

2016-05-23 Thread Peter Wemm
On Thursday, May 05, 2016 10:57:16 AM Ed Maste wrote:
> On 4 May 2016 at 18:34, Alan Somers  wrote:
> > Author: asomers
> > Date: Wed May  4 22:34:11 2016
> > New Revision: 299090
> > URL: https://svnweb.freebsd.org/changeset/base/299090
> > 
> > Log:
> >   Improve performance and functionality of the bitstring(3) api
> 
> tinderbox is failing on (at least) powerpc now with:
> 
> --- all_subdir_tests ---
> cc1: warnings being treated as errors
> /scratch/tmp/emaste/freebsd/sys/kern/subr_unit.c: In function 'main':
> /scratch/tmp/emaste/freebsd/sys/kern/subr_unit.c:1029: warning: format
> '%lu' expects type 'long unsigned int', but argument 2 has type
> 'unsigned int'
> *** [subr_unit.o] Error code 1
> ___
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

It also breaks i386:

In file included from /usr/src/usr.sbin/apmd/apmd.c:36:
In file included from /usr/obj/usr/src/tmp/usr/include/bitstring.h:34:
/usr/obj/usr/src/tmp/usr/include/sys/bitstring.h:278:13: error: implicit 
declaration of function '__bitcountl' is invalid in C99 [-Werror,-Wimplicit-
function-declaration]
_value += __bitcountl(*_curbitstr & mask);
  ^


-- 
Peter Wemm - pe...@wemm.org; pe...@freebsd.org; pe...@yahoo-inc.com; KI6FJV
UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246

signature.asc
Description: This is a digitally signed message part.


Re: svn commit: r300539 - in head: . share/man/man3 sys/kern sys/sys tests/sys/sys

2016-05-23 Thread Peter Wemm
On Monday, May 23, 2016 08:29:18 PM Alan Somers wrote:
> Author: asomers
> Date: Mon May 23 20:29:18 2016
> New Revision: 300539
> URL: https://svnweb.freebsd.org/changeset/base/300539
> 
> Log:
>   Add bit_count to the bitstring(3) api
> 

(My aplogies, I replied to the wrong commit.)


This breaks i386:

In file included from /usr/src/usr.sbin/apmd/apmd.c:36:
In file included from /usr/obj/usr/src/tmp/usr/include/bitstring.h:34:
/usr/obj/usr/src/tmp/usr/include/sys/bitstring.h:278:13: error: implicit 
declaration of function '__bitcountl' is invalid in C99 [-Werror,-Wimplicit-
function-declaration]
_value += __bitcountl(*_curbitstr & mask);
...

This is coming from the inline below:

> @@ -256,4 +257,40 @@ bit_ffc(bitstr_t *_bitstr, int _nbits, i
>   bit_ffc_at(_bitstr, /*start*/0, _nbits, _result);
>  }
> 
> +/* Count the number of bits set in a bitstr of size _nbits at or after
> _start */ +static inline void
> +bit_count(bitstr_t *_bitstr, int _start, int _nbits, int *_result)
> +{
> + bitstr_t *_curbitstr, mask;
> + int _value = 0, curbitstr_len;
> +
> + if (_start >= _nbits)
> + goto out;
> +
> + _curbitstr = _bitstr + _bit_idx(_start);
> + _nbits -= _BITSTR_BITS * _bit_idx(_start);
> + _start -= _BITSTR_BITS * _bit_idx(_start);
> +
> + if (_start > 0) {
> + curbitstr_len = (int)_BITSTR_BITS < _nbits ?
> + (int)_BITSTR_BITS : _nbits;
> + mask = _bit_make_mask(_start, _bit_offset(curbitstr_len - 1));
> + _value += __bitcountl(*_curbitstr & mask);
> + _curbitstr++;
> + _nbits -= _BITSTR_BITS;
> + }
> + while (_nbits >= (int)_BITSTR_BITS) {
> + _value += __bitcountl(*_curbitstr);
> + _curbitstr++;
> + _nbits -= _BITSTR_BITS;
> + }
> + if (_nbits > 0) {
> + mask = _bit_make_mask(0, _bit_offset(_nbits - 1));
> + _value += __bitcountl(*_curbitstr & mask);
> + }
> +
> +out:
> + *_result = _value;
> +}

-- 
Peter Wemm - pe...@wemm.org; pe...@freebsd.org; pe...@yahoo-inc.com; KI6FJV
UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246

signature.asc
Description: This is a digitally signed message part.


Re: svn commit: r300539 - in head: . share/man/man3 sys/kern sys/sys tests/sys/sys

2016-05-23 Thread Alan Somers
On Mon, May 23, 2016 at 4:31 PM, Peter Wemm  wrote:

> On Monday, May 23, 2016 08:29:18 PM Alan Somers wrote:
> > Author: asomers
> > Date: Mon May 23 20:29:18 2016
> > New Revision: 300539
> > URL: https://svnweb.freebsd.org/changeset/base/300539
> >
> > Log:
> >   Add bit_count to the bitstring(3) api
> >
>
> (My aplogies, I replied to the wrong commit.)
>
>
> This breaks i386:
>
> In file included from /usr/src/usr.sbin/apmd/apmd.c:36:
> In file included from /usr/obj/usr/src/tmp/usr/include/bitstring.h:34:
> /usr/obj/usr/src/tmp/usr/include/sys/bitstring.h:278:13: error: implicit
> declaration of function '__bitcountl' is invalid in C99
> [-Werror,-Wimplicit-
> function-declaration]
> _value += __bitcountl(*_curbitstr & mask);
> ...
>

Oops.  I'll fix it.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol

2016-05-23 Thread Kurt Lidl

On 5/23/16 4:30 PM, Alan Somers wrote:

On Fri, May 6, 2016 at 8:45 AM, Kurt Lidl mailto:l...@pix.net>> wrote:

On 5/5/16 12:31 PM, John Baldwin wrote:

On Wednesday, May 04, 2016 10:34:11 PM Alan Somers wrote:

Author: asomers
Date: Wed May  4 22:34:11 2016
New Revision: 299090
URL: https://svnweb.freebsd.org/changeset/base/299090

Log:
  Improve performance and functionality of the bitstring(3) api

  Two new functions are provided, bit_ffs_at() and
bit_ffc_at(), which allow
  for efficient searching of set or cleared bits starting
from any bit offset
  within the bit string.

  Performance is improved by operating on longs instead of
bytes and using
  ffsl() for searches within a long. ffsl() is a compiler
builtin in both
  clang and gcc for most architectures, converting what was
a brute force
  while loop search into a couple of instructions.

  All of the bitstring(3) API continues to be contained in
the header file.
  Some of the functions are large enough that perhaps they
should be uninlined
  and moved to a library, but that is beyond the scope of
this commit.


Doesn't switching from bytes to longs break the ABI?  That is,
setting bit 9
now has a different representation on big-endian systems (0x00
0x01 before,
now 0x00 0x00 0x01 0x00 on 32-bit BE, and 4 more leading 0 bytes
on 64-bit).
This means you can't have an object file compiled against the
old header
pass a bitstring to an object file compiled against the new
header on big-endian
systems.

Even on little-endian systems if an old object file allocates
storage for a
bitstring the new code might read off the end of it and fault
(or return
garbage if bits are set in the extra bytes it reads off the end)?

Is the API is so little used we don't care?


Just as a note - at my prior job (Pi-Coral, now defunct) we used this
API everywhere in the dataplane code of our product.  Since the company
is gone, that particular use-case doesn't matter anymore.

At the very least, this deserves a mention in the release notes, and
also UPDATING!

-Kurt


UPDATING is updated as of r300539.  Any objection to merging this to
stable/10?


Not to me - as I mentioned, the company went out of business, so
catering to its needs is a NOP.  Go for it!

-Kurt

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


svn commit: r300543 - head/sys/amd64/amd64

2016-05-23 Thread Jung-uk Kim
Author: jkim
Date: Mon May 23 23:00:47 2016
New Revision: 300543
URL: https://svnweb.freebsd.org/changeset/base/300543

Log:
  Document POPCNT erratum for 6th Generation Intel Core processors.

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon May 23 22:01:06 2016(r300542)
+++ head/sys/amd64/amd64/pmap.c Mon May 23 23:00:47 2016(r300543)
@@ -3139,6 +3139,7 @@ retry:
  * Reference numbers for erratas are
  * 4th Gen Core: HSD146
  * 5th Gen Core: BDM85
+ * 6th Gen Core: SKL029
  */
 static int
 popcnt_pc_map_elem_pq(uint64_t elem)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol

2016-05-23 Thread Bryan Drewery
On 5/23/16 1:30 PM, Alan Somers wrote:
> UPDATING is updated as of r300539.  Any objection to merging this to
> stable/10?

If any port uses it then yes.  Binaries are built from 10.1 and expected
to work on 10.1, 10.2, 10.3, 10.4, etc.

-- 
Regards,
Bryan Drewery
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol

2016-05-23 Thread Alan Somers
On Mon, May 23, 2016 at 5:13 PM, Bryan Drewery  wrote:

> On 5/23/16 1:30 PM, Alan Somers wrote:
> > UPDATING is updated as of r300539.  Any objection to merging this to
> > stable/10?
>
> If any port uses it then yes.  Binaries are built from 10.1 and expected
> to work on 10.1, 10.2, 10.3, 10.4, etc.
>
> --
> Regards,
> Bryan Drewery
>

Most ports that use bitstring should work.  The only ports that won't are
ports that either store bitstrings on disk or transmit them across a
network without an explicit serialization step.  A few other weird cases
would break too, like building a port on 10.3, updating sys/bitstring.h,
then rebuilding some object files but not others.  Is there any way to
figure out what ports might be using this header?  OpenHub code search
didn't turn up anything.

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


Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol

2016-05-23 Thread Conrad Meyer
On Mon, May 23, 2016 at 4:34 PM, Alan Somers  wrote:
> On Mon, May 23, 2016 at 5:13 PM, Bryan Drewery  wrote:
>>
>> On 5/23/16 1:30 PM, Alan Somers wrote:
>> > UPDATING is updated as of r300539.  Any objection to merging this to
>> > stable/10?
>>
>> If any port uses it then yes.  Binaries are built from 10.1 and expected
>> to work on 10.1, 10.2, 10.3, 10.4, etc.
>
>
> Most ports that use bitstring should work.  The only ports that won't are
> ports that either store bitstrings on disk or transmit them across a network
> without an explicit serialization step.  A few other weird cases would break
> too, like building a port on 10.3, updating sys/bitstring.h, then rebuilding
> some object files but not others.  Is there any way to figure out what ports
> might be using this header?  OpenHub code search didn't turn up anything.

It seems to me like this is exactly the sort of ABI breakage the
stable/* branches promise not to make.

On the other hand, it seems to me like the majority of the benefit of
this patch could be gained without breaking ABI.  (Optimistically
iterate longs rather than bytes if the pointer's alignment is
suitable.)

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


svn commit: r300544 - in head/sys: kern sys

2016-05-23 Thread Alan Somers
Author: asomers
Date: Tue May 24 00:14:58 2016
New Revision: 300544
URL: https://svnweb.freebsd.org/changeset/base/300544

Log:
  Fix build of kern/subr_unit.c, broken by r300539
  
  Reported by:  peter
  Pointyhat to: asomers
  Sponsored by: Spectra Logic Corp

Modified:
  head/sys/kern/subr_unit.c
  head/sys/sys/bitstring.h

Modified: head/sys/kern/subr_unit.c
==
--- head/sys/kern/subr_unit.c   Mon May 23 23:00:47 2016(r300543)
+++ head/sys/kern/subr_unit.c   Tue May 24 00:14:58 2016(r300544)
@@ -984,9 +984,9 @@ main(int argc, char **argv)
struct unrhdr *uh;
char *a;
long count = 1; /* Number of unrs to test */
-   long reps = 1;
+   long reps = 1, m;
int ch;
-   u_int i, x, m, j;
+   u_int i, x, j;
 
verbose = false;
 
@@ -1043,7 +1043,7 @@ main(int argc, char **argv)
print_unrhdr(uh);
check_unrhdr(uh, __LINE__);
}
-   for (i = 0; i < count; i++) {
+   for (i = 0; i < (u_int)count; i++) {
if (a[i]) {
if (verbose) {
printf("C %u\n", i);

Modified: head/sys/sys/bitstring.h
==
--- head/sys/sys/bitstring.hMon May 23 23:00:47 2016(r300543)
+++ head/sys/sys/bitstring.hTue May 24 00:14:58 2016(r300544)
@@ -65,9 +65,10 @@
 #ifdef _KERNEL
 #include 
 #include 
-#include 
 #endif
 
+#include 
+
 typedefunsigned long bitstr_t;
 
 /*-- Private Implementation Details 
--*/
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300545 - head/usr.sbin/bsdinstall/scripts

2016-05-23 Thread Allan Jude
Author: allanjude
Date: Tue May 24 00:22:29 2016
New Revision: 300545
URL: https://svnweb.freebsd.org/changeset/base/300545

Log:
  Add support for RAID 1+0 (striped mirrors) to bsdinstall/zfsboot
  
  Sponsored by: ScaleEngine Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootTue May 24 00:14:58 2016
(r300544)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootTue May 24 00:22:29 2016
(r300545)
@@ -272,6 +272,7 @@ msg_not_enough_disks_selected="Not enoug
 msg_null_disk_argument="NULL disk argument"
 msg_null_index_argument="NULL index argument"
 msg_null_poolname="NULL poolname"
+msg_odd_disk_selected="An even number of disks must be selected to create a 
RAID 1+0. (%u selected)"
 msg_ok="OK"
 msg_partition_scheme="Partition Scheme"
 msg_partition_scheme_help="Select partitioning scheme. GPT is recommended."
@@ -284,6 +285,8 @@ msg_pool_name_help="Customize the name o
 msg_pool_type_disks="Pool Type/Disks:"
 msg_pool_type_disks_help="Choose type of ZFS Virtual Device and disks to use 
(Required)"
 msg_processing_selection="Processing selection..."
+msg_raid10_desc="RAID 1+0 - n x 2-Way Mirrors"
+msg_raid10_help="[4+ Disks] Striped Mirrors provides the best performance, but 
the least storage"
 msg_raidz1_desc="RAID-Z1 - Single Redundant RAID"
 msg_raidz1_help="[3+ Disks] Withstand failure of 1 disk. Recommended for: 3, 5 
or 9 disks"
 msg_raidz2_desc="RAID-Z2 - Double Redundant RAID"
@@ -478,6 +481,7 @@ dialog_menu_layout()
local vdev_menu_list="
'stripe' '$msg_stripe_desc' '$msg_stripe_help'
'mirror' '$msg_mirror_desc' '$msg_mirror_help'
+   'raid10' '$msg_raid10_desc' '$msg_raid10_help'
'raidz1' '$msg_raidz1_desc' '$msg_raidz1_help'
'raidz2' '$msg_raidz2_desc' '$msg_raidz2_help'
'raidz3' '$msg_raidz3_desc' '$msg_raidz3_help'
@@ -488,7 +492,7 @@ dialog_menu_layout()
 
# Warn the user if vdev type is not valid
case "$ZFSBOOT_VDEV_TYPE" in
-   stripe|mirror|raidz1|raidz2|raidz3) : known good ;;
+   stripe|mirror|raid10|raidz1|raidz2|raidz3) : known good ;;
*)
f_dprintf "%s: Invalid virtual device type \`%s'" \
  $funcname "$ZFSBOOT_VDEV_TYPE"
@@ -575,6 +579,7 @@ dialog_menu_layout()
case "$ZFSBOOT_VDEV_TYPE" in
stripe) want_disks=1 ;;
mirror) want_disks=2 ;;
+   raid10) want_disks=4 ;;
raidz1) want_disks=3 ;;
raidz2) want_disks=4 ;;
raidz3) want_disks=5 ;;
@@ -683,6 +688,21 @@ dialog_menu_layout()
  "$ZFSBOOT_DISKS"
 
f_count ndisks $ZFSBOOT_DISKS
+
+   if [ "$ZFSBOOT_VDEV_TYPE" == "raid10" ] &&
+   [ $(( $ndisks % 2 )) -ne 0 ]; then
+   f_dprintf "$funcname: %s: %s (%u %% 2 = %u)" \
+ "$ZFSBOOT_VDEV_TYPE" \
+ "Number of disks not even:" \
+ $ndisks $(( $ndisks % 2 ))
+   msg_yes="$msg_change_selection" \
+   msg_no="$msg_cancel" \
+   f_yesno "%s: $msg_odd_disk_selected" \
+   "$ZFSBOOT_VDEV_TYPE" $ndisks ||
+   break
+   continue
+   fi
+
[ $ndisks -ge $want_disks ] &&
breakout=break && break
 
@@ -1271,10 +1291,25 @@ zfs_create_boot()
#
f_dprintf "$funcname: Creating root pool..."
create_options="$ZFSBOOT_POOL_CREATE_OPTIONS"
-   f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
-   "-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \
-   "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" ||
-   return $FAILURE
+   if [ "$zroot_vdevtype" == "raid10" ]; then
+   raid10_vdevs=""
+   for vdev in $zroot_vdevs; do
+   f_count nvdev $raid10_vdevs
+   if [ $(( $nvdev % 3 )) -eq 0 ]; then
+   raid10_vdevs="$raid10_vdevs mirror"
+   fi
+   raid10_vdevs="$raid10_vdevs $vdev"
+   done
+   f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
+   "-o altroot=$BSDINSTALL_CHROOT $create_options -m none 
-f" \
+   "$zroot_name" "" "$raid10_vdevs" ||
+   return $FAILURE
+   else
+   f_eval_catch $funcnam

svn commit: r300546 - head/usr.sbin/bsdinstall/scripts

2016-05-23 Thread Allan Jude
Author: allanjude
Date: Tue May 24 00:23:39 2016
New Revision: 300546
URL: https://svnweb.freebsd.org/changeset/base/300546

Log:
  Only set kern.geom.part.mbr.enforce_chs=0 once, instead of once per disk
  
  Sponsored by: ScaleEngine Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootTue May 24 00:22:29 2016
(r300545)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootTue May 24 00:23:39 2016
(r300546)
@@ -806,7 +806,6 @@ zfs_create_diskpart()
if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then
align_small="-a 4k"
align_big="-a 1m"
-   sysctl kern.geom.part.mbr.enforce_chs=0
fi
 
case "$ZFSBOOT_PARTITION_SCHEME" in
@@ -1133,6 +1132,7 @@ zfs_create_boot()
f_dprintf "$funcname: With 4K sectors..."
f_eval_catch $funcname sysctl "$SYSCTL_ZFS_MIN_ASHIFT_12" \
|| return $FAILURE
+   sysctl kern.geom.part.mbr.enforce_chs=0
fi
local n=0
for disk in $disks; do
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300547 - in head: lib/libcam sbin/camcontrol sbin/iscontrol sys/cam usr.sbin/camdd usr.sbin/mptutil

2016-05-23 Thread Don Lewis
Author: truckman
Date: Tue May 24 00:57:11 2016
New Revision: 300547
URL: https://svnweb.freebsd.org/changeset/base/300547

Log:
  Fix multiple Coverity Out-of-bounds access false postive issues in CAM
  
  The currently used idiom for clearing the part of a ccb after its
  header generates one or two Coverity errors for each time it is
  used.  All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON)
  error because of the treatment of the header as a two element array,
  with a pointer to the non-existent second element being passed as
  the starting address to bzero().  Some instances also alsp generate
  Out-of-bounds access (OVERRUN) errors, probably because the space
  being cleared is larger than the sizeofstruct ccb_hdr).
  
  In addition, this idiom is difficult for humans to understand and
  it is error prone.  The user has to chose the proper struct ccb_*
  type (which does not appear in the surrounding code) for the sizeof()
  in the length calculation.  I found several instances where the
  length was incorrect, which could cause either an actual out of
  bounds write, or incompletely clear the ccb.
  
  A better way is to write the code to clear the ccb itself starting
  at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate
  the length based on the specific type of struct ccb_* being cleared
  as specified by the union ccb member being used.  The latter can
  normally be seen in the nearby code.  This is friendlier for Coverity
  and other static analysis tools because they will see that the
  intent is to clear the trailing part of the ccb.
  
  Wrap all of the boilerplate code in a convenient macro that only
  requires a pointer to the desired union ccb member (or a pointer
  to the union ccb itself) as an argument.
  
  Reported by:  Coverity
  CID:  1007578, 1008684, 1009724, 1009773, 1011304, 1011306
  CID:  1011307, 1011308, 1011309, 1011310, 1011311, 1011312
  CID:  1011313, 1011314, 1011315, 1011316, 1011317, 1011318
  CID:  1011319, 1011320, 1011321, 1011322, 1011324, 1011325
  CID:  1011326, 1011327, 1011328, 1011329, 1011330, 1011374
  CID:  1011390, 1011391, 1011392, 1011393, 1011394, 1011395
  CID:  1011396, 1011397, 1011398, 1011399, 1011400, 1011401
  CID:  1011402, 1011403, 1011404, 1011405, 1011406, 1011408
  CID:  1011409, 1011410, 1011411, 1011412, 1011413, 1011414
  CID:  1017461, 1018387, 1086860, 1086874, 1194257, 1229897
  CID:  1229968, 1306229, 1306234, 1331282, 1331283, 1331294
  CID:  1331295, 1331535, 1331536, 1331539, 1331540, 1341623
  CID:  1341624, 1341637, 1341638, 1355264, 1355324
  Reviewed by:  scottl, ken, delphij, imp
  MFH:  1 month
  Differential Revision:https://reviews.freebsd.org/D6496

Modified:
  head/lib/libcam/camlib.c
  head/sbin/camcontrol/attrib.c
  head/sbin/camcontrol/camcontrol.c
  head/sbin/camcontrol/fwdownload.c
  head/sbin/camcontrol/persist.c
  head/sbin/iscontrol/fsm.c
  head/sys/cam/cam_ccb.h
  head/usr.sbin/camdd/camdd.c
  head/usr.sbin/mptutil/mpt_cam.c

Modified: head/lib/libcam/camlib.c
==
--- head/lib/libcam/camlib.cTue May 24 00:23:39 2016(r300546)
+++ head/lib/libcam/camlib.cTue May 24 00:57:11 2016(r300547)
@@ -619,7 +619,7 @@ cam_real_open_device(const char *path, i
/*
 * Zero the payload, the kernel does look at the flags.
 */
-   bzero(&(&ccb.ccb_h)[1], sizeof(struct ccb_trans_settings));
+   CCB_CLEAR_ALL_EXCEPT_HDR(&ccb.cts);
 
/*
 * Get transfer settings for this device.

Modified: head/sbin/camcontrol/attrib.c
==
--- head/sbin/camcontrol/attrib.c   Tue May 24 00:23:39 2016
(r300546)
+++ head/sbin/camcontrol/attrib.c   Tue May 24 00:57:11 2016
(r300547)
@@ -137,8 +137,7 @@ scsiattrib(struct cam_device *device, in
goto bailout;
}
 
-   bzero(&(&ccb->ccb_h)[1],
- sizeof(union ccb) - sizeof(struct ccb_hdr));
+   CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
 
STAILQ_INIT(&write_attr_list);
 

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Tue May 24 00:23:39 2016
(r300546)
+++ head/sbin/camcontrol/camcontrol.c   Tue May 24 00:57:11 2016
(r300547)
@@ -842,8 +842,7 @@ scsiinquiry(struct cam_device *device, i
}
 
/* cam_getccb cleans up the header, caller has to zero the payload */
-   bzero(&(&ccb->ccb_h)[1],
- sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr));
+   CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
 
inq_buf = (struct scsi_inquiry_data *)malloc(
sizeof(struct scsi_inquiry_data));
@@ -958,8 +957,7 @@ scs

svn commit: r300548 - in head/sys: conf dev/bhnd dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/nvram dev/bhnd/siba modules/bhnd modules/bhnd/cores/bhnd_chipc

2016-05-23 Thread Adrian Chadd
Author: adrian
Date: Tue May 24 01:12:19 2016
New Revision: 300548
URL: https://svnweb.freebsd.org/changeset/base/300548

Log:
  [bhnd] Implement pass-through resource management for ChipCommon.
  
  This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY
  resources with its children, allowing us to hang devices off of
  bhnd_chipc that rely on access to a subset of the device register space
  that bhnd_chipc itself must also allocate.
  
  We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY
  wasn't limited to use with allocations at the same size/offset.
  
  As a work-around, I implemented something similar to vga_pci.c, which
  implements similar reference counting of of PCI BAR resources for its
  children.
  
  With these changes, chipc will use reference counting of SYS_RES_MEMORY
  allocation/activation requests, to decide when to allocate/activate/
  deactivate/release resources from the parent bhnd(4) bus.
  
  The requesting child device is allocated a new resource from chipc's
  rman, pointing to (possibly a subregion of) the refcounted bhnd resources
  allocated by chipc.
  
  Other resource types are just passed directly to the parent bhnd bus;
  RF_SHAREABLE works just fine with IRQs.
  
  I also lifted the SPROM device code out into a common driver, since this
  now allows me to hang simple subclasses off of a common driver off of both
  bhndb_pci and bhnd_chipc.
  
  Tested:
  
  * (landonf) Tested against BCM4331 and BCM4312, confirmed that SPROM still
attaches and can be queried.
  
  Submitted by: Landon Fuller 
  Reviewed by:  miz...@gmail.com
  Differential Revision:https://reviews.freebsd.org/D6471

Added:
  head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c   (contents, props changed)
  head/sys/dev/bhnd/cores/chipc/chipc_private.h   (contents, props changed)
  head/sys/dev/bhnd/cores/chipc/chipc_subr.c   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c
 - copied, changed from r300546, head/sys/dev/bhnd/nvram/bhnd_sprom.c
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c
  head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m
  head/sys/dev/bhnd/cores/chipc/chipc.c
  head/sys/dev/bhnd/cores/chipc/chipc.h
  head/sys/dev/bhnd/cores/chipc/chipcreg.h
  head/sys/dev/bhnd/cores/chipc/chipcvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram.h
  head/sys/dev/bhnd/nvram/bhnd_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_spromvar.h
  head/sys/dev/bhnd/siba/siba.c
  head/sys/dev/bhnd/siba/siba_subr.c
  head/sys/dev/bhnd/siba/sibavar.h
  head/sys/modules/bhnd/Makefile
  head/sys/modules/bhnd/cores/bhnd_chipc/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue May 24 00:57:11 2016(r300547)
+++ head/sys/conf/files Tue May 24 01:12:19 2016(r300548)
@@ -1139,7 +1139,9 @@ dev/bhnd/bcma/bcma_bhndb.coptional bhn
 dev/bhnd/bcma/bcma_erom.c  optional bhndbus | bcma
 dev/bhnd/bcma/bcma_subr.c  optional bhndbus | bcma
 dev/bhnd/cores/chipc/chipc.c   optional bhndbus | bhnd
+dev/bhnd/cores/chipc/chipc_subr.c  optional bhndbus | bhnd
 dev/bhnd/cores/chipc/bhnd_chipc_if.m   optional bhndbus | bhnd
+dev/bhnd/cores/chipc/bhnd_sprom_chipc.coptional bhndbus | bhnd
 dev/bhnd/cores/pci/bhnd_pci.c  optional bhndbus pci | bhnd pci
 dev/bhnd/cores/pci/bhnd_pci_hostb.coptional bhndbus pci | bhndb pci
 dev/bhnd/cores/pci/bhnd_pcib.c optional bhnd_pcib bhnd pci
@@ -1148,6 +1150,7 @@ dev/bhnd/cores/pcie2/bhnd_pcie2_hostb.c   
 dev/bhnd/cores/pcie2/bhnd_pcie2b.c optional bhnd_pcie2b bhnd pci
 dev/bhnd/nvram/bhnd_nvram_if.m optional bhndbus | bhnd
 dev/bhnd/nvram/bhnd_sprom.coptional bhndbus | bhnd
+dev/bhnd/nvram/bhnd_sprom_subr.c   optional bhndbus | bhnd
 dev/bhnd/nvram/nvram_subr.coptional bhndbus | bhnd
 dev/bhnd/siba/siba.c   optional bhndbus | siba
 dev/bhnd/siba/siba_bhndb.c optional bhndbus | siba bhndb

Modified: head/sys/dev/bhnd/bhnd_subr.c
==
--- head/sys/dev/bhnd/bhnd_subr.c   Tue May 24 00:57:11 2016
(r300547)
+++ head/sys/dev/bhnd/bhnd_subr.c   Tue May 24 01:12:19 2016
(r300548)
@@ -797,11 +797,11 @@ bhnd_parse_chipid(uint32_t idreg, bhnd_a
struct bhnd_chipid result;
 
/* Fetch the basic chip info */
-   result.chip_id = CHIPC_GET_ATTR(idreg, ID_CHIP);
-   result.chip_pkg = CHIPC_GET_ATTR(idreg, ID_PKG);
-   result.chip_rev = CHIPC_GET_ATTR(idreg, ID_REV);
-   result.chip_type = CHIPC_GET_ATTR(idreg, ID_BUS);
-   result.ncores = CHIPC_GET_ATTR(idreg, ID_NUMCORE);
+   result.chip_id = CHIPC_GET_BITS(idreg, CHIPC_ID_CHIP);
+   result.chip_pkg = CHIPC_GET_BITS(idreg, CHIPC_ID_PKG);
+   result.chip_rev = CHIPC_

svn commit: r300549 - head/sys/dev/bwn

2016-05-23 Thread Adrian Chadd
Author: adrian
Date: Tue May 24 01:20:30 2016
New Revision: 300549
URL: https://svnweb.freebsd.org/changeset/base/300549

Log:
  [bwn] add extra debugging for non-SIBA devices.
  
  This is a no-op at the present moment, but will eventually remind me
  where the SIBA specific demons lie.
  
  Tested:
  
  * BCM4322, STA mode

Modified:
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/bwn/if_bwn_phy_common.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Tue May 24 01:12:19 2016(r300548)
+++ head/sys/dev/bwn/if_bwn.c   Tue May 24 01:20:30 2016(r300549)
@@ -4712,11 +4712,9 @@ bwn_rf_turnoff(struct bwn_mac *mac)
 
 /*
  * SSB PHY reset.
- *
- * XXX TODO: BCMA PHY reset.
  */
 static void
-bwn_phy_reset(struct bwn_mac *mac)
+bwn_phy_reset_siba(struct bwn_mac *mac)
 {
struct bwn_softc *sc = mac->mac_sc;
 
@@ -4729,6 +4727,17 @@ bwn_phy_reset(struct bwn_mac *mac)
DELAY(1000);
 }
 
+static void
+bwn_phy_reset(struct bwn_mac *mac)
+{
+
+   if (bwn_is_bus_siba(mac)) {
+   bwn_phy_reset_siba(mac);
+   } else {
+   BWN_ERRPRINTF(mac->mac_sc, "%s: unknown bus!\n", __func__);
+   }
+}
+
 static int
 bwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
 {

Modified: head/sys/dev/bwn/if_bwn_phy_common.c
==
--- head/sys/dev/bwn/if_bwn_phy_common.cTue May 24 01:12:19 2016
(r300548)
+++ head/sys/dev/bwn/if_bwn_phy_common.cTue May 24 01:20:30 2016
(r300549)
@@ -157,6 +157,8 @@ bwn_phy_force_clock(struct bwn_mac *mac,
else
tmp &= ~SIBA_TGSLOW_FGC;
siba_write_4(sc->sc_dev, SIBA_TGSLOW, tmp);
+   } else {
+   BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__);
}
 }
 
@@ -190,6 +192,8 @@ bwn_mac_phy_clock_set(struct bwn_mac *ma
else
val &= ~BWN_TGSLOW_MACPHYCLKEN;
siba_write_4(sc->sc_dev, SIBA_TGSLOW, val);
+   } else {
+   BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__);
}
 }
 
@@ -205,5 +209,7 @@ bwn_wireless_core_phy_pll_reset(struct b
siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4);
siba_cc_set32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, 0x4);
siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4);
+   } else {
+   BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__);
}
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300550 - in head/sys: conf dev/iicbus dev/ofw

2016-05-23 Thread Luiz Otavio O Souza
Author: loos
Date: Tue May 24 01:33:49 2016
New Revision: 300550
URL: https://svnweb.freebsd.org/changeset/base/300550

Log:
  Move the OFW iicbus code to dev/iicbus to stop polluting dev/ofw with
  unrelated code.
  
  Discussed with:   nwhitehorn (a long time ago)

Added:
  head/sys/dev/iicbus/ofw_iicbus.c
 - copied unchanged from r300549, head/sys/dev/ofw/ofw_iicbus.c
Deleted:
  head/sys/dev/ofw/ofw_iicbus.c
Modified:
  head/sys/conf/files
  head/sys/conf/files.powerpc

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue May 24 01:20:30 2016(r300549)
+++ head/sys/conf/files Tue May 24 01:33:49 2016(r300550)
@@ -1575,6 +1575,7 @@ dev/iicbus/iicsmb.c   optional iicsmb 

dependency  "iicbus_if.h"
 dev/iicbus/iicoc.c optional iicoc
 dev/iicbus/lm75.c  optional lm75
+dev/iicbus/ofw_iicbus.coptional fdt iicbus
 dev/iicbus/pcf8563.c   optional pcf8563
 dev/iicbus/s35390a.c   optional s35390a
 dev/iir/iir.c  optional iir
@@ -2174,7 +2175,6 @@ dev/ofw/ofw_bus_if.m  optional fdt
 dev/ofw/ofw_bus_subr.c optional fdt
 dev/ofw/ofw_fdt.c  optional fdt
 dev/ofw/ofw_if.m   optional fdt
-dev/ofw/ofw_iicbus.c   optional fdt iicbus
 dev/ofw/ofw_subr.c optional fdt
 dev/ofw/ofwbus.c   optional fdt
 dev/ofw/openfirm.c optional fdt

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Tue May 24 01:20:30 2016(r300549)
+++ head/sys/conf/files.powerpc Tue May 24 01:33:49 2016(r300550)
@@ -44,6 +44,7 @@ dev/iicbus/adt746x.c  optionalad
 dev/iicbus/ds1631.coptionalds1631 powermac
 dev/iicbus/ds1775.coptionalds1775 powermac
 dev/iicbus/max6690.c   optionalmax6690 powermac
+dev/iicbus/ofw_iicbus.coptionaliicbus aim
 dev/nand/nfc_fsl.c optionalnand mpc85xx
 dev/nand/nfc_rb.c  optionalnand mpc85xx
 # ofw can be either aim or fdt: fdt case handled in files. aim only powerpc 
specific.
@@ -55,7 +56,6 @@ dev/ofw/ofw_if.m  optionalaim
 dev/ofw/ofw_bus_subr.c optionalaim
 dev/ofw/ofw_console.c  optionalaim
 dev/ofw/ofw_disk.c optionalofwd aim
-dev/ofw/ofw_iicbus.c   optionaliicbus aim
 dev/ofw/ofwbus.c   optionalaim | fdt
 dev/ofw/ofwpci.c   optionalpci
 dev/ofw/ofw_standard.c optionalaim powerpc

Copied: head/sys/dev/iicbus/ofw_iicbus.c (from r300549, 
head/sys/dev/ofw/ofw_iicbus.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iicbus/ofw_iicbus.cTue May 24 01:33:49 2016
(r300550, copy of r300549, head/sys/dev/ofw/ofw_iicbus.c)
@@ -0,0 +1,238 @@
+/*-
+ * Copyright (c) 2009, Nathan Whitehorn 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "iicbus_if.h"
+
+/* Methods */
+static device_probe_t ofw_iicbus_probe;
+static device_attach_t ofw_iicbus_attach;
+static device_t ofw_iicbus_add_child(device_t dev, u_int order,
+const char *name, int unit);
+static const struct ofw_bus_

svn commit: r300551 - head/sys/dev/ciss

2016-05-23 Thread Sean Bruno
Author: sbruno
Date: Tue May 24 01:42:21 2016
New Revision: 300551
URL: https://svnweb.freebsd.org/changeset/base/300551

Log:
  Update some of the TBD entries in ciss(4) to match what's in the pci
  IDS data.
  
  Submitted by: Dmitry Luhtionov 
  MFC after:2 weeks

Modified:
  head/sys/dev/ciss/ciss.c

Modified: head/sys/dev/ciss/ciss.c
==
--- head/sys/dev/ciss/ciss.cTue May 24 01:33:49 2016(r300550)
+++ head/sys/dev/ciss/ciss.cTue May 24 01:42:21 2016(r300551)
@@ -345,21 +345,22 @@ static struct
 { 0x103C, 0x1928, CISS_BOARD_SA5,   "HP Smart Array P230i" },
 { 0x103C, 0x1929, CISS_BOARD_SA5,   "HP Smart Array P530" },
 { 0x103C, 0x192A, CISS_BOARD_SA5,   "HP Smart Array P531" },
-{ 0x103C, 0x21BD, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21BE, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21BF, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21C0, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21C2, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21C3, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21C5, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21C6, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21C7, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21C8, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21CA, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21CB, CISS_BOARD_SA5,   "HP Smart Array TBD" },
+{ 0x103C, 0x21BD, CISS_BOARD_SA5,   "HP Smart Array P244br" },
+{ 0x103C, 0x21BE, CISS_BOARD_SA5,   "HP Smart Array P741m" },
+{ 0x103C, 0x21BF, CISS_BOARD_SA5,   "HP Smart Array H240ar" },
+{ 0x103C, 0x21C0, CISS_BOARD_SA5,   "HP Smart Array P440ar" },
+{ 0x103C, 0x21C1, CISS_BOARD_SA5,   "HP Smart Array P840ar" },
+{ 0x103C, 0x21C2, CISS_BOARD_SA5,   "HP Smart Array P440" },
+{ 0x103C, 0x21C3, CISS_BOARD_SA5,   "HP Smart Array P441" },
+{ 0x103C, 0x21C5, CISS_BOARD_SA5,   "HP Smart Array P841" },
+{ 0x103C, 0x21C6, CISS_BOARD_SA5,   "HP Smart Array H244br" },
+{ 0x103C, 0x21C7, CISS_BOARD_SA5,   "HP Smart Array H240" },
+{ 0x103C, 0x21C8, CISS_BOARD_SA5,   "HP Smart Array H241" },
+{ 0x103C, 0x21CA, CISS_BOARD_SA5,   "HP Smart Array P246br" },
+{ 0x103C, 0x21CB, CISS_BOARD_SA5,   "HP Smart Array P840" },
 { 0x103C, 0x21CC, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21CD, CISS_BOARD_SA5,   "HP Smart Array TBD" },
-{ 0x103C, 0x21CE, CISS_BOARD_SA5,   "HP Smart Array TBD" },
+{ 0x103C, 0x21CD, CISS_BOARD_SA5,   "HP Smart Array P240nr" },
+{ 0x103C, 0x21CE, CISS_BOARD_SA5,   "HP Smart Array H240nr" },
 { 0, 0, 0, NULL }
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300547 - in head: lib/libcam sbin/camcontrol sbin/iscontrol sys/cam usr.sbin/camdd usr.sbin/mptutil

2016-05-23 Thread Don Lewis
On 24 May, To: src-committ...@freebsd.org wrote:
> Author: truckman
> Date: Tue May 24 00:57:11 2016
> New Revision: 300547
> URL: https://svnweb.freebsd.org/changeset/base/300547
> 
> Log:
>   Fix multiple Coverity Out-of-bounds access false postive issues in CAM
>   
>   The currently used idiom for clearing the part of a ccb after its
>   header generates one or two Coverity errors for each time it is
>   used.  All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON)
>   error because of the treatment of the header as a two element array,
>   with a pointer to the non-existent second element being passed as
>   the starting address to bzero().  Some instances also alsp generate
>   Out-of-bounds access (OVERRUN) errors, probably because the space
>   being cleared is larger than the sizeofstruct ccb_hdr).
>   
>   In addition, this idiom is difficult for humans to understand and
>   it is error prone.  The user has to chose the proper struct ccb_*
>   type (which does not appear in the surrounding code) for the sizeof()
>   in the length calculation.  I found several instances where the
>   length was incorrect, which could cause either an actual out of
>   bounds write, or incompletely clear the ccb.
>   
>   A better way is to write the code to clear the ccb itself starting
>   at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate
>   the length based on the specific type of struct ccb_* being cleared
>   as specified by the union ccb member being used.  The latter can
>   normally be seen in the nearby code.  This is friendlier for Coverity
>   and other static analysis tools because they will see that the
>   intent is to clear the trailing part of the ccb.
>   
>   Wrap all of the boilerplate code in a convenient macro that only
>   requires a pointer to the desired union ccb member (or a pointer
>   to the union ccb itself) as an argument.

[snip]   

>   Reviewed by:scottl, ken, delphij, imp
>   MFH:1 month
>   Differential Revision:  https://reviews.freebsd.org/D6496


grr ... that should be:
MFC after:  1 month

This mistake is too easy to make ...

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


svn commit: r300556 - in head: sys/kern tests/sys/aio

2016-05-23 Thread John Baldwin
Author: jhb
Date: Tue May 24 03:13:27 2016
New Revision: 300556
URL: https://svnweb.freebsd.org/changeset/base/300556

Log:
  Don't prematurely return short completions on blocking sockets.
  
  Always requeue an AIO job at the head of the socket buffer's queue if
  sosend() or soreceive() returns EWOULDBLOCK on a blocking socket.
  Previously, requests were only requeued if they returned EWOULDBLOCK
  and completed no data.  Now after a partial completion on a blocking
  socket the request is queued and the remaining request is retried when
  the socket is ready.  This allows writes larger than the currently
  available space on a blocking socket to fully complete.  Reads on a
  blocking socket that satifsy the low watermark can still return a short
  read (same as read()).
  
  In order to track previously completed data, the internal 'status'
  field of the AIO job is used to store the amount of previously
  computed data.
  
  Non-blocking sockets continue to return short completions for both
  reads and writes.
  
  Add a test for a "large" AIO write on a blocking socket that writes
  twice the socket buffer size to a UNIX domain socket.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/kern/sys_socket.c
  head/tests/sys/aio/aio_test.c

Modified: head/sys/kern/sys_socket.c
==
--- head/sys/kern/sys_socket.c  Tue May 24 03:08:32 2016(r300555)
+++ head/sys/kern/sys_socket.c  Tue May 24 03:13:27 2016(r300556)
@@ -556,7 +556,7 @@ soaio_process_job(struct socket *so, str
struct file *fp;
struct uio uio;
struct iovec iov;
-   size_t cnt;
+   size_t cnt, done;
int error, flags;
 
SOCKBUF_UNLOCK(sb);
@@ -567,8 +567,9 @@ retry:
td_savedcred = td->td_ucred;
td->td_ucred = job->cred;
 
-   cnt = job->uaiocb.aio_nbytes;
-   iov.iov_base = (void *)(uintptr_t)job->uaiocb.aio_buf;
+   done = job->uaiocb._aiocb_private.status;
+   cnt = job->uaiocb.aio_nbytes - done;
+   iov.iov_base = (void *)((uintptr_t)job->uaiocb.aio_buf + done);
iov.iov_len = cnt;
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
@@ -602,42 +603,52 @@ retry:
}
}
 
-   cnt -= uio.uio_resid;
+   done += cnt - uio.uio_resid;
+   job->uaiocb._aiocb_private.status = done;
td->td_ucred = td_savedcred;
 
-   if (cnt != 0 && (error == ERESTART || error == EINTR ||
-   error == EWOULDBLOCK))
-   error = 0;
if (error == EWOULDBLOCK) {
/*
-* A read() or write() on the socket raced with this
-* request.  If the socket is now ready, try again.
-* If it is not, place this request at the head of the
+* The request was either partially completed or not
+* completed at all due to racing with a read() or
+* write() on the socket.  If the socket is
+* non-blocking, return with any partial completion.
+* If the socket is blocking or if no progress has
+* been made, requeue this request at the head of the
 * queue to try again when the socket is ready.
 */
-   SOCKBUF_LOCK(sb);   
-   empty_results++;
-   if (soaio_ready(so, sb)) {
-   empty_retries++;
-   SOCKBUF_UNLOCK(sb);
-   goto retry;
-   }
-
-   if (!aio_set_cancel_function(job, soo_aio_cancel)) {
-   MPASS(cnt == 0);
-   SOCKBUF_UNLOCK(sb);
-   aio_cancel(job);
-   SOCKBUF_LOCK(sb);
-   } else {
-   TAILQ_INSERT_HEAD(&sb->sb_aiojobq, job, list);
-   }
-   } else {
-   if (error)
-   aio_complete(job, -1, error);
-   else
-   aio_complete(job, cnt, 0);
+   MPASS(done != job->uaiocb.aio_nbytes);
SOCKBUF_LOCK(sb);
-   }
+   if (done == 0 || !(so->so_state & SS_NBIO)) {
+   empty_results++;
+   if (soaio_ready(so, sb)) {
+   empty_retries++;
+   SOCKBUF_UNLOCK(sb);
+   goto retry;
+   }
+   
+   if (!aio_set_cancel_function(job, soo_aio_cancel)) {
+   SOCKBUF_UNLOCK(sb);
+   if (done != 0)
+   aio_complete(job, done, 0);
+   else
+   aio_cancel(job);
+   SOCKBUF_LOCK(sb);
+   } else {
+  

svn commit: r300557 - head/usr.sbin/apmd

2016-05-23 Thread Peter Wemm
Author: peter
Date: Tue May 24 03:15:46 2016
New Revision: 300557
URL: https://svnweb.freebsd.org/changeset/base/300557

Log:
  It seems  is a new prerequisite for  after
  r300539. Attempt to fix the build for i386.

Modified:
  head/usr.sbin/apmd/apmd.c
  head/usr.sbin/apmd/apmdlex.l
  head/usr.sbin/apmd/apmdparse.y

Modified: head/usr.sbin/apmd/apmd.c
==
--- head/usr.sbin/apmd/apmd.c   Tue May 24 03:13:27 2016(r300556)
+++ head/usr.sbin/apmd/apmd.c   Tue May 24 03:15:46 2016(r300557)
@@ -32,6 +32,7 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
+#include 
 #include 
 #include 
 #include 
@@ -45,7 +46,6 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/usr.sbin/apmd/apmdlex.l
==
--- head/usr.sbin/apmd/apmdlex.lTue May 24 03:13:27 2016
(r300556)
+++ head/usr.sbin/apmd/apmdlex.lTue May 24 03:15:46 2016
(r300557)
@@ -30,6 +30,7 @@
  * $FreeBSD$
  */
 
+#include 
 #include 
 #include 
 #include 

Modified: head/usr.sbin/apmd/apmdparse.y
==
--- head/usr.sbin/apmd/apmdparse.y  Tue May 24 03:13:27 2016
(r300556)
+++ head/usr.sbin/apmd/apmdparse.y  Tue May 24 03:15:46 2016
(r300557)
@@ -30,6 +30,7 @@
  * $FreeBSD$
  */
 
+#include 
 #include 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300548 - in head/sys: conf dev/bhnd dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/nvram dev/bhnd/siba modules/bhnd modules/bhnd/cores/bhnd_chipc

2016-05-23 Thread John Baldwin
On Tuesday, May 24, 2016 01:12:19 AM Adrian Chadd wrote:
> Author: adrian
> Date: Tue May 24 01:12:19 2016
> New Revision: 300548
> URL: https://svnweb.freebsd.org/changeset/base/300548
> 
> Log:
>   [bhnd] Implement pass-through resource management for ChipCommon.
>   
>   This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY
>   resources with its children, allowing us to hang devices off of
>   bhnd_chipc that rely on access to a subset of the device register space
>   that bhnd_chipc itself must also allocate.
>   
>   We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY
>   wasn't limited to use with allocations at the same size/offset.
>   
>   As a work-around, I implemented something similar to vga_pci.c, which
>   implements similar reference counting of of PCI BAR resources for its
>   children.
>   
>   With these changes, chipc will use reference counting of SYS_RES_MEMORY
>   allocation/activation requests, to decide when to allocate/activate/
>   deactivate/release resources from the parent bhnd(4) bus.
>   
>   The requesting child device is allocated a new resource from chipc's
>   rman, pointing to (possibly a subregion of) the refcounted bhnd resources
>   allocated by chipc.
>   
>   Other resource types are just passed directly to the parent bhnd bus;
>   RF_SHAREABLE works just fine with IRQs.
>   
>   I also lifted the SPROM device code out into a common driver, since this
>   now allows me to hang simple subclasses off of a common driver off of both
>   bhndb_pci and bhnd_chipc.

Hmm, what the PCI-PCI bridge driver does with NEW_PCIB is to allocate a single
resource from its parent bus for each I/O window it decodes.  It then creates
a rman that is populated with the addresses in that resource and suballocates
from that rman.  This allows child devices to allocate non-overlapping resources
exclusively (they could also do shareable mappings for subsets if applicable).

Right now NEW_PCIB assumes it can pass one of these "child" resources up to the
nexus to have it "mapped" via bus_activate_resource().  However, the recently
added bus_map_resource() provides a cleaner way to do this where a bridge device
can request a mapping for the sub-range of the resource on its "upstream"
side that corresponds to the range used by a resource for a child device.

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


Re: svn commit: r300557 - head/usr.sbin/apmd

2016-05-23 Thread Alan Somers
On Mon, May 23, 2016 at 9:15 PM, Peter Wemm  wrote:

> Author: peter
> Date: Tue May 24 03:15:46 2016
> New Revision: 300557
> URL: https://svnweb.freebsd.org/changeset/base/300557
>
> Log:
>   It seems  is a new prerequisite for  after
>   r300539. Attempt to fix the build for i386.
>
> Modified:
>   head/usr.sbin/apmd/apmd.c
>   head/usr.sbin/apmd/apmdlex.l
>   head/usr.sbin/apmd/apmdparse.y
>
>
Are you sure this is necessary, even after 300544?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r299090 - in head: etc/mtree include lib/libbluetooth sbin/hastd share/man/man3 sys/dev/xen/blkback sys/kern sys/net sys/sys tests/sys tests/sys/sys usr.sbin/bluetooth/hccontrol

2016-05-23 Thread Bryan Drewery
On 5/23/16 4:42 PM, Conrad Meyer wrote:
> On Mon, May 23, 2016 at 4:34 PM, Alan Somers  wrote:
>> On Mon, May 23, 2016 at 5:13 PM, Bryan Drewery  wrote:
>>>
>>> On 5/23/16 1:30 PM, Alan Somers wrote:
 UPDATING is updated as of r300539.  Any objection to merging this to
 stable/10?
>>>
>>> If any port uses it then yes.  Binaries are built from 10.1 and expected
>>> to work on 10.1, 10.2, 10.3, 10.4, etc.
>>
>>
>> Most ports that use bitstring should work.  The only ports that won't are
>> ports that either store bitstrings on disk or transmit them across a network
>> without an explicit serialization step.  A few other weird cases would break
>> too, like building a port on 10.3, updating sys/bitstring.h, then rebuilding
>> some object files but not others.  Is there any way to figure out what ports
>> might be using this header?  OpenHub code search didn't turn up anything.
> 
> It seems to me like this is exactly the sort of ABI breakage the
> stable/* branches promise not to make.

I just noticed that this is not a library. It's only macros. So I take
back what I said.


-- 
Regards,
Bryan Drewery
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300562 - head/sys/dev/bwn

2016-05-23 Thread Adrian Chadd
Author: adrian
Date: Tue May 24 04:55:00 2016
New Revision: 300562
URL: https://svnweb.freebsd.org/changeset/base/300562

Log:
  [bwn] add BCM43225 to the BHND device list.
  
  This is all for the bhnd(4) work in progress.  It's enough to probe/attach
  all the bhnd internals, but we're missing OTP support and some cleanup
  code.  And, well, all the rest of the bhnd(4) migration.
  
  So no, this won't give you BCM43225 support.  Sorry!

Modified:
  head/sys/dev/bwn/if_bwn_pci.c

Modified: head/sys/dev/bwn/if_bwn_pci.c
==
--- head/sys/dev/bwn/if_bwn_pci.c   Tue May 24 04:49:58 2016
(r300561)
+++ head/sys/dev/bwn/if_bwn_pci.c   Tue May 24 04:55:00 2016
(r300562)
@@ -104,6 +104,7 @@ static const struct bwn_pci_device bcma_
BWN_BCM_DEV(BCM4331_D11N,   "BCM4331 802.11n Dual-Band",0),
BWN_BCM_DEV(BCM4331_D11N2G, "BCM4331 802.11n 2GHz", 0),
BWN_BCM_DEV(BCM4331_D11N5G, "BCM4331 802.11n 5GHz", 0),
+   BWN_BCM_DEV(BCM43225_D11N2G,"BCM43225 802.11n 2GHz",0),
 
{ 0, 0, NULL, 0}
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300563 - head/sys/dev/bwn

2016-05-23 Thread Adrian Chadd
Author: adrian
Date: Tue May 24 04:58:58 2016
New Revision: 300563
URL: https://svnweb.freebsd.org/changeset/base/300563

Log:
  [bwn] begin separating out the attach path from the SIBA specific bits.
  
  * convert phy_getinfo() to take a "gmode" flag, rather than the siba
TGSHIGH flags and then check for 2GHz.  This should ensure that
gmode is set correctly even on DUALPHY NICs.
  * move the siba_powerup() call and the TGSHIGH decoding into a
call to bwn_is_bus_siba(), and return an error if it's called
on anything else.  We don't yet do anything else, but when we do..
  
  Tested:
  
  * BCM4322, 11a STA

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Tue May 24 04:55:00 2016(r300562)
+++ head/sys/dev/bwn/if_bwn.c   Tue May 24 04:58:58 2016(r300563)
@@ -1148,46 +1148,41 @@ bwn_attach_core(struct bwn_mac *mac)
 {
struct bwn_softc *sc = mac->mac_sc;
int error, have_bg = 0, have_a = 0;
-   uint32_t high;
 
KASSERT(siba_get_revid(sc->sc_dev) >= 5,
("unsupported revision %d", siba_get_revid(sc->sc_dev)));
 
-   siba_powerup(sc->sc_dev, 0);
+   if (bwn_is_bus_siba(mac)) {
+   uint32_t high;
 
-   high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
+   siba_powerup(sc->sc_dev, 0);
+   high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
+   have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
+   have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
+   if (high & BWN_TGSHIGH_DUALPHY) {
+   have_bg = 1;
+   have_a = 1;
+   }
+   } else {
+   device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__);
+   error = ENXIO;
+   goto fail;
+   }
 
/*
 * Guess at whether it has A-PHY or G-PHY.
 * This is just used for resetting the core to probe things;
 * we will re-guess once it's all up and working.
-*
-* XXX TODO: there's the TGSHIGH DUALPHY flag based on
-* the PHY revision.
 */
-   bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ));
+   bwn_reset_core(mac, have_bg);
 
/*
 * Get the PHY version.
 */
-   error = bwn_phy_getinfo(mac, high);
+   error = bwn_phy_getinfo(mac, have_bg);
if (error)
goto fail;
 
-   /* XXX TODO need bhnd */
-   if (bwn_is_bus_siba(mac)) {
-   have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
-   have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
-   if (high & BWN_TGSHIGH_DUALPHY) {
-   have_bg = 1;
-   have_a = 1;
-   }
-   } else {
-   device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__);
-   error = ENXIO;
-   goto fail;
-   }
-
 #if 0
device_printf(sc->sc_dev, "%s: high=0x%08x, have_a=%d, have_bg=%d,"
" deviceid=0x%04x, siba_deviceid=0x%04x\n",
@@ -1379,7 +1374,7 @@ bwn_reset_core(struct bwn_mac *mac, int 
 }
 
 static int
-bwn_phy_getinfo(struct bwn_mac *mac, int tgshigh)
+bwn_phy_getinfo(struct bwn_mac *mac, int gmode)
 {
struct bwn_phy *phy = &mac->mac_phy;
struct bwn_softc *sc = mac->mac_sc;
@@ -1387,7 +1382,7 @@ bwn_phy_getinfo(struct bwn_mac *mac, int
 
/* PHY */
tmp = BWN_READ_2(mac, BWN_PHYVER);
-   phy->gmode = !! (tgshigh & BWN_TGSHIGH_HAVE_2GHZ);
+   phy->gmode = gmode;
phy->rf_on = 1;
phy->analog = (tmp & BWN_PHYVER_ANALOG) >> 12;
phy->type = (tmp & BWN_PHYVER_TYPE) >> 8;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300564 - head/usr.sbin/pw

2016-05-23 Thread Don Lewis
Author: truckman
Date: Tue May 24 05:02:24 2016
New Revision: 300564
URL: https://svnweb.freebsd.org/changeset/base/300564

Log:
  Fix CID 1006692 in /usr/sbin/pw pw_log() function and other fixes
  
  The length of the name returned from the $LOGNAME and $USER can be
  very long and it was being concatenated to a fixed length buffer
  with no bounds checking.  Fix this problem by limiting the length
  of the name copied.
  
  Additionally, this name is actually used to create a format string
  to be used in adding log file entries so embedded % characters in
  the name could confuse *printf(), and embedded whitespace could
  confuse a log file parser.  Handle the former by escaping each %
  with an additional %, and handle the latter by simply stripping it
  out.
  
  Clean up the code by moving the variable declarations to the top
  of the function, formatting them to conform with style, and moving
  intialization elsewhere.
  
  Reduce code indentation by returning early in a couple of places.
  
  Reported by:  Coverity
  CID:  1006692
  Reviewed by:  markj (previous version)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D6490

Modified:
  head/usr.sbin/pw/pw_log.c

Modified: head/usr.sbin/pw/pw_log.c
==
--- head/usr.sbin/pw/pw_log.c   Tue May 24 04:58:58 2016(r300563)
+++ head/usr.sbin/pw/pw_log.c   Tue May 24 05:02:24 2016(r300564)
@@ -29,40 +29,90 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
+#include 
+#include 
 #include 
 #include 
 #include 
 
 #include "pw.h"
 
-static FILE*logfile = NULL;
+static FILE*logfile = NULL;
 
 void
 pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...)
 {
-   if (cnf->logfile && *cnf->logfile) {
-   if (logfile == NULL) {  /* With umask==0 we need to control 
file access modes on create */
-   int fd = open(cnf->logfile, O_WRONLY | 
O_CREAT | O_APPEND, 0600);
+   va_list argp;
+   time_t  now;
+   const char  *cp, *name;
+   struct tm   *t;
+   int fd, i, rlen;
+   charnfmt[256], sname[32];
 
-   if (fd != -1)
-   logfile = fdopen(fd, "a");
+   if (cnf->logfile == NULL || cnf->logfile[0] == '\0') {
+   return;
+   }
+
+   if (logfile == NULL) {
+   /* With umask==0 we need to control file access modes on create 
*/
+   fd = open(cnf->logfile, O_WRONLY | O_CREAT | O_APPEND, 0600);
+   if (fd == -1) {
+   return;
}
-   if (logfile != NULL) {
-   va_list argp;
-   time_t  now = time(NULL);
-   struct tm  *t = localtime(&now);
-   charnfmt[256];
-   const char *name;
-
-   if ((name = getenv("LOGNAME")) == NULL && (name = 
getenv("USER")) == NULL)
-   name = "unknown";
-   /* ISO 8601 International Standard Date format */
-   strftime(nfmt, sizeof nfmt, "%Y-%m-%d %T ", t);
-   sprintf(nfmt + strlen(nfmt), "[%s:%s%s] %s\n", name, 
Which[which], Modes[mode], fmt);
-   va_start(argp, fmt);
-   vfprintf(logfile, nfmt, argp);
-   va_end(argp);
-   fflush(logfile);
+   logfile = fdopen(fd, "a");
+   if (logfile == NULL) {
+   return;
}
}
+
+   if ((name = getenv("LOGNAME")) == NULL &&
+   (name = getenv("USER")) == NULL) {
+   strcpy(sname, "unknown");
+   } else {
+   /*
+* Since "name" will be embedded in a printf-like format,
+* we must sanitize it:
+*
+*Limit its length so other information in the message
+*is not truncated
+*
+*Squeeze out embedded whitespace for the benefit of
+*log file parsers
+*
+*Escape embedded % characters with another %
+*/
+   for (i = 0, cp = name;
+   *cp != '\0' && i < (int)sizeof(sname) - 1; cp++) {
+   if (*cp == '%') {
+   if (i < (int)sizeof(sname) - 2) {
+   sname[i++] = '%';
+   sname[i++] = '%';
+   } else {
+   break;
+   }
+   } else if (!isspace(*cp)) {
+   sname[i++] = *cp;
+

svn commit: r300565 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Tue May 24 05:06:01 2016
New Revision: 300565
URL: https://svnweb.freebsd.org/changeset/base/300565

Log:
  hyperv/vmbus: Move vmbus interrupt counter into vmbus softc
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6497

Modified:
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:02:24 
2016(r300564)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:06:01 
2016(r300565)
@@ -186,12 +186,11 @@ hv_vmbus_isr(struct trapframe *frame)
return (FILTER_HANDLED);
 }
 
-u_long *hv_vmbus_intr_cpu[MAXCPU];
-
 void
 hv_vector_handler(struct trapframe *trap_frame)
 {
-   int cpu;
+   struct vmbus_softc *sc = vmbus_get_softc();
+   int cpu = curcpu;
 
/*
 * Disable preemption.
@@ -201,8 +200,7 @@ hv_vector_handler(struct trapframe *trap
/*
 * Do a little interrupt counting.
 */
-   cpu = PCPU_GET(cpuid);
-   (*hv_vmbus_intr_cpu[cpu])++;
+   (*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++;
 
hv_vmbus_isr(trap_frame);
 
@@ -400,7 +398,7 @@ vmbus_bus_init(void)
 
CPU_FOREACH(j) {
snprintf(buf, sizeof(buf), "cpu%d:hyperv", j);
-   intrcnt_add(buf, &hv_vmbus_intr_cpu[j]);
+   intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, j));
 
for (i = 0; i < 2; i++)
setup_args.page_buffers[2 * j + i] = NULL;

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_var.h   Tue May 24 05:02:24 2016
(r300564)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h   Tue May 24 05:06:01 2016
(r300565)
@@ -33,6 +33,7 @@
 
 struct vmbus_pcpu_data {
int event_flag_cnt; /* # of event flags */
+   u_long  *intr_cnt;
 } __aligned(CACHE_LINE_SIZE);
 
 struct vmbus_softc {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300567 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Tue May 24 05:18:26 2016
New Revision: 300567
URL: https://svnweb.freebsd.org/changeset/base/300567

Log:
  hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6498

Modified:
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:11:55 
2016(r300566)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:18:26 
2016(r300567)
@@ -131,11 +131,9 @@ handled:
  * message to process - an event or a channel message.
  */
 static inline int
-hv_vmbus_isr(struct trapframe *frame)
+hv_vmbus_isr(struct vmbus_softc *sc, struct trapframe *frame, int cpu)
 {
-   struct vmbus_softc *sc = vmbus_get_softc();
hv_vmbus_message *msg, *msg_base;
-   int cpu = curcpu;
 
/*
 * The Windows team has advised that we check for events
@@ -202,7 +200,7 @@ hv_vector_handler(struct trapframe *trap
 */
(*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++;
 
-   hv_vmbus_isr(trap_frame);
+   hv_vmbus_isr(sc, trap_frame, cpu);
 
/*
 * Enable preemption.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300568 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Tue May 24 05:26:52 2016
New Revision: 300568
URL: https://svnweb.freebsd.org/changeset/base/300568

Log:
  hyperv/busdma: Take BUS_DMA_ZERO into account
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6499

Modified:
  head/sys/dev/hyperv/vmbus/hyperv_busdma.c

Modified: head/sys/dev/hyperv/vmbus/hyperv_busdma.c
==
--- head/sys/dev/hyperv/vmbus/hyperv_busdma.c   Tue May 24 05:18:26 2016
(r300567)
+++ head/sys/dev/hyperv/vmbus/hyperv_busdma.c   Tue May 24 05:26:52 2016
(r300568)
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#define HYPERV_DMA_WAITMASK(BUS_DMA_WAITOK | BUS_DMA_NOWAIT)
+#define HYPERV_DMA_MASK(BUS_DMA_WAITOK | BUS_DMA_NOWAIT | BUS_DMA_ZERO)
 
 void
 hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
@@ -73,7 +73,7 @@ hyperv_dmamem_alloc(bus_dma_tag_t parent
return NULL;
 
error = bus_dmamem_alloc(dma->hv_dtag, &ret,
-   (flags & HYPERV_DMA_WAITMASK) | BUS_DMA_COHERENT, &dma->hv_dmap);
+   (flags & HYPERV_DMA_MASK) | BUS_DMA_COHERENT, &dma->hv_dmap);
if (error) {
bus_dma_tag_destroy(dma->hv_dtag);
return NULL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300569 - head/sys/compat/linux

2016-05-23 Thread Dmitry Chagin
Author: dchagin
Date: Tue May 24 05:29:41 2016
New Revision: 300569
URL: https://svnweb.freebsd.org/changeset/base/300569

Log:
  Don't leak fp in case where fo_ioctl() returns an error.
  
  Reported by:  C Turt 
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linux/linux_ioctl.c
==
--- head/sys/compat/linux/linux_ioctl.c Tue May 24 05:26:52 2016
(r300568)
+++ head/sys/compat/linux/linux_ioctl.c Tue May 24 05:29:41 2016
(r300569)
@@ -977,7 +977,7 @@ linux_ioctl_termio(struct thread *td, st
error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line,
td->td_ucred, td);
if (error)
-   return (error);
+   break;
switch (bsd_line) {
case TTYDISC:
linux_line = LINUX_N_TTY;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300570 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Tue May 24 05:43:55 2016
New Revision: 300570
URL: https://svnweb.freebsd.org/changeset/base/300570

Log:
  hyperv/vmbus: Rename local variable and break long lines
  
  No functional changes.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6500

Modified:
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:29:41 
2016(r300569)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:43:55 
2016(r300570)
@@ -370,7 +370,7 @@ static int
 vmbus_bus_init(void)
 {
struct vmbus_softc *sc;
-   int i, j, n, ret;
+   int i, n, ret, cpu;
char buf[MAXCOMLEN + 1];
cpuset_t cpu_mask;
 
@@ -394,44 +394,49 @@ vmbus_bus_init(void)
sc->vmbus_idtvec);
}
 
-   CPU_FOREACH(j) {
-   snprintf(buf, sizeof(buf), "cpu%d:hyperv", j);
-   intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, j));
+   CPU_FOREACH(cpu) {
+   snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu);
+   intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu));
 
for (i = 0; i < 2; i++)
-   setup_args.page_buffers[2 * j + i] = NULL;
+   setup_args.page_buffers[2 * cpu + i] = NULL;
}
 
/*
 * Per cpu setup.
 */
-   CPU_FOREACH(j) {
+   CPU_FOREACH(cpu) {
/*
 * Setup taskqueue to handle events
 */
-   hv_vmbus_g_context.hv_event_queue[j] = 
taskqueue_create_fast("hyperv event", M_WAITOK,
-   taskqueue_thread_enqueue, 
&hv_vmbus_g_context.hv_event_queue[j]);
-   CPU_SETOF(j, &cpu_mask);
-   
taskqueue_start_threads_cpuset(&hv_vmbus_g_context.hv_event_queue[j], 1, 
PI_NET, &cpu_mask,
-   "hvevent%d", j);
+   hv_vmbus_g_context.hv_event_queue[cpu] =
+   taskqueue_create_fast("hyperv event", M_WAITOK,
+   taskqueue_thread_enqueue,
+   &hv_vmbus_g_context.hv_event_queue[cpu]);
+   CPU_SETOF(cpu, &cpu_mask);
+   taskqueue_start_threads_cpuset(
+   &hv_vmbus_g_context.hv_event_queue[cpu], 1, PI_NET,
+   &cpu_mask, "hvevent%d", cpu);
 
/*
 * Setup per-cpu tasks and taskqueues to handle msg.
 */
-   hv_vmbus_g_context.hv_msg_tq[j] = taskqueue_create_fast(
+   hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast(
"hyperv msg", M_WAITOK, taskqueue_thread_enqueue,
-   &hv_vmbus_g_context.hv_msg_tq[j]);
-   CPU_SETOF(j, &cpu_mask);
-   taskqueue_start_threads_cpuset(&hv_vmbus_g_context.hv_msg_tq[j],
-   1, PI_NET, &cpu_mask, "hvmsg%d", j);
-   TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0,
+   &hv_vmbus_g_context.hv_msg_tq[cpu]);
+   CPU_SETOF(cpu, &cpu_mask);
+   taskqueue_start_threads_cpuset(
+   &hv_vmbus_g_context.hv_msg_tq[cpu], 1, PI_NET,
+   &cpu_mask, "hvmsg%d", cpu);
+   TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0,
vmbus_msg_task, NULL);
 
/*
-* Prepare the per cpu msg and event pages to be called on each 
cpu.
+* Prepare the per cpu msg and event pages to be called on
+* each cpu.
 */
for(i = 0; i < 2; i++) {
-   setup_args.page_buffers[2 * j + i] =
+   setup_args.page_buffers[2 * cpu + i] =
malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO);
}
}
@@ -475,10 +480,10 @@ vmbus_bus_init(void)
/*
 * remove swi and vmbus callback vector;
 */
-   CPU_FOREACH(j) {
-   if (hv_vmbus_g_context.hv_event_queue[j] != NULL) {
-   taskqueue_free(hv_vmbus_g_context.hv_event_queue[j]);
-   hv_vmbus_g_context.hv_event_queue[j] = NULL;
+   CPU_FOREACH(cpu) {
+   if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) {
+   taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]);
+   hv_vmbus_g_context.hv_event_queue[cpu] = NULL;
}
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300571 - head/sys/dev/hyperv/vmbus

2016-05-23 Thread Sepherosa Ziehau
Author: sephe
Date: Tue May 24 05:51:51 2016
New Revision: 300571
URL: https://svnweb.freebsd.org/changeset/base/300571

Log:
  hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file
  
  Avoid unnecessary exposure.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6501

Modified:
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_hv.c
==
--- head/sys/dev/hyperv/vmbus/hv_hv.c   Tue May 24 05:43:55 2016
(r300570)
+++ head/sys/dev/hyperv/vmbus/hv_hv.c   Tue May 24 05:51:51 2016
(r300571)
@@ -216,132 +216,6 @@ hv_vmbus_signal_event(void *con_id)
return (status);
 }
 
-/**
- * @brief hv_vmbus_synic_init
- */
-void
-hv_vmbus_synic_init(void *arg)
-{
-   struct vmbus_softc *sc = vmbus_get_softc();
-   int cpu;
-   uint64_thv_vcpu_index;
-   hv_vmbus_synic_simp simp;
-   hv_vmbus_synic_siefpsiefp;
-   hv_vmbus_synic_scontrol sctrl;
-   hv_vmbus_synic_sint shared_sint;
-   uint64_tversion;
-   hv_setup_args*  setup_args = (hv_setup_args *)arg;
-
-   cpu = PCPU_GET(cpuid);
-
-   /*
-* TODO: Check the version
-*/
-   version = rdmsr(HV_X64_MSR_SVERSION);
-   
-   hv_vmbus_g_context.syn_ic_msg_page[cpu] =
-   setup_args->page_buffers[2 * cpu];
-   hv_vmbus_g_context.syn_ic_event_page[cpu] =
-   setup_args->page_buffers[2 * cpu + 1];
-
-   /*
-* Setup the Synic's message page
-*/
-
-   simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP);
-   simp.u.simp_enabled = 1;
-   simp.u.base_simp_gpa = ((hv_get_phys_addr(
-   hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT);
-
-   wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t);
-
-   /*
-* Setup the Synic's event page
-*/
-   siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP);
-   siefp.u.siefp_enabled = 1;
-   siefp.u.base_siefp_gpa = ((hv_get_phys_addr(
-   hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT);
-
-   wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t);
-
-   /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */
-   shared_sint.as_uint64_t = 0;
-   shared_sint.u.vector = sc->vmbus_idtvec;
-   shared_sint.u.masked = FALSE;
-   shared_sint.u.auto_eoi = TRUE;
-
-   wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT,
-   shared_sint.as_uint64_t);
-
-   wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT,
-   shared_sint.as_uint64_t);
-
-   /* Enable the global synic bit */
-   sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL);
-   sctrl.u.enable = 1;
-
-   wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t);
-
-   hv_vmbus_g_context.syn_ic_initialized = TRUE;
-
-   /*
-* Set up the cpuid mapping from Hyper-V to FreeBSD.
-* The array is indexed using FreeBSD cpuid.
-*/
-   hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX);
-   hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index;
-
-   return;
-}
-
-/**
- * @brief Cleanup routine for hv_vmbus_synic_init()
- */
-void hv_vmbus_synic_cleanup(void *arg)
-{
-   hv_vmbus_synic_sint shared_sint;
-   hv_vmbus_synic_simp simp;
-   hv_vmbus_synic_siefpsiefp;
-
-   if (!hv_vmbus_g_context.syn_ic_initialized)
-   return;
-
-   shared_sint.as_uint64_t = rdmsr(
-   HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT);
-
-   shared_sint.u.masked = 1;
-
-   /*
-* Disable the interrupt 0
-*/
-   wrmsr(
-   HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT,
-   shared_sint.as_uint64_t);
-
-   shared_sint.as_uint64_t = rdmsr(
-   HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT);
-
-   shared_sint.u.masked = 1;
-
-   /*
-* Disable the interrupt 1
-*/
-   wrmsr(
-   HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT,
-   shared_sint.as_uint64_t);
-   simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP);
-   simp.u.simp_enabled = 0;
-   simp.u.base_simp_gpa = 0;
-
-   wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t);
-
-   siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP);
-   siefp.u.siefp_enabled = 0;
-   siefp.u.base_siefp_gpa = 0;
-
-   wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t);
-}
 
 static bool
 hyperv_identify(void)

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:43:55 
2016(r300570)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue May 24 05:51:51 
2016(r300571)
@@ -208,6 +208,126 @@ hv_vector_handler(struct trapframe *trap
cr

  1   2   >