svn commit: r302621 - in head/sys/dev/hyperv: include storvsc vmbus

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 05:31:33 2016
New Revision: 302621
URL: https://svnweb.freebsd.org/changeset/base/302621

Log:
  hyperv/vmbus: Don't be oversmart in default cpu selection.
  
  Pin the channel to cpu0 by default.  Drivers having special channel-cpu
  mapping requirement should call vmbus_channel_cpu_{set,rr}() themselves.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6918

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hTue Jul 12 05:23:14 2016
(r302620)
+++ head/sys/dev/hyperv/include/hyperv.hTue Jul 12 05:31:33 2016
(r302621)
@@ -707,6 +707,7 @@ int hv_vmbus_channel_teardown_gpdal(
 struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel 
*promary);
 
 void   vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu);
+void   vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan);
 struct hv_vmbus_channel **
vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int 
subchan_cnt);
 void   vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int 
subchan_cnt);

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cTue Jul 12 
05:23:14 2016(r302620)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cTue Jul 12 
05:31:33 2016(r302621)
@@ -361,6 +361,7 @@ storvsc_subchan_attach(struct hv_vmbus_c
 
memset(, 0, sizeof(props));
 
+   vmbus_channel_cpu_rr(new_channel);
ret = hv_vmbus_channel_open(new_channel,
sc->hs_drv_props->drv_ringbuffer_size,
sc->hs_drv_props->drv_ringbuffer_size,
@@ -655,7 +656,7 @@ hv_storvsc_connect_vsp(struct hv_device 
/*
 * Open the channel
 */
-
+   vmbus_channel_cpu_rr(dev->channel);
ret = hv_vmbus_channel_open(
dev->channel,
sc->hs_drv_props->drv_ringbuffer_size,

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 05:23:14 2016
(r302620)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 05:31:33 2016
(r302621)
@@ -238,61 +238,25 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch
}
 }
 
-/**
- * Array of device guids that are performance critical. We try to distribute
- * the interrupt load for these devices across all online cpus. 
- */
-static const hv_guid high_perf_devices[] = {
-   {HV_NIC_GUID, },
-   {HV_IDE_GUID, },
-   {HV_SCSI_GUID, },
-};
-
-enum {
-   PERF_CHN_NIC = 0,
-   PERF_CHN_IDE,
-   PERF_CHN_SCSI,
-   MAX_PERF_CHN,
-};
+void
+vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan)
+{
+   static uint32_t vmbus_chan_nextcpu;
+   int cpu;
 
-/*
- * We use this static number to distribute the channel interrupt load.
- */
-static uint32_t next_vcpu;
+   cpu = atomic_fetchadd_int(_chan_nextcpu, 1) % mp_ncpus;
+   vmbus_channel_cpu_set(chan, cpu);
+}
 
-/**
- * Starting with Win8, we can statically distribute the incoming
- * channel interrupt load by binding a channel to VCPU. We
- * implement here a simple round robin scheme for distributing
- * the interrupt load.
- * We will bind channels that are not performance critical to cpu 0 and
- * performance critical channels (IDE, SCSI and Network) will be uniformly
- * distributed across all available CPUs.
- */
 static void
-vmbus_channel_select_defcpu(struct hv_vmbus_channel *channel)
+vmbus_channel_select_defcpu(struct hv_vmbus_channel *chan)
 {
-   uint32_t current_cpu;
-   int i;
-   boolean_t is_perf_channel = FALSE;
-   const hv_guid *guid = >offer_msg.offer.interface_type;
-
-   for (i = PERF_CHN_NIC; i < MAX_PERF_CHN; i++) {
-   if (memcmp(guid->data, high_perf_devices[i].data,
-   sizeof(hv_guid)) == 0) {
-   is_perf_channel = TRUE;
-   break;
-   }
-   }
-
-   if (!is_perf_channel) {
-   /* Stick to cpu0 */
-   vmbus_channel_cpu_set(channel, 0);
-   return;
-   }
-   /* mp_ncpus should have the number cpus currently online */
-   current_cpu = (++next_vcpu % mp_ncpus);
-   vmbus_channel_cpu_set(channel, current_cpu);
+   /*
+* By default, pin the channel to cpu0.  Devices having
+* special channel-cpu mapping requirement should call
+* vmbus_channel_cpu_{set,rr}().
+*/
+   

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 05:23:14 2016
New Revision: 302620
URL: https://svnweb.freebsd.org/changeset/base/302620

Log:
  hyperv: Nuke unused stuffs
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6917

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

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 05:09:07 2016
(r302619)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 05:23:14 2016
(r302620)
@@ -38,29 +38,6 @@
 
 #include 
 
-
-/*
- *  Status codes for hypervisor operations.
- */
-
-typedef uint16_t hv_vmbus_status;
-
-#define HV_MESSAGE_SIZE (256)
-#define HV_MESSAGE_PAYLOAD_BYTE_COUNT   (240)
-#define HV_MESSAGE_PAYLOAD_QWORD_COUNT  (30)
-#define HV_ANY_VP   (0x)
-
-/*
- * MessageId: HV_STATUS_INSUFFICIENT_BUFFERS
- * MessageText:
- *You did not supply enough message buffers to send a message.
- */
-
-#define HV_STATUS_SUCCESS((uint16_t)0)
-#define HV_STATUS_INSUFFICIENT_BUFFERS   ((uint16_t)0x0013)
-
-typedef void (*hv_vmbus_channel_callback)(void *context);
-
 typedef struct {
void*   data;
uint32_tlength;
@@ -118,74 +95,6 @@ typedef struct hv_vmbus_channel_packet_m
hv_vmbus_multipage_buffer   range;
 } __packed hv_vmbus_channel_packet_multipage_buffer;
 
-enum {
-   HV_VMBUS_MESSAGE_CONNECTION_ID  = 1,
-   HV_VMBUS_MESSAGE_PORT_ID= 1,
-   HV_VMBUS_EVENT_CONNECTION_ID= 2,
-   HV_VMBUS_EVENT_PORT_ID  = 2,
-   HV_VMBUS_MONITOR_CONNECTION_ID  = 3,
-   HV_VMBUS_MONITOR_PORT_ID= 3,
-};
-
-#define HV_PRESENT_BIT 0x8000
-
-#define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t)
-
-/*
- * Define hypervisor message types
- */
-typedef enum {
-
-   HV_MESSAGE_TYPE_NONE= 0x,
-
-   /*
-* Memory access messages
-*/
-   HV_MESSAGE_TYPE_UNMAPPED_GPA= 0x8000,
-   HV_MESSAGE_TYPE_GPA_INTERCEPT   = 0x8001,
-
-   /*
-* Timer notification messages
-*/
-   HV_MESSAGE_TIMER_EXPIRED= 0x8010,
-
-   /*
-* Error messages
-*/
-   HV_MESSAGE_TYPE_INVALID_VP_REGISTER_VALUE   = 0x8020,
-   HV_MESSAGE_TYPE_UNRECOVERABLE_EXCEPTION = 0x8021,
-   HV_MESSAGE_TYPE_UNSUPPORTED_FEATURE = 0x8022,
-
-   /*
-* Trace buffer complete messages
-*/
-   HV_MESSAGE_TYPE_EVENT_LOG_BUFFER_COMPLETE   = 0x8040,
-
-   /*
-* Platform-specific processor intercept messages
-*/
-   HV_MESSAGE_TYPE_X64_IO_PORT_INTERCEPT   = 0x8001,
-   HV_MESSAGE_TYPE_X64_MSR_INTERCEPT   = 0x80010001,
-   HV_MESSAGE_TYPE_X64_CPU_INTERCEPT   = 0x80010002,
-   HV_MESSAGE_TYPE_X64_EXCEPTION_INTERCEPT = 0x80010003,
-   HV_MESSAGE_TYPE_X64_APIC_EOI= 0x80010004,
-   HV_MESSAGE_TYPE_X64_LEGACY_FP_ERROR = 0x80010005
-
-} hv_vmbus_msg_type;
-
-/*
- * Define port identifier type
- */
-typedef union _hv_vmbus_port_id {
-   uint32_tas_uint32_t;
-   struct {
-   uint32_tid:24;
-   uint32_treserved:8;
-   } u ;
-} hv_vmbus_port_id;
-
-typedef uint64_t hv_vmbus_partition_id;
-
 /*
  * VM Bus connection states
  */
@@ -196,9 +105,6 @@ typedef enum {
HV_DISCONNECTING
 } hv_vmbus_connect_state;
 
-#define HV_MAX_SIZE_CHANNEL_MESSAGEHV_MESSAGE_PAYLOAD_BYTE_COUNT
-
-
 typedef struct {
hv_vmbus_connect_state  connect_state;
uint32_tnext_gpadl_handle;
@@ -277,14 +183,6 @@ typedef struct {
uint8_t rsvd_z4[1984];
 } hv_vmbus_monitor_page;
 
-/*
- * Declare the various hypercall operations
- */
-typedef enum {
-   HV_CALL_POST_MESSAGE= 0x005c,
-   HV_CALL_SIGNAL_EVENT= 0x005d,
-} hv_vmbus_call_code;
-
 /**
  * Global variables
  */
@@ -344,8 +242,6 @@ uint32_thv_ring_buffer_read_end(
 void   hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel);
 void   hv_vmbus_release_unattached_channels(void);
 
-uint16_t   hv_vmbus_signal_event(void *con_id);
-
 struct hv_device*  hv_vmbus_child_device_create(
hv_guid device_type,
hv_guid device_instance,

Modified: head/sys/dev/hyperv/vmbus/hyperv.c
==
--- head/sys/dev/hyperv/vmbus/hyperv.c  Tue Jul 12 05:09:07 2016

svn commit: r302619 - in head/sys/dev/hyperv: include vmbus

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 05:09:07 2016
New Revision: 302619
URL: https://svnweb.freebsd.org/changeset/base/302619

Log:
  hyperv/vmbus: Busdma-fy Hypercall signal event input parameter.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6916

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/include/hyperv_busdma.h
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/hyperv.c
  head/sys/dev/hyperv/vmbus/hyperv_reg.h
  head/sys/dev/hyperv/vmbus/hyperv_var.h
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hTue Jul 12 04:58:21 2016
(r302618)
+++ head/sys/dev/hyperv/include/hyperv.hTue Jul 12 05:09:07 2016
(r302619)
@@ -55,6 +55,7 @@
 
 #include 
 #include 
+#include 
 
 typedef uint8_thv_bool_uint8_t;
 
@@ -528,20 +529,6 @@ typedef union {
 
 } __packed hv_vmbus_connection_id;
 
-/*
- * Definition of the hv_vmbus_signal_event hypercall input structure
- */
-typedef struct {
-   hv_vmbus_connection_id  connection_id;
-   uint16_tflag_number;
-   uint16_trsvd_z;
-} __packed hv_vmbus_input_signal_event;
-
-typedef struct {
-   uint64_talign8;
-   hv_vmbus_input_signal_event event;
-} __packed hv_vmbus_input_signal_event_buffer;
-
 typedef struct hv_vmbus_channel {
TAILQ_ENTRY(hv_vmbus_channel)   list_entry;
struct hv_device*   device;
@@ -589,14 +576,8 @@ typedef struct hv_vmbus_channel {
 
boolean_t   is_dedicated_interrupt;
 
-   /*
-* Used as an input param for HV_CALL_SIGNAL_EVENT hypercall.
-*/
-   hv_vmbus_input_signal_event_buffer  signal_event_buffer;
-   /*
-* 8-bytes aligned of the buffer above
-*/
-   hv_vmbus_input_signal_event *signal_event_param;
+   struct hypercall_sigevt_in  *ch_sigevt;
+   struct hyperv_dma   ch_sigevt_dma;
 
/*
 * From Win8, this field specifies the target virtual process

Modified: head/sys/dev/hyperv/include/hyperv_busdma.h
==
--- head/sys/dev/hyperv/include/hyperv_busdma.h Tue Jul 12 04:58:21 2016
(r302618)
+++ head/sys/dev/hyperv/include/hyperv_busdma.h Tue Jul 12 05:09:07 2016
(r302619)
@@ -29,6 +29,10 @@
 #ifndef _HYPERV_BUSDMA_H_
 #define _HYPERV_BUSDMA_H_
 
+#include 
+#include 
+#include 
+
 struct hyperv_dma {
bus_addr_t  hv_paddr;
bus_dma_tag_t   hv_dtag;

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 04:58:21 2016
(r302618)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 05:09:07 2016
(r302619)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -72,7 +73,7 @@ vmbus_channel_set_event(hv_vmbus_channel
(uint32_t *)_page->

trigger_group[channel->monitor_group].u.pending);
} else {
-   hv_vmbus_set_event(channel);
+   hypercall_signal_event(channel->ch_sigevt_dma.hv_paddr);
}
 
 }

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 04:58:21 2016
(r302618)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 05:09:07 2016
(r302619)
@@ -32,6 +32,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -327,23 +328,23 @@ vmbus_channel_on_offer_internal(struct v
 */
new_channel->batched_reading = TRUE;
 
-   new_channel->signal_event_param =
-   (hv_vmbus_input_signal_event *)
-   (HV_ALIGN_UP((unsigned long)
-   _channel->signal_event_buffer,
-   HV_HYPERCALL_PARAM_ALIGN));
-
-   new_channel->signal_event_param->connection_id.as_uint32_t = 0; 
-   new_channel->signal_event_param->connection_id.u.id =
-   HV_VMBUS_EVENT_CONNECTION_ID;
-   new_channel->signal_event_param->flag_number = 0;
-   new_channel->signal_event_param->rsvd_z = 0;
+   new_channel->ch_sigevt = hyperv_dmamem_alloc(
+   bus_get_dma_tag(sc->vmbus_dev),
+   HYPERCALL_SIGEVTIN_ALIGN, 0, sizeof(struct hypercall_sigevt_in),
+   _channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO);
+   if 

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 04:58:21 2016
New Revision: 302618
URL: https://svnweb.freebsd.org/changeset/base/302618

Log:
  hyperv/vmbus: Avoid tx_evtflags setting code duplication.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6915

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_connection.c

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 04:35:32 2016
(r302617)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 04:58:21 2016
(r302618)
@@ -58,14 +58,14 @@ static void VmbusProcessChannelEvent(voi
 static void
 vmbus_channel_set_event(hv_vmbus_channel *channel)
 {
+   struct vmbus_softc *sc = channel->vmbus_sc;
+   uint32_t chanid = channel->offer_msg.child_rel_id;
+
+   atomic_set_long(>vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
+   1UL << (chanid & VMBUS_EVTFLAG_MASK));
+
if (channel->offer_msg.monitor_allocated) {
-   struct vmbus_softc *sc = channel->vmbus_sc;
hv_vmbus_monitor_page *monitor_page;
-   uint32_t chanid = channel->offer_msg.child_rel_id;
-
-   atomic_set_long(
-   >vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
-   1UL << (chanid & VMBUS_EVTFLAG_MASK));
 
monitor_page = sc->vmbus_mnf2;
synch_set_bit(channel->monitor_bit,

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 04:35:32 2016
(r302617)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Tue Jul 12 04:58:21 2016
(r302618)
@@ -164,15 +164,8 @@ vmbus_event_proc_compat(struct vmbus_sof
 int
 hv_vmbus_set_event(hv_vmbus_channel *channel)
 {
-   struct vmbus_softc *sc = channel->vmbus_sc;
-   int ret = 0;
-   uint32_t chanid = channel->offer_msg.child_rel_id;
 
-   atomic_set_long(>vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
-   1UL << (chanid & VMBUS_EVTFLAG_MASK));
-   ret = hv_vmbus_signal_event(channel->signal_event_param);
-
-   return (ret);
+   return hv_vmbus_signal_event(channel->signal_event_param);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 04:35:32 2016
New Revision: 302617
URL: https://svnweb.freebsd.org/changeset/base/302617

Log:
  hyperv/vmbus: Flatten channel message response processing.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6914

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

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 04:29:34 2016
(r302616)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 04:35:32 2016
(r302617)
@@ -46,18 +46,10 @@ static void vmbus_chan_detach_task(void 
 
 static voidvmbus_channel_on_offer(struct vmbus_softc *,
const struct vmbus_message *);
-static voidvmbus_channel_on_open_result(struct vmbus_softc *,
-   const struct vmbus_message *);
 static voidvmbus_channel_on_offer_rescind(struct vmbus_softc *,
const struct vmbus_message *);
-static voidvmbus_channel_on_gpadl_created(struct vmbus_softc *,
-   const struct vmbus_message *);
-static voidvmbus_channel_on_gpadl_torndown(struct vmbus_softc *,
-   const struct vmbus_message *);
 static voidvmbus_channel_on_offers_delivered(struct vmbus_softc *,
const struct vmbus_message *);
-static voidvmbus_channel_on_version_response(struct vmbus_softc *,
-   const struct vmbus_message *);
 
 /**
  * Channel message dispatch table
@@ -71,13 +63,13 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE
[HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] =
vmbus_channel_on_offers_delivered,
[HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] =
-   vmbus_channel_on_open_result,
+   vmbus_msghc_wakeup,
[HV_CHANNEL_MESSAGE_GPADL_CREATED] =
-   vmbus_channel_on_gpadl_created,
+   vmbus_msghc_wakeup,
[HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] =
-   vmbus_channel_on_gpadl_torndown,
+   vmbus_msghc_wakeup,
[HV_CHANNEL_MESSAGE_VERSION_RESPONSE] =
-   vmbus_channel_on_version_response
+   vmbus_msghc_wakeup
 };
 
 /**
@@ -415,54 +407,6 @@ vmbus_channel_on_offers_delivered(struct
 }
 
 /**
- * @brief Open result handler.
- *
- * This is invoked when we received a response
- * to our channel open request.
- */
-static void
-vmbus_channel_on_open_result(struct vmbus_softc *sc,
-const struct vmbus_message *msg)
-{
-   vmbus_msghc_wakeup(sc, msg);
-}
-
-/**
- * @brief GPADL created handler.
- *
- * This is invoked when we received a response
- * to our gpadl create request. Find the matching request, copy the
- * response and signal the requesting thread.
- */
-static void
-vmbus_channel_on_gpadl_created(struct vmbus_softc *sc,
-const struct vmbus_message *msg)
-{
-   vmbus_msghc_wakeup(sc, msg);
-}
-
-/**
- * @brief GPADL torndown handler.
- *
- * This is invoked when we received a respons
- * to our gpadl teardown request. Find the matching request, copy the
- * response and signal the requesting thread
- */
-static void
-vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc,
-const struct vmbus_message *msg)
-{
-   vmbus_msghc_wakeup(sc, msg);
-}
-
-static void
-vmbus_channel_on_version_response(struct vmbus_softc *sc,
-const struct vmbus_message *msg)
-{
-   vmbus_msghc_wakeup(sc, msg);
-}
-
-/**
  * @brief Release channels that are unattached/unconnected (i.e., no drivers 
associated)
  */
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302616 - head/usr.bin/tr

2016-07-11 Thread Andrey A. Chernov
Author: ache
Date: Tue Jul 12 04:29:34 2016
New Revision: 302616
URL: https://svnweb.freebsd.org/changeset/base/302616

Log:
  Undo r302599 and partially r302594 case 2):
  since WCHAR_MAX can be not a valid wchar value, it is easier to stay
  inside wint_t.

Modified:
  head/usr.bin/tr/tr.c

Modified: head/usr.bin/tr/tr.c
==
--- head/usr.bin/tr/tr.cTue Jul 12 04:20:44 2016(r302615)
+++ head/usr.bin/tr/tr.cTue Jul 12 04:29:34 2016(r302616)
@@ -266,7 +266,7 @@ endloop:
 */
s2.str = argv[1];
s2.state = NORMAL;
-   for (cnt = 0; cnt <= (wint_t)WCHAR_MAX; cnt++) {
+   for (cnt = 0; cnt <= WINT_MAX; cnt++) {
if (Cflag && !iswrune(cnt))
continue;
if (cmap_lookup(map, cnt) == OOBCH) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302615 - in head/sys: arm/include arm64/include

2016-07-11 Thread Andrey A. Chernov
Author: ache
Date: Tue Jul 12 04:20:44 2016
New Revision: 302615
URL: https://svnweb.freebsd.org/changeset/base/302615

Log:
  Undo r302601, WCHAR_MAX may not be a valid wchar value.

Modified:
  head/sys/arm/include/_types.h
  head/sys/arm64/include/_types.h

Modified: head/sys/arm/include/_types.h
==
--- head/sys/arm/include/_types.h   Tue Jul 12 03:53:15 2016
(r302614)
+++ head/sys/arm/include/_types.h   Tue Jul 12 04:20:44 2016
(r302615)
@@ -107,7 +107,7 @@ typedef __uint32_t  __vm_size_t;
 
 typedefunsigned int___wchar_t;
 #define__WCHAR_MIN 0   /* min value for a wchar_t */
-#define__WCHAR_MAX __INT_MAX   /* max for a wchar_t <= 
WINT_MAX */
+#define__WCHAR_MAX __UINT_MAX  /* max value for a wchar_t */
 
 /*
  * Unusual type definitions.

Modified: head/sys/arm64/include/_types.h
==
--- head/sys/arm64/include/_types.h Tue Jul 12 03:53:15 2016
(r302614)
+++ head/sys/arm64/include/_types.h Tue Jul 12 04:20:44 2016
(r302615)
@@ -95,7 +95,7 @@ typedef   __uint64_t  __vm_size_t;
 typedefunsigned int___wchar_t;
 
 #define__WCHAR_MIN 0   /* min value for a wchar_t */
-#define__WCHAR_MAX __INT_MAX   /* max for a wchar_t <= 
WINT_MAX */
+#define__WCHAR_MAX __UINT_MAX  /* max value for a wchar_t */
 
 /*
  * Unusual type definitions.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302614 - head/sys/kern

2016-07-11 Thread Konstantin Belousov
Author: kib
Date: Tue Jul 12 03:53:15 2016
New Revision: 302614
URL: https://svnweb.freebsd.org/changeset/base/302614

Log:
  Revive the check, disabled in r197963.
  
  Despite the implication (process has pending signals -> the current
  thread marked for AST and has TDF_NEEDSIGCHK set) is not true due to
  other thread might manipulate its signal blocking mask, it should still
  hold for the single-threaded processes.  Enable check for the condition
  for single-threaded case, and replicate it from userret() to ast() as
  well, where we check that ast indeed has no signal to deliver.
  
  Note that the check is under DIAGNOSTIC, it is not enabled for INVARIANTS
  but !DIAGNOSTIC since it imposes too heavy-weight locking for day-to-day
  used debugging kernel.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Tue Jul 12 03:52:05 2016(r302613)
+++ head/sys/kern/subr_trap.c   Tue Jul 12 03:53:15 2016(r302614)
@@ -101,17 +101,24 @@ userret(struct thread *td, struct trapfr
 td->td_name);
KASSERT((p->p_flag & P_WEXIT) == 0,
("Exiting process returns to usermode"));
-#if 0
 #ifdef DIAGNOSTIC
-   /* Check that we called signotify() enough. */
-   PROC_LOCK(p);
-   thread_lock(td);
-   if (SIGPENDING(td) && ((td->td_flags & TDF_NEEDSIGCHK) == 0 ||
-   (td->td_flags & TDF_ASTPENDING) == 0))
-   printf("failed to set signal flags properly for ast()\n");
-   thread_unlock(td);
-   PROC_UNLOCK(p);
-#endif
+   /*
+* Check that we called signotify() enough.  For
+* multi-threaded processes, where signal distribution might
+* change due to other threads changing sigmask, the check is
+* racy and cannot be performed reliably.
+*/
+   if (p->p_numthreads == 1) {
+   PROC_LOCK(p);
+   thread_lock(td);
+   KASSERT(!SIGPENDING(td) ||
+   (td->td_flags & (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING),
+   ("failed to set signal flags for ast p %p td %p fl %x",
+   p, td, td->td_flags));
+   thread_unlock(td);
+   PROC_UNLOCK(p);
+   }
 #endif
 #ifdef KTRACE
KTRUSERRET(td);
@@ -265,6 +272,26 @@ ast(struct trapframe *framep)
 #endif
}
 
+#ifdef DIAGNOSTIC
+   if (p->p_numthreads == 1 && (flags & TDF_NEEDSIGCHK) == 0) {
+   PROC_LOCK(p);
+   thread_lock(td);
+   /*
+* Note that TDF_NEEDSIGCHK should be re-read from
+* td_flags, since signal might have been delivered
+* after we cleared td_flags above.  This is one of
+* the reason for looping check for AST condition.
+*/
+   KASSERT(!SIGPENDING(td) ||
+   (td->td_flags & (TDF_NEEDSIGCHK | TDF_ASTPENDING)) ==
+   (TDF_NEEDSIGCHK | TDF_ASTPENDING),
+   ("failed2 to set signal flags for ast p %p td %p fl %x %x",
+   p, td, flags, td->td_flags));
+   thread_unlock(td);
+   PROC_UNLOCK(p);
+   }
+#endif
+
/*
 * Check for signals. Unlocked reads of p_pendingcnt or
 * p_siglist might cause process-directed signal to be handled
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302613 - head/sys/kern

2016-07-11 Thread Konstantin Belousov
Author: kib
Date: Tue Jul 12 03:52:05 2016
New Revision: 302613
URL: https://svnweb.freebsd.org/changeset/base/302613

Log:
  Add assert to complement r302328.
  
  AST must not execute with TDF_SBDRY or TDF_SEINTR/TDF_SERESTART thread
  flags set, which is asserted in userret(). As the consequence, -1 return
  from cursig() must not be possible.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Tue Jul 12 03:38:29 2016(r302612)
+++ head/sys/kern/subr_trap.c   Tue Jul 12 03:52:05 2016(r302613)
@@ -274,8 +274,10 @@ ast(struct trapframe *framep)
!SIGISEMPTY(p->p_siglist)) {
PROC_LOCK(p);
mtx_lock(>p_sigacts->ps_mtx);
-   while ((sig = cursig(td)) != 0)
+   while ((sig = cursig(td)) != 0) {
+   KASSERT(sig >= 0, ("sig %d", sig));
postsig(sig);
+   }
mtx_unlock(>p_sigacts->ps_mtx);
PROC_UNLOCK(p);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302612 - in head/sys/dev/hyperv: include vmbus

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 03:38:29 2016
New Revision: 302612
URL: https://svnweb.freebsd.org/changeset/base/302612

Log:
  hyperv: Nuke unused stuffs
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6913

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

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hTue Jul 12 03:32:07 2016
(r302611)
+++ head/sys/dev/hyperv/include/hyperv.hTue Jul 12 03:38:29 2016
(r302612)
@@ -179,8 +179,6 @@ typedef struct hv_vmbus_channel_offer {
 
 } __packed hv_vmbus_channel_offer;
 
-typedef uint32_t hv_gpadl_handle;
-
 typedef struct {
uint16_t type;
uint16_t data_offset8;
@@ -352,14 +350,6 @@ typedef struct {
 } __packed hv_vmbus_channel_query_vmbus_version;
 
 /*
- * VMBus Version Supported parameters
- */
-typedef struct {
-   hv_vmbus_channel_msg_header header;
-   hv_bool_uint8_t version_supported;
-} __packed hv_vmbus_channel_version_supported;
-
-/*
  * Channel Offer parameters
  */
 typedef struct {
@@ -397,171 +387,13 @@ typedef struct
 uint32_t   child_rel_id;
 } __packed hv_vmbus_channel_rescind_offer;
 
-
-/*
- * Request Offer -- no parameters, SynIC message contains the partition ID
- *
- * Set Snoop -- no parameters, SynIC message contains the partition ID
- *
- * Clear Snoop -- no parameters, SynIC message contains the partition ID
- *
- * All Offers Delivered -- no parameters, SynIC message contains the
- * partition ID
- *
- * Flush Client -- no parameters, SynIC message contains the partition ID
- */
-
-
-/*
- * Open Channel parameters
- */
-typedef struct
-{
-hv_vmbus_channel_msg_header header;
-
-/*
- * Identifies the specific VMBus channel that is being opened.
- */
-uint32_t   child_rel_id;
-
-/*
- * ID making a particular open request at a channel offer unique.
- */
-uint32_t   open_id;
-
-/*
- * GPADL for the channel's ring buffer.
- */
-hv_gpadl_handlering_buffer_gpadl_handle;
-
-/*
- * Before win8, all incoming channel interrupts are only
- * delivered on cpu 0. Setting this value to 0 would
- * preserve the earlier behavior.
- */
-uint32_t   target_vcpu;
-
-/*
- * The upstream ring buffer begins at offset zero in the memory described
- * by ring_buffer_gpadl_handle. The downstream ring buffer follows it at
- * this offset (in pages).
- */
-uint32_t   downstream_ring_buffer_page_offset;
-
-/*
- * User-specific data to be passed along to the server endpoint.
- */
-uint8_tuser_data[HV_MAX_USER_DEFINED_BYTES];
-
-} __packed hv_vmbus_channel_open_channel;
-
-typedef uint32_t hv_nt_status;
-
-/*
- * Open Channel Result parameters
- */
-typedef struct
-{
-   hv_vmbus_channel_msg_header header;
-   uint32_tchild_rel_id;
-   uint32_topen_id;
-   hv_nt_statusstatus;
-} __packed hv_vmbus_channel_open_result;
-
-/*
- * Close channel parameters
- */
-typedef struct
-{
-   hv_vmbus_channel_msg_header header;
-   uint32_tchild_rel_id;
-} __packed hv_vmbus_channel_close_channel;
-
-/*
- * Channel Message GPADL
- */
-#define HV_GPADL_TYPE_RING_BUFFER  1
-#define HV_GPADL_TYPE_SERVER_SAVE_AREA 2
-#define HV_GPADL_TYPE_TRANSACTION  8
-
-/*
- * The number of PFNs in a GPADL message is defined by the number of pages
- * that would be spanned by byte_count and byte_offset.  If the implied number
- * of PFNs won't fit in this packet, there will be a follow-up packet that
- * contains more
- */
-
-typedef struct {
-   hv_vmbus_channel_msg_header header;
-   uint32_tchild_rel_id;
-   uint32_tgpadl;
-   uint16_trange_buf_len;
-   uint16_trange_count;
-   hv_gpa_rangerange[0];
-} __packed hv_vmbus_channel_gpadl_header;
-
-/*
- * This is the follow-up packet that contains more PFNs
- */
-typedef struct {
-   hv_vmbus_channel_msg_header header;
-   uint32_tmessage_number;
-   uint32_tgpadl;
-   uint64_tpfn[0];
-} __packed hv_vmbus_channel_gpadl_body;
-
-typedef struct {
-   hv_vmbus_channel_msg_header header;
-   uint32_tchild_rel_id;
-   uint32_tgpadl;
-   uint32_tcreation_status;
-} __packed hv_vmbus_channel_gpadl_created;
-
-typedef struct {
-   

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 03:32:07 2016
New Revision: 302611
URL: https://svnweb.freebsd.org/changeset/base/302611

Log:
  hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6912

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:25:36 2016
(r302610)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:32:07 2016
(r302611)
@@ -427,61 +427,44 @@ hv_vmbus_channel_establish_gpadl(struct 
return 0;
 }
 
-/**
- * @brief Teardown the specified GPADL handle
+/*
+ * Disconnect the GPA from the target channel
  */
 int
-hv_vmbus_channel_teardown_gpdal(
-   hv_vmbus_channel*   channel,
-   uint32_tgpadl_handle)
+hv_vmbus_channel_teardown_gpdal(struct hv_vmbus_channel *chan, uint32_t gpadl)
 {
-   int ret = 0;
-   hv_vmbus_channel_gpadl_teardown*msg;
-   hv_vmbus_channel_msg_info*  info;
+   struct vmbus_softc *sc = chan->vmbus_sc;
+   struct vmbus_msghc *mh;
+   struct vmbus_chanmsg_gpadl_disconn *req;
+   int error;
 
-   info = (hv_vmbus_channel_msg_info *)
-   malloc( sizeof(hv_vmbus_channel_msg_info) +
-   sizeof(hv_vmbus_channel_gpadl_teardown),
-   M_DEVBUF, M_NOWAIT);
-   KASSERT(info != NULL,
-   ("Error VMBUS: malloc failed to allocate Gpadl Teardown Msg!"));
-   if (info == NULL) {
-   ret = ENOMEM;
-   goto cleanup;
-   }
-
-   sema_init(>wait_sema, 0, "Open Info Sema");
-
-   msg = (hv_vmbus_channel_gpadl_teardown*) info->msg;
-
-   msg->header.message_type = HV_CHANNEL_MESSAGE_GPADL_TEARDOWN;
-   msg->child_rel_id = channel->offer_msg.child_rel_id;
-   msg->gpadl = gpadl_handle;
-
-   mtx_lock(_vmbus_g_connection.channel_msg_lock);
-   TAILQ_INSERT_TAIL(_vmbus_g_connection.channel_msg_anchor,
-   info, msg_list_entry);
-   mtx_unlock(_vmbus_g_connection.channel_msg_lock);
-
-   ret = hv_vmbus_post_message(msg,
-   sizeof(hv_vmbus_channel_gpadl_teardown));
-   if (ret != 0) 
-   goto cleanup;
-   
-   ret = sema_timedwait(>wait_sema, 5 * hz); /* KYS 5 seconds */
+   mh = vmbus_msghc_get(sc, sizeof(*req));
+   if (mh == NULL) {
+   device_printf(sc->vmbus_dev,
+   "can not get msg hypercall for gpa x->chan%u\n",
+   chan->offer_msg.child_rel_id);
+   return EBUSY;
+   }
 
-cleanup:
-   /*
-* Received a torndown response
-*/
-   mtx_lock(_vmbus_g_connection.channel_msg_lock);
-   TAILQ_REMOVE(_vmbus_g_connection.channel_msg_anchor,
-   info, msg_list_entry);
-   mtx_unlock(_vmbus_g_connection.channel_msg_lock);
-   sema_destroy(>wait_sema);
-   free(info, M_DEVBUF);
+   req = vmbus_msghc_dataptr(mh);
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_DISCONN;
+   req->chm_chanid = chan->offer_msg.child_rel_id;
+   req->chm_gpadl = gpadl;
 
-   return (ret);
+   error = vmbus_msghc_exec(sc, mh);
+   if (error) {
+   device_printf(sc->vmbus_dev,
+   "gpa x->chan%u msg hypercall exec failed: %d\n",
+   chan->offer_msg.child_rel_id, error);
+   vmbus_msghc_put(sc, mh);
+   return error;
+   }
+
+   vmbus_msghc_wait_result(sc, mh);
+   /* Discard result; no useful information */
+   vmbus_msghc_put(sc, mh);
+
+   return 0;
 }
 
 static void

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:25:36 2016
(r302610)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:32:07 2016
(r302611)
@@ -452,42 +452,7 @@ static void
 vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc,
 const struct vmbus_message *msg)
 {
-   const hv_vmbus_channel_msg_header *hdr =
-   (const hv_vmbus_channel_msg_header *)msg->msg_data;
-
-   const hv_vmbus_channel_gpadl_torndown *gpadl_torndown;
-   hv_vmbus_channel_msg_info*  msg_info;
-   hv_vmbus_channel_msg_header*requestHeader;
-   hv_vmbus_channel_gpadl_teardown*gpadlTeardown;
-
-   gpadl_torndown = (const hv_vmbus_channel_gpadl_torndown *)hdr;
-
-   /*
-* Find the open msg, copy the result and signal/unblock the
-* wait event.
-*/
-
- 

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 03:25:36 2016
New Revision: 302610
URL: https://svnweb.freebsd.org/changeset/base/302610

Log:
  hyperv/vmbus: Use post message Hypercall APIs for channel close
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6906

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:19:40 2016
(r302609)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:25:36 2016
(r302610)
@@ -487,10 +487,11 @@ cleanup:
 static void
 hv_vmbus_channel_close_internal(hv_vmbus_channel *channel)
 {
-   int ret = 0;
+   struct vmbus_softc *sc = channel->vmbus_sc;
+   struct vmbus_msghc *mh;
+   struct vmbus_chanmsg_chclose *req;
struct taskqueue *rxq = channel->rxq;
-   hv_vmbus_channel_close_channel* msg;
-   hv_vmbus_channel_msg_info* info;
+   int error;
 
channel->state = HV_CHANNEL_OPEN_STATE;
 
@@ -504,20 +505,31 @@ hv_vmbus_channel_close_internal(hv_vmbus
/**
 * Send a closing message
 */
-   info = (hv_vmbus_channel_msg_info *)
-   malloc( sizeof(hv_vmbus_channel_msg_info) +
-   sizeof(hv_vmbus_channel_close_channel),
-   M_DEVBUF, M_NOWAIT);
-   KASSERT(info != NULL, ("VMBUS: malloc failed hv_vmbus_channel_close!"));
-   if(info == NULL)
-   return;
-
-   msg = (hv_vmbus_channel_close_channel*) info->msg;
-   msg->header.message_type = HV_CHANNEL_MESSAGE_CLOSE_CHANNEL;
-   msg->child_rel_id = channel->offer_msg.child_rel_id;
 
-   ret = hv_vmbus_post_message(
-   msg, sizeof(hv_vmbus_channel_close_channel));
+   mh = vmbus_msghc_get(sc, sizeof(*req));
+   if (mh == NULL) {
+   device_printf(sc->vmbus_dev,
+   "can not get msg hypercall for chclose(chan%u)\n",
+   channel->offer_msg.child_rel_id);
+   return;
+   }
+
+   req = vmbus_msghc_dataptr(mh);
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE;
+   req->chm_chanid = channel->offer_msg.child_rel_id;
+
+   error = vmbus_msghc_exec_noresult(mh);
+   vmbus_msghc_put(sc, mh);
+
+   if (error) {
+   device_printf(sc->vmbus_dev,
+   "chclose(chan%u) msg hypercall exec failed: %d\n",
+   channel->offer_msg.child_rel_id, error);
+   return;
+   } else if (bootverbose) {
+   device_printf(sc->vmbus_dev, "close chan%u\n",
+   channel->offer_msg.child_rel_id);
+   }
 
/* Tear down the gpadl for the channel's ring buffer */
if (channel->ring_buffer_gpadl_handle) {
@@ -533,8 +545,6 @@ hv_vmbus_channel_close_internal(hv_vmbus
 
contigfree(channel->ring_buffer_pages, channel->ring_buffer_size,
M_DEVBUF);
-
-   free(info, M_DEVBUF);
 }
 
 /**

Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_reg.h   Tue Jul 12 03:19:40 2016
(r302609)
+++ head/sys/dev/hyperv/vmbus/vmbus_reg.h   Tue Jul 12 03:25:36 2016
(r302610)
@@ -96,6 +96,7 @@ struct vmbus_gpa_range {
 #define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3   /* REQ */
 #define VMBUS_CHANMSG_TYPE_CHOPEN  5   /* REQ */
 #define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6   /* RESP */
+#define VMBUS_CHANMSG_TYPE_CHCLOSE 7   /* REQ */
 #define VMBUS_CHANMSG_TYPE_GPADL_CONN  8   /* REQ */
 #define VMBUS_CHANMSG_TYPE_GPADL_SUBCONN   9   /* REQ */
 #define VMBUS_CHANMSG_TYPE_GPADP_CONNRESP  10  /* RESP */
@@ -190,4 +191,10 @@ struct vmbus_chanmsg_gpadl_connresp {
uint32_tchm_status;
 } __packed;
 
+/* VMBUS_CHANMSG_TYPE_CHCLOSE */
+struct vmbus_chanmsg_chclose {
+   struct vmbus_chanmsg_hdr chm_hdr;
+   uint32_tchm_chanid;
+} __packed;
+
 #endif /* !_VMBUS_REG_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 03:19:40 2016
New Revision: 302609
URL: https://svnweb.freebsd.org/changeset/base/302609

Log:
  hyperv/vmbus: Use post message Hypercall APIs for GPADL connect.
  
  This also fixes memory leakge if sub-connect messages are needed.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6878

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:14:35 2016
(r302608)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:19:40 2016
(r302609)
@@ -49,14 +49,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static int vmbus_channel_create_gpadl_header(
-   /* must be phys and virt contiguous*/
-   void*   contig_buffer,
-   /* page-size multiple */
-   uint32_tsize,
-   hv_vmbus_channel_msg_info** msg_info,
-   uint32_t*   message_count);
-
 static voidvmbus_channel_set_event(hv_vmbus_channel* channel);
 static voidVmbusProcessChannelEvent(void* channel, int pending);
 
@@ -309,241 +301,130 @@ hv_vmbus_channel_open(
 }
 
 /**
- * @brief Create a gpadl for the specified buffer
+ * @brief Establish a GPADL for the specified buffer
  */
-static int
-vmbus_channel_create_gpadl_header(
-   void*   contig_buffer,
-   uint32_tsize,   /* page-size multiple */
-   hv_vmbus_channel_msg_info** msg_info,
-   uint32_t*   message_count)
-{
-   int i;
-   int page_count;
-   unsigned long long  pfn;
-   uint32_tmsg_size;
-   hv_vmbus_channel_gpadl_header*  gpa_header;
-   hv_vmbus_channel_gpadl_body*gpadl_body;
-   hv_vmbus_channel_msg_info*  msg_header;
-   hv_vmbus_channel_msg_info*  msg_body;
+int
+hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel,
+void *contig_buffer, uint32_t size, uint32_t *gpadl0)
+{
+   struct vmbus_softc *sc = channel->vmbus_sc;
+   struct vmbus_msghc *mh;
+   struct vmbus_chanmsg_gpadl_conn *req;
+   const struct vmbus_message *msg;
+   size_t reqsz;
+   uint32_t gpadl, status;
+   int page_count, range_len, i, cnt, error;
+   uint64_t page_id, paddr;
 
-   int pfnSum, pfnCount, pfnLeft, pfnCurr, pfnSize;
+   /*
+* Preliminary checks.
+*/
 
+   KASSERT((size & PAGE_MASK) == 0,
+   ("invalid GPA size %u, not multiple page size", size));
page_count = size >> PAGE_SHIFT;
-   pfn = hv_get_phys_addr(contig_buffer) >> PAGE_SHIFT;
-
-   /*do we need a gpadl body msg */
-   pfnSize = HV_MAX_SIZE_CHANNEL_MESSAGE
-   - sizeof(hv_vmbus_channel_gpadl_header)
-   - sizeof(hv_gpa_range);
-   pfnCount = pfnSize / sizeof(uint64_t);
-
-   if (page_count > pfnCount) { /* if(we need a gpadl body)*/
-   /* fill in the header   */
-   msg_size = sizeof(hv_vmbus_channel_msg_info)
-   + sizeof(hv_vmbus_channel_gpadl_header)
-   + sizeof(hv_gpa_range)
-   + pfnCount * sizeof(uint64_t);
-   msg_header = malloc(msg_size, M_DEVBUF, M_NOWAIT | M_ZERO);
-   KASSERT(
-   msg_header != NULL,
-   ("Error VMBUS: malloc failed to allocate Gpadl Message!"));
-   if (msg_header == NULL)
-   return (ENOMEM);
-
-   TAILQ_INIT(_header->sub_msg_list_anchor);
-   msg_header->message_size = msg_size;
-
-   gpa_header = (hv_vmbus_channel_gpadl_header*) msg_header->msg;
-   gpa_header->range_count = 1;
-   gpa_header->range_buf_len = sizeof(hv_gpa_range)
-   + page_count * sizeof(uint64_t);
-   gpa_header->range[0].byte_offset = 0;
-   gpa_header->range[0].byte_count = size;
-   for (i = 0; i < pfnCount; i++) {
-   gpa_header->range[0].pfn_array[i] = pfn + i;
-   }
-   *msg_info = msg_header;
-   *message_count = 1;
-
-   pfnSum = pfnCount;
-   pfnLeft = page_count - pfnCount;
-
-   /*
-*  figure out how many pfns we can fit
-*/
-   pfnSize = HV_MAX_SIZE_CHANNEL_MESSAGE
-   - sizeof(hv_vmbus_channel_gpadl_body);
-   pfnCount = pfnSize / sizeof(uint64_t);
-
-   /*
-* fill in the body
-

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 03:14:35 2016
New Revision: 302608
URL: https://svnweb.freebsd.org/changeset/base/302608

Log:
  hyperv/vmbus: Remove unnecessary check and unapplied comment
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6877

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

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:09:10 2016
(r302607)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:14:35 2016
(r302608)
@@ -975,23 +975,6 @@ VmbusProcessChannelEvent(void* context, 
hv_vmbus_channel* channel = (hv_vmbus_channel*)context;
boolean_t is_batched_reading;
 
-   /**
-* Find the channel based on this relid and invokes
-* the channel callback to process the event
-*/
-
-   if (channel == NULL) {
-   return;
-   }
-   /**
-* To deal with the race condition where we might
-* receive a packet while the relevant driver is
-* being unloaded, dispatch the callback while
-* holding the channel lock. The unloading driver
-* will acquire the same channel lock to set the
-* callback to NULL. This closes the window.
-*/
-
if (channel->on_channel_callback != NULL) {
arg = channel->channel_callback_context;
is_batched_reading = channel->batched_reading;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 03:09:10 2016
New Revision: 302607
URL: https://svnweb.freebsd.org/changeset/base/302607

Log:
  hyperv/vmbus: Use post message Hypercall APIs for channel open
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6876

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:03:17 2016
(r302606)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Tue Jul 12 03:09:10 2016
(r302607)
@@ -182,11 +182,21 @@ hv_vmbus_channel_open(
hv_vmbus_pfn_channel_callback   pfn_on_channel_callback,
void*   context)
 {
-
+   struct vmbus_softc *sc = new_channel->vmbus_sc;
+   const struct vmbus_chanmsg_chopen_resp *resp;
+   const struct vmbus_message *msg;
+   struct vmbus_chanmsg_chopen *req;
+   struct vmbus_msghc *mh;
+   uint32_t status;
int ret = 0;
void *in, *out;
-   hv_vmbus_channel_open_channel*  open_msg;
-   hv_vmbus_channel_msg_info*  open_info;
+
+   if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) {
+   device_printf(sc->vmbus_dev,
+   "invalid udata len %u for chan%u\n",
+   user_data_len, new_channel->offer_msg.child_rel_id);
+   return EINVAL;
+   }
 
mtx_lock(_channel->sc_lock);
if (new_channel->state == HV_CHANNEL_OPEN_STATE) {
@@ -248,76 +258,53 @@ hv_vmbus_channel_open(
send_ring_buffer_size + recv_ring_buffer_size,
_channel->ring_buffer_gpadl_handle);
 
-   /**
-* Create and init the channel open message
+   /*
+* Open channel w/ the bufring GPADL on the target CPU.
 */
-   open_info = (hv_vmbus_channel_msg_info*) malloc(
-   sizeof(hv_vmbus_channel_msg_info) +
-   sizeof(hv_vmbus_channel_open_channel),
-   M_DEVBUF,
-   M_NOWAIT);
-   KASSERT(open_info != NULL,
-   ("Error VMBUS: malloc failed to allocate Open Channel message!"));
-
-   if (open_info == NULL)
-   return (ENOMEM);
-
-   sema_init(_info->wait_sema, 0, "Open Info Sema");
-
-   open_msg = (hv_vmbus_channel_open_channel*) open_info->msg;
-   open_msg->header.message_type = HV_CHANNEL_MESSAGE_OPEN_CHANNEL;
-   open_msg->open_id = new_channel->offer_msg.child_rel_id;
-   open_msg->child_rel_id = new_channel->offer_msg.child_rel_id;
-   open_msg->ring_buffer_gpadl_handle =
-   new_channel->ring_buffer_gpadl_handle;
-   open_msg->downstream_ring_buffer_page_offset = send_ring_buffer_size
-   >> PAGE_SHIFT;
-   open_msg->target_vcpu = new_channel->target_vcpu;
-
+   mh = vmbus_msghc_get(sc, sizeof(*req));
+   if (mh == NULL) {
+   device_printf(sc->vmbus_dev,
+   "can not get msg hypercall for chopen(chan%u)\n",
+   new_channel->offer_msg.child_rel_id);
+   return ENXIO;
+   }
+
+   req = vmbus_msghc_dataptr(mh);
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN;
+   req->chm_chanid = new_channel->offer_msg.child_rel_id;
+   req->chm_openid = new_channel->offer_msg.child_rel_id;
+   req->chm_gpadl = new_channel->ring_buffer_gpadl_handle;
+   req->chm_vcpuid = new_channel->target_vcpu;
+   req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT;
if (user_data_len)
-   memcpy(open_msg->user_data, user_data, user_data_len);
-
-   mtx_lock(_vmbus_g_connection.channel_msg_lock);
-   TAILQ_INSERT_TAIL(
-   _vmbus_g_connection.channel_msg_anchor,
-   open_info,
-   msg_list_entry);
-   mtx_unlock(_vmbus_g_connection.channel_msg_lock);
-
-   ret = hv_vmbus_post_message(
-   open_msg, sizeof(hv_vmbus_channel_open_channel));
-
-   if (ret != 0)
-   goto cleanup;
-
-   ret = sema_timedwait(_info->wait_sema, 5 * hz); /* KYS 5 seconds */
+   memcpy(req->chm_udata, user_data, user_data_len);
 
-   if (ret) {
-   if(bootverbose)
-   printf("VMBUS: channel <%p> open timeout.\n", new_channel);
-   goto cleanup;
+   ret = vmbus_msghc_exec(sc, mh);
+   if (ret != 0) {
+   device_printf(sc->vmbus_dev,
+   "chopen(chan%u) msg hypercall exec failed: %d\n",
+   new_channel->offer_msg.child_rel_id, ret);
+   vmbus_msghc_put(sc, mh);
+   return ret;
}
 
-   if (open_info->response.open_result.status == 0) {
-   new_channel->state = HV_CHANNEL_OPENED_STATE;
-   if(bootverbose)

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 03:03:17 2016
New Revision: 302606
URL: https://svnweb.freebsd.org/changeset/base/302606

Log:
  hyperv/vmbus: Reorganize vmbus scan process.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6875

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

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 02:57:13 2016
(r302605)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:03:17 2016
(r302606)
@@ -80,14 +80,6 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE
vmbus_channel_on_version_response
 };
 
-static struct mtx  vmbus_chwait_lock;
-MTX_SYSINIT(vmbus_chwait_lk, _chwait_lock, "vmbus primarych wait lock",
-MTX_DEF);
-static uint32_tvmbus_chancnt;
-static uint32_tvmbus_devcnt;
-
-#define VMBUS_CHANCNT_DONE 0x8000
-
 /**
  * @brief Allocate and initialize a vmbus channel object
  */
@@ -124,7 +116,6 @@ static void
 vmbus_channel_process_offer(hv_vmbus_channel *new_channel)
 {
hv_vmbus_channel*   channel;
-   int ret;
uint32_trelid;
 
relid = new_channel->offer_msg.child_rel_id;
@@ -229,19 +220,8 @@ vmbus_channel_process_offer(hv_vmbus_cha
 * binding which eventually invokes the device driver's AddDevice()
 * method.
 */
-   ret = hv_vmbus_child_device_register(new_channel->device);
-   if (ret != 0) {
-   mtx_lock(_vmbus_g_connection.channel_lock);
-   TAILQ_REMOVE(_vmbus_g_connection.channel_anchor,
-   new_channel, list_entry);
-   mtx_unlock(_vmbus_g_connection.channel_lock);
-   hv_vmbus_free_vmbus_channel(new_channel);
-   }
-
-   mtx_lock(_chwait_lock);
-   vmbus_devcnt++;
-   mtx_unlock(_chwait_lock);
-   wakeup(_devcnt);
+   hv_vmbus_child_device_register(new_channel->vmbus_sc,
+   new_channel->device);
 }
 
 void
@@ -332,10 +312,8 @@ vmbus_channel_on_offer(struct vmbus_soft
 {
const hv_vmbus_channel_offer_channel *offer;
 
-   mtx_lock(_chwait_lock);
-   if ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0)
-   vmbus_chancnt++;
-   mtx_unlock(_chwait_lock);
+   /* New channel is offered by vmbus */
+   vmbus_scan_newchan(sc);
 
offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data;
vmbus_channel_on_offer_internal(sc, offer);
@@ -428,14 +406,12 @@ vmbus_chan_detach_task(void *xchan, int 
  * @brief Invoked when all offers have been delivered.
  */
 static void
-vmbus_channel_on_offers_delivered(struct vmbus_softc *sc __unused,
+vmbus_channel_on_offers_delivered(struct vmbus_softc *sc,
 const struct vmbus_message *msg __unused)
 {
 
-   mtx_lock(_chwait_lock);
-   vmbus_chancnt |= VMBUS_CHANCNT_DONE;
-   mtx_unlock(_chwait_lock);
-   wakeup(_chancnt);
+   /* No more new channels for the channel request. */
+   vmbus_scan_done(sc);
 }
 
 /**
@@ -668,21 +644,6 @@ vmbus_select_outgoing_channel(struct hv_
return(outgoing_channel);
 }
 
-void
-vmbus_scan(void)
-{
-   uint32_t chancnt;
-
-   mtx_lock(_chwait_lock);
-   while ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0)
-   mtx_sleep(_chancnt, _chwait_lock, 0, "waitch", 0);
-   chancnt = vmbus_chancnt & ~VMBUS_CHANCNT_DONE;
-
-   while (vmbus_devcnt != chancnt)
-   mtx_sleep(_devcnt, _chwait_lock, 0, "waitdev", 0);
-   mtx_unlock(_chwait_lock);
-}
-
 struct hv_vmbus_channel **
 vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt)
 {

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 02:57:13 2016
(r302605)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Jul 12 03:03:17 2016
(r302606)
@@ -411,7 +411,9 @@ struct hv_device*   hv_vmbus_child_device_
hv_guid device_instance,
hv_vmbus_channel*channel);
 
-inthv_vmbus_child_device_register(
+struct vmbus_softc;
+
+void   hv_vmbus_child_device_register(struct vmbus_softc *,
struct hv_device *child_dev);
 inthv_vmbus_child_device_unregister(
struct hv_device *child_dev);
@@ -419,13 +421,9 @@ int
hv_vmbus_child_device_unregister(
 /**
  * Connection interfaces
  */
-struct vmbus_softc;
 int

svn commit: r302605 - head/sys/dev/hyperv/storvsc

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Jul 12 02:57:13 2016
New Revision: 302605
URL: https://svnweb.freebsd.org/changeset/base/302605

Log:
  hyperv/stor: Save the response status and xfer length properly.
  
  The current command response handling discards status and xfer
  length unconditionally, so that all of the commands would be
  considered successful, even if errors happened.  When errors
  really happens, this causes all kinds of wiredness, since the
  buffer will not be filled on the host side and sense data will
  be ignored.
  
  Most of the time, errors do not happen, however, error does
  happen for the request sent immediately after the disk resizing.
  Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense
  data (capacity changes) prevents the disk resizing from working
  properly.
  
  This commit saves the response status and xfer length properly
  for later use.
  
  Submitted by: Dexuan Cui 
  Noticed by:   sephe
  MFC after:3 days
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D7181

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cTue Jul 12 
02:16:48 2016(r302604)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cTue Jul 12 
02:57:13 2016(r302605)
@@ -805,6 +805,13 @@ hv_storvsc_on_iocompletion(struct storvs
 
vm_srb = _packet->u.vm_srb;
 
+   /*
+* Copy some fields of the host's response into the request structure,
+* because the fields will be used later in storvsc_io_done().
+*/
+   request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status;
+   request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len;
+
if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) &&
(vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) {
/* Autosense data available */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302604 - in head/sys/dev/bhnd: . bhndb

2016-07-11 Thread Landon J. Fuller
Author: landonf
Date: Tue Jul 12 02:16:48 2016
New Revision: 302604
URL: https://svnweb.freebsd.org/changeset/base/302604

Log:
  bhnd(4): Add bus pass-aware discovery of platform devices (PMU,
  NVRAM, ChipCommon, etc).
  
  This extends the existing handling of NVRAM core discovery to support
  locating additional devices that may be attached either directly as real
  cores, or indirectly via ChipCommon (e.g. bhnd_pmu).
  
  When attached as a SoC root bus (as opposed to a bridged WiFi device),
  the platform devices may not be attached until later bus passes,
  necessitating delayed discovery/initialization.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D6962

Modified:
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndvar.h

Modified: head/sys/dev/bhnd/bhnd.c
==
--- head/sys/dev/bhnd/bhnd.cTue Jul 12 02:12:31 2016(r302603)
+++ head/sys/dev/bhnd/bhnd.cTue Jul 12 02:16:48 2016(r302604)
@@ -58,11 +58,20 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
+#include "bhnd_chipc_if.h"
+#include "bhnd_nvram_if.h"
+
 #include "bhnd.h"
 #include "bhndvar.h"
 
 MALLOC_DEFINE(M_BHND, "bhnd", "bhnd bus data structures");
 
+/* Bus pass at which all bus-required children must be available, and
+ * attachment may be finalized. */
+#defineBHND_FINISH_ATTACH_PASS BUS_PASS_DEFAULT
+
 /**
  * bhnd_generic_probe_nomatch() reporting configuration.
  */
@@ -80,10 +89,22 @@ static const struct bhnd_nomatch {
{ BHND_MFGID_INVALID,   BHND_COREID_INVALID,false   }
 };
 
-static int compare_ascending_probe_order(const void *lhs,
-   const void *rhs);
-static int compare_descending_probe_order(const void *lhs,
-   const void *rhs);
+
+static int  bhnd_delete_children(struct bhnd_softc *sc);
+
+static int  bhnd_finish_attach(struct bhnd_softc *sc);
+
+static device_t bhnd_find_chipc(struct bhnd_softc *sc);
+static struct chipc_caps   *bhnd_find_chipc_caps(struct bhnd_softc *sc);
+static device_t bhnd_find_platform_dev(struct 
bhnd_softc *sc,
+const char *classname);
+static device_t bhnd_find_pmu(struct bhnd_softc *sc);
+static device_t bhnd_find_nvram(struct bhnd_softc *sc);
+
+static int  compare_ascending_probe_order(const void *lhs,
+const void *rhs);
+static int  compare_descending_probe_order(const void *lhs,
+const void *rhs);
 
 /**
  * Default bhnd(4) bus driver implementation of DEVICE_ATTACH().
@@ -94,44 +115,53 @@ static int compare_descending_probe_orde
 int
 bhnd_generic_attach(device_t dev)
 {
-   device_t*devs;
-   int  ndevs;
-   int  error;
+   struct bhnd_softc   *sc;
+   device_t*devs;
+   int  ndevs;
+   int  error;
 
if (device_is_attached(dev))
return (EBUSY);
 
+   sc = device_get_softc(dev);
+   sc->dev = dev;
+
if ((error = device_get_children(dev, , )))
return (error);
 
+   /* Probe and attach all children */
qsort(devs, ndevs, sizeof(*devs), compare_ascending_probe_order);
for (int i = 0; i < ndevs; i++) {
device_t child = devs[i];
device_probe_and_attach(child);
}
 
+   /* Try to finalize attachment */
+   if (bus_current_pass >= BHND_FINISH_ATTACH_PASS) {
+   if ((error = bhnd_finish_attach(sc)))
+   goto cleanup;
+   }
+
+cleanup:
free(devs, M_TEMP);
-   return (0);
+
+   if (error)
+   bhnd_delete_children(sc);
+
+   return (error);
 }
 
 /**
- * Default bhnd(4) bus driver implementation of DEVICE_DETACH().
- *
- * This implementation calls device_detach() for each of the device's
- * children, in reverse bhnd probe order, terminating if any call to
- * device_detach() fails.
+ * Detach and delete all children, in reverse of their attach order.
  */
-int
-bhnd_generic_detach(device_t dev)
+static int
+bhnd_delete_children(struct bhnd_softc *sc)
 {
-   device_t*devs;
-   int  ndevs;
-   int  error;
+   device_t*devs;
+   int  ndevs;
+   int  error;
 
-   if (!device_is_attached(dev))
-   return (EBUSY);
-
-   if ((error = device_get_children(dev, , )))
+   if ((error = device_get_children(sc->dev, , )))
return (error);
 
/* Detach in 

svn commit: r302603 - head/sys/mips/mips

2016-07-11 Thread Landon J. Fuller
Author: landonf
Date: Tue Jul 12 02:12:31 2016
New Revision: 302603
URL: https://svnweb.freebsd.org/changeset/base/302603

Log:
  mips/ddb: fix MIPS backtrace truncation and MIPS32 register printing.
  
   - Cast 32-bit register values to uintmax_t for use with %jx.
   - Add special-case return address handling for MipsKernGenException to
 avoid early termination of stack walking in the exception handler
 stack frame.
  
  Submitted by: Michael Zhilin 
  Reviewed by:  ray
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D6907

Modified:
  head/sys/mips/mips/db_trace.c

Modified: head/sys/mips/mips/db_trace.c
==
--- head/sys/mips/mips/db_trace.c   Tue Jul 12 01:15:00 2016
(r302602)
+++ head/sys/mips/mips/db_trace.c   Tue Jul 12 02:12:31 2016
(r302603)
@@ -144,6 +144,7 @@ stacktrace_subr(register_t pc, register_
unsigned instr, mask;
unsigned int frames = 0;
int more, stksize, j;
+   register_t  next_ra;
 
 /* Jump here when done with a frame, to start a new one */
 loop:
@@ -155,6 +156,7 @@ loop:
valid_args[1] = 0;
valid_args[2] = 0;
valid_args[3] = 0;
+   next_ra = 0;
 /* Jump here after a nonstandard (interrupt handler) frame */
stksize = 0;
subr = 0;
@@ -288,9 +290,17 @@ loop:
/* look for saved registers on the stack */
if (i.IType.rs != 29)
break;
-   /* only restore the first one */
-   if (mask & (1 << i.IType.rt))
+   /*
+* only restore the first one except RA for
+* MipsKernGenException case
+*/
+   if (mask & (1 << i.IType.rt)) {
+   if (subr == (uintptr_t)MipsKernGenException &&
+   i.IType.rt == 31)
+   next_ra = kdbpeek((int *)(sp +
+   (short)i.IType.imm));
break;
+   }
mask |= (1 << i.IType.rt);
switch (i.IType.rt) {
case 4:/* a0 */
@@ -374,7 +384,10 @@ done:
(*printfn)("?");
}
 
-   (*printfn) (") ra %jx sp %jx sz %d\n", ra, sp, stksize);
+   (*printfn) (") ra %jx sp %jx sz %d\n",
+   (uintmax_t)(u_register_t) ra,
+   (uintmax_t)(u_register_t) sp,
+   stksize);
 
if (ra) {
if (pc == ra && stksize == 0)
@@ -382,7 +395,7 @@ done:
else {
pc = ra;
sp += stksize;
-   ra = 0;
+   ra = next_ra;
goto loop;
}
} else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302602 - head/sys/dev/bhnd/cores/chipc

2016-07-11 Thread Landon J. Fuller
Author: landonf
Date: Tue Jul 12 01:15:00 2016
New Revision: 302602
URL: https://svnweb.freebsd.org/changeset/base/302602

Log:
  bhnd(4): print extra register information on chipc SPI timeout.
  
  Submitted by: Michael Zhilin 
  Reviewed by:  imp
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D6993

Modified:
  head/sys/dev/bhnd/cores/chipc/chipc_spi.c

Modified: head/sys/dev/bhnd/cores/chipc/chipc_spi.c
==
--- head/sys/dev/bhnd/cores/chipc/chipc_spi.c   Tue Jul 12 00:37:48 2016
(r302601)
+++ head/sys/dev/bhnd/cores/chipc/chipc_spi.c   Tue Jul 12 01:15:00 2016
(r302602)
@@ -184,7 +184,9 @@ chipc_spi_wait(struct chipc_spi_softc *s
if (i > 0)
return (0);
 
-   BHND_DEBUG_DEV(sc->sc_dev, "busy");
+   BHND_WARN_DEV(sc->sc_dev, "busy: CTL=0x%x DATA=0x%x",
+   SPI_READ(sc, CHIPC_SPI_FLASHCTL),
+   SPI_READ(sc, CHIPC_SPI_FLASHDATA));
return (-1);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302601 - in head/sys: arm/include arm64/include

2016-07-11 Thread Andrey A. Chernov
Author: ache
Date: Tue Jul 12 00:37:48 2016
New Revision: 302601
URL: https://svnweb.freebsd.org/changeset/base/302601

Log:
  I don't know why unsigned int is choosed for wchar_t here, but WCHAR_MAX
  should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX

Modified:
  head/sys/arm/include/_types.h
  head/sys/arm64/include/_types.h

Modified: head/sys/arm/include/_types.h
==
--- head/sys/arm/include/_types.h   Mon Jul 11 23:15:54 2016
(r302600)
+++ head/sys/arm/include/_types.h   Tue Jul 12 00:37:48 2016
(r302601)
@@ -107,7 +107,7 @@ typedef __uint32_t  __vm_size_t;
 
 typedefunsigned int___wchar_t;
 #define__WCHAR_MIN 0   /* min value for a wchar_t */
-#define__WCHAR_MAX __UINT_MAX  /* max value for a wchar_t */
+#define__WCHAR_MAX __INT_MAX   /* max for a wchar_t <= 
WINT_MAX */
 
 /*
  * Unusual type definitions.

Modified: head/sys/arm64/include/_types.h
==
--- head/sys/arm64/include/_types.h Mon Jul 11 23:15:54 2016
(r302600)
+++ head/sys/arm64/include/_types.h Tue Jul 12 00:37:48 2016
(r302601)
@@ -95,7 +95,7 @@ typedef   __uint64_t  __vm_size_t;
 typedefunsigned int___wchar_t;
 
 #define__WCHAR_MIN 0   /* min value for a wchar_t */
-#define__WCHAR_MAX __UINT_MAX  /* max value for a wchar_t */
+#define__WCHAR_MAX __INT_MAX   /* max for a wchar_t <= 
WINT_MAX */
 
 /*
  * Unusual type definitions.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302600 - in stable/10: etc/defaults usr.sbin/periodic

2016-07-11 Thread Alan Somers
Author: asomers
Date: Mon Jul 11 23:15:54 2016
New Revision: 302600
URL: https://svnweb.freebsd.org/changeset/base/302600

Log:
  MFC r300356
  
  Better document security_show_{success,info,badconfig} in /etc/periodic.conf
  
  periodic(8) already handles the security_show_{success,info,badconfig}
  variables correctly. However, those variables aren't explicitly set in
  /etc/defaults/periodic.conf or anywhere else, which suggests to the user
  that they shouldn't be used.
  
  etc/defaults/periodic.conf
  Explicitly set defaults for security_show_{success,info,badconfig}
  
  usr.sbin/periodic/periodic.sh
  Update usage string
  
  usr.sbin/periodic/periodic.8
  Minor man page updates
  
  One thing I'm _not_ doing is recommending setting security_output to
  /var/log/security.log or adding that file to /etc/newsyslog.conf, because
  periodic(8) would create it with default permissions, usually 644, and
  that's probably a bad idea.

Modified:
  stable/10/etc/defaults/periodic.conf
  stable/10/usr.sbin/periodic/periodic.8
  stable/10/usr.sbin/periodic/periodic.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/defaults/periodic.conf
==
--- stable/10/etc/defaults/periodic.confMon Jul 11 23:06:11 2016
(r302599)
+++ stable/10/etc/defaults/periodic.confMon Jul 11 23:15:54 2016
(r302600)
@@ -225,6 +225,10 @@ monthly_local="/etc/monthly.local" # L
 
 # Security options
 
+security_show_success="YES"# scripts returning 0
+security_show_info="YES"   # scripts returning 1
+security_show_badconfig="NO"   # scripts returning 2
+
 # These options are used by the security periodic(8) scripts spawned in
 # daily and weekly 450.status-security.
 security_status_logdir="/var/log"  # Directory for logs

Modified: stable/10/usr.sbin/periodic/periodic.8
==
--- stable/10/usr.sbin/periodic/periodic.8  Mon Jul 11 23:06:11 2016
(r302599)
+++ stable/10/usr.sbin/periodic/periodic.8  Mon Jul 11 23:15:54 2016
(r302600)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 30, 2007
+.Dd May 20, 2016
 .Dt PERIODIC 8
 .Os
 .Sh NAME
@@ -166,8 +166,9 @@ table
 the top level directory containing
 .Pa daily ,
 .Pa weekly ,
+.Pa monthly ,
 and
-.Pa monthly
+.Pa security
 subdirectories which contain standard system periodic executables
 .It Pa /etc/defaults/periodic.conf
 the
@@ -175,9 +176,9 @@ the
 system registry contains variables that control the behaviour of
 .Nm
 and the standard
-.Pa daily , weekly ,
+.Pa daily , weekly , monthly ,
 and
-.Pa monthly
+.Pa security
 scripts
 .It Pa /etc/periodic.conf
 this file contains local overrides for the default

Modified: stable/10/usr.sbin/periodic/periodic.sh
==
--- stable/10/usr.sbin/periodic/periodic.sh Mon Jul 11 23:06:11 2016
(r302599)
+++ stable/10/usr.sbin/periodic/periodic.sh Mon Jul 11 23:15:54 2016
(r302600)
@@ -4,13 +4,13 @@
 #
 # Run nightly periodic scripts
 #
-# usage: periodic { daily | weekly | monthly } - run standard periodic scripts
+# usage: periodic { daily | weekly | monthly | security } - run standard 
scripts
 #periodic /absolute/path/to/directory  - run periodic scripts in dir
 #
 
 usage () {
 echo "usage: $0 " 1>&2
-echo "or $0 { daily | weekly | monthly }"1>&2
+echo "or $0 { daily | weekly | monthly | security }"1>&2
 exit 1
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302599 - head/usr.bin/tr

2016-07-11 Thread Andrey A. Chernov
Author: ache
Date: Mon Jul 11 23:06:11 2016
New Revision: 302599
URL: https://svnweb.freebsd.org/changeset/base/302599

Log:
  Cast WCHAR_MAX to wint_t, it can be unsigned on some systems.

Modified:
  head/usr.bin/tr/tr.c

Modified: head/usr.bin/tr/tr.c
==
--- head/usr.bin/tr/tr.cMon Jul 11 23:01:58 2016(r302598)
+++ head/usr.bin/tr/tr.cMon Jul 11 23:06:11 2016(r302599)
@@ -266,7 +266,7 @@ endloop:
 */
s2.str = argv[1];
s2.state = NORMAL;
-   for (cnt = 0; cnt <= WCHAR_MAX; cnt++) {
+   for (cnt = 0; cnt <= (wint_t)WCHAR_MAX; cnt++) {
if (Cflag && !iswrune(cnt))
continue;
if (cmap_lookup(map, cnt) == OOBCH) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302596 - head

2016-07-11 Thread Glen Barber
Author: gjb
Date: Mon Jul 11 21:55:56 2016
New Revision: 302596
URL: https://svnweb.freebsd.org/changeset/base/302596

Log:
  Fix TARGET_TRIPLE for 12.0-CURRENT.
  
  Submitted by: rene
  Sponsored by: The FreeBSD Foundation

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Jul 11 21:25:28 2016(r302595)
+++ head/Makefile.inc1  Mon Jul 11 21:55:56 2016(r302596)
@@ -555,7 +555,7 @@ XCXXFLAGS+= -isystem ${WORLDTMP}/usr/inc
 .endif
 .else
 TARGET_ABI?=   unknown
-TARGET_TRIPLE?=${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
+TARGET_TRIPLE?=${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0
 XCFLAGS+=  -target ${TARGET_TRIPLE}
 .endif
 XCFLAGS+=  --sysroot=${WORLDTMP}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302595 - in head/sys: kern net

2016-07-11 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Jul 11 21:25:28 2016
New Revision: 302595
URL: https://svnweb.freebsd.org/changeset/base/302595

Log:
  Remove assumptions in MI code that the BSP is CPU 0.
  
  MFC after:2 weeks

Modified:
  head/sys/kern/init_main.c
  head/sys/net/netisr.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Mon Jul 11 21:23:50 2016(r302594)
+++ head/sys/kern/init_main.c   Mon Jul 11 21:25:28 2016(r302595)
@@ -495,7 +495,7 @@ proc0_init(void *dummy __unused)
td->td_lend_user_pri = PRI_MAX;
td->td_priority = PVM;
td->td_base_pri = PVM;
-   td->td_oncpu = 0;
+   td->td_oncpu = curcpu;
td->td_flags = TDF_INMEM;
td->td_pflags = TDP_KTHREAD;
td->td_cpuset = cpuset_thread0();

Modified: head/sys/net/netisr.c
==
--- head/sys/net/netisr.c   Mon Jul 11 21:23:50 2016(r302594)
+++ head/sys/net/netisr.c   Mon Jul 11 21:25:28 2016(r302595)
@@ -1273,8 +1273,6 @@ netisr_init(void *arg)
struct pcpu *pc;
 #endif
 
-   KASSERT(curcpu == 0, ("%s: not on CPU 0", __func__));
-
NETISR_LOCK_INIT();
if (netisr_maxthreads == 0 || netisr_maxthreads < -1 )
netisr_maxthreads = 1;  /* default behavior */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302594 - head/usr.bin/tr

2016-07-11 Thread Andrey A. Chernov
Author: ache
Date: Mon Jul 11 21:23:50 2016
New Revision: 302594
URL: https://svnweb.freebsd.org/changeset/base/302594

Log:
  1) Following r302512 (remove collation support for [a-z]-ranges in libc)
  remove collation support for a-z ranges here too.
  It was implemented for single byte locales only in any case.
  
  2) Reduce [Cc]flag loop to WCHAR_MAX, WINT_MAX here includes WEOF which is
  not a character.
  
  3) Optimize [Cc]flag case: don't repeatedly add the last character of
  string2 to squeeze cset when string2 reach its EOS state.
  
  4) Reflect in the manpage that [=equiv=] is implemented for single
  byte locales only.

Modified:
  head/usr.bin/tr/str.c
  head/usr.bin/tr/tr.1
  head/usr.bin/tr/tr.c

Modified: head/usr.bin/tr/str.c
==
--- head/usr.bin/tr/str.c   Mon Jul 11 20:15:46 2016(r302593)
+++ head/usr.bin/tr/str.c   Mon Jul 11 21:23:50 2016(r302594)
@@ -53,7 +53,7 @@ static int  backslash(STR *, int *);
 static int bracket(STR *);
 static voidgenclass(STR *);
 static voidgenequiv(STR *);
-static int  genrange(STR *, int);
+static int genrange(STR *);
 static voidgenseq(STR *);
 
 wint_t
@@ -93,7 +93,7 @@ next(STR *s)
}
 
/* We can start a range at any time. */
-   if (s->str[0] == '-' && genrange(s, is_octal))
+   if (s->str[0] == '-' && genrange(s))
return (next(s));
return (1);
case RANGE:
@@ -237,18 +237,16 @@ genequiv(STR *s)
 }
 
 static int
-genrange(STR *s, int was_octal)
+genrange(STR *s)
 {
-   int stopval, octal;
+   int stopval;
char *savestart;
-   int n, cnt, *p;
size_t clen;
wchar_t wc;
 
-   octal = 0;
savestart = s->str;
if (*++s->str == '\\')
-   stopval = backslash(s, );
+   stopval = backslash(s, NULL);
else {
clen = mbrtowc(, s->str, MB_LEN_MAX, NULL);
if (clen == (size_t)-1 || clen == (size_t)-2)
@@ -256,37 +254,13 @@ genrange(STR *s, int was_octal)
stopval = wc;
s->str += clen;
}
-   /*
-* XXX Characters are not ordered according to collating sequence in
-* multibyte locales.
-*/
-   if (octal || was_octal || MB_CUR_MAX > 1) {
-   if (stopval < s->lastch) {
-   s->str = savestart;
-   return (0);
-   }
-   s->cnt = stopval - s->lastch + 1;
-   s->state = RANGE;
-   --s->lastch;
-   return (1);
-   }
-   if (charcoll((const void *), (const void *)&(s->lastch)) < 0) {
+   if (stopval < s->lastch) {
s->str = savestart;
return (0);
}
-   if ((s->set = p = malloc((NCHARS_SB + 1) * sizeof(int))) == NULL)
-   err(1, "genrange() malloc");
-   for (cnt = 0; cnt < NCHARS_SB; cnt++)
-   if (charcoll((const void *), (const void *)&(s->lastch)) >= 
0 &&
-   charcoll((const void *), (const void *)) <= 0)
-   *p++ = cnt;
-   *p = OOBCH;
-   n = p - s->set;
-
-   s->cnt = 0;
-   s->state = SET;
-   if (n > 1)
-   mergesort(s->set, n, sizeof(*(s->set)), charcoll);
+   s->cnt = stopval - s->lastch + 1;
+   s->state = RANGE;
+   --s->lastch;
return (1);
 }
 

Modified: head/usr.bin/tr/tr.1
==
--- head/usr.bin/tr/tr.1Mon Jul 11 20:15:46 2016(r302593)
+++ head/usr.bin/tr/tr.1Mon Jul 11 21:23:50 2016(r302594)
@@ -164,14 +164,6 @@ as defined by the collation sequence.
 If either or both of the range endpoints are octal sequences, it
 represents the range of specific coded values between the
 range endpoints, inclusive.
-.Pp
-.Bf Em
-See the
-.Sx COMPATIBILITY
-section below for an important note regarding
-differences in the way the current
-implementation interprets range expressions differently from
-previous implementations.
 .Ef
 .It [:class:]
 Represents all characters belonging to the defined character class.
@@ -307,22 +299,16 @@ Remove diacritical marks from all accent
 .Pp
 .Dl "tr \*q[=e=]\*q \*qe\*q"
 .Sh COMPATIBILITY
-Previous
 .Fx
 implementations of
 .Nm
 did not order characters in range expressions according to the current
-locale's collation order, making it possible to convert unaccented Latin
-characters (esp.\& as found in English text) from upper to lower case using
+locale's collation order, making it possible to convert accented Latin
+characters from upper to lower case using
 the traditional
 .Ux
 idiom of
 .Dq Li "tr A-Z a-z" .
-Since
-.Nm
-now obeys the locale's collation order, this idiom may not produce
-correct results when there is not a 1:1 mapping 

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

2016-07-11 Thread Ian Lepore
On Mon, 2016-07-11 at 20:14 +, Jared McNeill wrote:
> Author: jmcneill
> Date: Mon Jul 11 20:14:50 2016
> New Revision: 302592
> URL: https://svnweb.freebsd.org/changeset/base/302592
> 
> Log:
>   Return early from bus_dmamap_load callback if the error indicator
> is set.
>   
>   Reviewed by:andrew, manu
> 
> Modified:
>   head/sys/arm/allwinner/a10_mmc.c
> 
> Modified: head/sys/arm/allwinner/a10_mmc.c
> =
> =
> --- head/sys/arm/allwinner/a10_mmc.c  Mon Jul 11 20:13:46 2016
> (r302591)
> +++ head/sys/arm/allwinner/a10_mmc.c  Mon Jul 11 20:14:50 2016
> (r302592)
> @@ -364,6 +364,10 @@ a10_dma_cb(void *arg, bus_dma_segment_t 
>  
>   sc = (struct a10_mmc_softc *)arg;
>   sc->a10_dma_map_err = err;
> +
> + if (err)
> + return;
> +
>   dma_desc = sc->a10_dma_desc;
>   /* Note nsegs is guaranteed to be zero if err is non-zero.
> */
>   for (i = 0; i < nsegs; i++) {
> 

The comment about nsegs g'teed to be zero is now rather moot.  That
comment may have been copied from code I wrote long ago.  I think the
comment is true of the armv4/6 implementations, but it doesn't appear
to be a g'tee made by the busdma manpage.

-- Ian

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


svn commit: r302593 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:15:46 2016
New Revision: 302593
URL: https://svnweb.freebsd.org/changeset/base/302593

Log:
  Add support for Allwinner A64.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/aw_ccu.c
==
--- head/sys/arm/allwinner/aw_ccu.c Mon Jul 11 20:14:50 2016
(r302592)
+++ head/sys/arm/allwinner/aw_ccu.c Mon Jul 11 20:15:46 2016
(r302593)
@@ -80,6 +80,7 @@ static struct ofw_compat_data compat_dat
{ "allwinner,sun7i-a20",CLOCK_CCU },
{ "allwinner,sun6i-a31",CLOCK_CCU },
{ "allwinner,sun6i-a31s",   CLOCK_CCU },
+   { "allwinner,sun50i-a64",   CLOCK_CCU },
{ "allwinner,sun8i-a83t",   CLOCK_CCU|CLOCK_PRCM|CLOCK_SYSCTRL },
{ "allwinner,sun8i-h3", CLOCK_CCU },
{ NULL, 0 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302592 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:14:50 2016
New Revision: 302592
URL: https://svnweb.freebsd.org/changeset/base/302592

Log:
  Return early from bus_dmamap_load callback if the error indicator is set.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/a10_mmc.c
==
--- head/sys/arm/allwinner/a10_mmc.cMon Jul 11 20:13:46 2016
(r302591)
+++ head/sys/arm/allwinner/a10_mmc.cMon Jul 11 20:14:50 2016
(r302592)
@@ -364,6 +364,10 @@ a10_dma_cb(void *arg, bus_dma_segment_t 
 
sc = (struct a10_mmc_softc *)arg;
sc->a10_dma_map_err = err;
+
+   if (err)
+   return;
+
dma_desc = sc->a10_dma_desc;
/* Note nsegs is guaranteed to be zero if err is non-zero. */
for (i = 0; i < nsegs; i++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302591 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:13:46 2016
New Revision: 302591
URL: https://svnweb.freebsd.org/changeset/base/302591

Log:
  Add support for arm64. The allwinner_soc_family() function is not available
  on arm64 and all SoCs using the old FIFO register location are 32-bit only,
  so unconditionally use the new location for arm64.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/a10_mmc.c
==
--- head/sys/arm/allwinner/a10_mmc.cMon Jul 11 20:09:17 2016
(r302590)
+++ head/sys/arm/allwinner/a10_mmc.cMon Jul 11 20:13:46 2016
(r302591)
@@ -182,6 +182,7 @@ a10_mmc_attach(device_t dev)
MTX_DEF);
callout_init_mtx(>a10_timeoutc, >a10_mtx, 0);
 
+#if defined(__arm__)
/*
 * Later chips use a different FIFO offset. Unfortunately the FDT
 * uses the same compatible string for old and new implementations.
@@ -196,6 +197,9 @@ a10_mmc_attach(device_t dev)
sc->a10_fifo_reg = A31_MMC_FIFO;
break;
}
+#else /* __aarch64__ */
+   sc->a10_fifo_reg = A31_MMC_FIFO;
+#endif
 
/* De-assert reset */
if (hwreset_get_by_ofw_name(dev, 0, "ahb", >a10_rst_ahb) == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302590 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:09:17 2016
New Revision: 302590
URL: https://svnweb.freebsd.org/changeset/base/302590

Log:
  Add support for Allwinner A64 CPUx-PORT and CPUs-PORT Port Controllers.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Mon Jul 11 20:06:21 2016
(r302589)
+++ head/sys/arm/allwinner/a10_gpio.c   Mon Jul 11 20:09:17 2016
(r302590)
@@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#if defined(__aarch64__)
+#include "opt_soc.h"
+#endif
+
 #include "gpio_if.h"
 
 #defineA10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | 
\
@@ -116,6 +120,12 @@ extern const struct allwinner_padconf a8
 extern const struct allwinner_padconf a83t_r_padconf;
 #endif
 
+/* Defined in a64_padconf.c */
+#ifdef SOC_ALLWINNER_A64
+extern const struct allwinner_padconf a64_padconf;
+extern const struct allwinner_padconf a64_r_padconf;
+#endif
+
 static struct ofw_compat_data compat_data[] = {
 #ifdef SOC_ALLWINNER_A10
{"allwinner,sun4i-a10-pinctrl", (uintptr_t)_padconf},
@@ -143,6 +153,10 @@ static struct ofw_compat_data compat_dat
{"allwinner,sun8i-h3-pinctrl",  (uintptr_t)_padconf},
{"allwinner,sun8i-h3-r-pinctrl",(uintptr_t)_r_padconf},
 #endif
+#ifdef SOC_ALLWINNER_A64
+   {"allwinner,sun50i-a64-pinctrl",(uintptr_t)_padconf},
+   {"allwinner,sun50i-a64-r-pinctrl",  (uintptr_t)_r_padconf},
+#endif
{NULL,  0}
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302589 - head/sys/arm/allwinner/a64

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:06:21 2016
New Revision: 302589
URL: https://svnweb.freebsd.org/changeset/base/302589

Log:
  Add Allwinner A64 padconf settings.
  
  Reviewed by:  andrew, manu

Added:
  head/sys/arm/allwinner/a64/
  head/sys/arm/allwinner/a64/a64_padconf.c   (contents, props changed)
  head/sys/arm/allwinner/a64/a64_r_padconf.c   (contents, props changed)

Added: head/sys/arm/allwinner/a64/a64_padconf.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/a64/a64_padconf.cMon Jul 11 20:06:21 2016
(r302589)
@@ -0,0 +1,160 @@
+/*-
+ * Copyright (c) 2016 Jared McNeill 
+ * 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, 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.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "opt_soc.h"
+
+#ifdef SOC_ALLWINNER_A64
+
+static const struct allwinner_pins a64_pins[] = {
+   { "PB0",  1, 0,   { "gpio_in", "gpio_out", "uart2", NULL, "jtag", NULL, 
"eint" } },
+   { "PB1",  1, 1,   { "gpio_in", "gpio_out", "uart2", NULL, "jtag", 
"sim", "eint" } },
+   { "PB2",  1, 2,   { "gpio_in", "gpio_out", "uart2", NULL, "jtag", 
"sim", "eint" } },
+   { "PB3",  1, 3,   { "gpio_in", "gpio_out", "uart2", "i2s0", "jtag", 
"sim", "eint" } },
+   { "PB4",  1, 4,   { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", 
"eint" } },
+   { "PB5",  1, 5,   { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", 
"eint" } },
+   { "PB6",  1, 6,   { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", 
"eint" } },
+   { "PB7",  1, 7,   { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", 
"eint" } },
+   { "PB8",  1, 8,   { "gpio_in", "gpio_out", NULL, NULL, "uart0", NULL, 
"eint" } },
+   { "PB9",  1, 9,   { "gpio_in", "gpio_out", NULL, NULL, "uart0", NULL, 
"eint" } },
+
+   { "PC0",  2, 0,   { "gpio_in", "gpio_out", "nand", NULL, "spi0" } },
+   { "PC1",  2, 1,   { "gpio_in", "gpio_out", "nand", "mmc2", "spi0" } },
+   { "PC2",  2, 2,   { "gpio_in", "gpio_out", "nand", NULL, "spi0" } },
+   { "PC3",  2, 3,   { "gpio_in", "gpio_out", "nand", NULL, "spi0" } },
+   { "PC4",  2, 4,   { "gpio_in", "gpio_out", "nand" } },
+   { "PC5",  2, 5,   { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC6",  2, 6,   { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC7",  2, 7,   { "gpio_in", "gpio_out", "nand" } },
+   { "PC8",  2, 8,   { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC9",  2, 9,   { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC10", 2, 10,  { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC11", 2, 11,  { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC12", 2, 12,  { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC13", 2, 13,  { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC14", 2, 14,  { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC15", 2, 15,  { "gpio_in", "gpio_out", "nand", "mmc2" } },
+   { "PC16", 2, 16,  { "gpio_in", "gpio_out", "nand", "mmc2" } },
+
+   { "PD0",  3, 0,   { "gpio_in", "gpio_out", "lcd", "uart3", "spi1", 
"ccir" } },
+   { "PD1",  3, 1,   { "gpio_in", "gpio_out", "lcd", "uart3", "spi1", 
"ccir" } },
+   { "PD2",  3, 2,   { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", 
"ccir" } },
+   { "PD3",  3, 3,   { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", 
"ccir" } },
+   { "PD4",  3, 4,   { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", 
"ccir" } },
+   { "PD5",  3, 5,   { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", 
"ccir" } },
+   { "PD6",  3, 6,   { "gpio_in", 

svn commit: r302588 - head/sys/conf

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:05:03 2016
New Revision: 302588
URL: https://svnweb.freebsd.org/changeset/base/302588

Log:
  Add SOC_ALLWINNER_A64 option for Allwinner A64 (sun50i) SoCs.

Modified:
  head/sys/conf/options.arm64

Modified: head/sys/conf/options.arm64
==
--- head/sys/conf/options.arm64 Mon Jul 11 20:03:31 2016(r302587)
+++ head/sys/conf/options.arm64 Mon Jul 11 20:05:03 2016(r302588)
@@ -8,5 +8,6 @@ THUNDERX_PASS_1_1_ERRATAopt_global.h
 VFPopt_global.h
 
 # SoC Support
+SOC_ALLWINNER_A64  opt_soc.h
 SOC_CAVM_THUNDERX  opt_soc.h
 SOC_HISI_HI6220opt_soc.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302587 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:03:31 2016
New Revision: 302587
URL: https://svnweb.freebsd.org/changeset/base/302587

Log:
  Include sys/rman.h to fix build on arm64.

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

Modified: head/sys/arm/allwinner/aw_nmi.c
==
--- head/sys/arm/allwinner/aw_nmi.c Mon Jul 11 20:02:51 2016
(r302586)
+++ head/sys/arm/allwinner/aw_nmi.c Mon Jul 11 20:03:31 2016
(r302587)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302586 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:02:51 2016
New Revision: 302586
URL: https://svnweb.freebsd.org/changeset/base/302586

Log:
  Attach RSB early. Children of RSB may provide resources necessary for
  other devices such as interrupts, GPIOs, and regulators.

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

Modified: head/sys/arm/allwinner/aw_rsb.c
==
--- head/sys/arm/allwinner/aw_rsb.c Mon Jul 11 20:00:57 2016
(r302585)
+++ head/sys/arm/allwinner/aw_rsb.c Mon Jul 11 20:02:51 2016
(r302586)
@@ -472,6 +472,8 @@ static driver_t rsb_driver = {
 
 static devclass_t rsb_devclass;
 
-DRIVER_MODULE(iicbus, rsb, iicbus_driver, iicbus_devclass, 0, 0);
-DRIVER_MODULE(rsb, simplebus, rsb_driver, rsb_devclass, 0, 0);
+EARLY_DRIVER_MODULE(iicbus, rsb, iicbus_driver, iicbus_devclass, 0, 0,
+BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
+EARLY_DRIVER_MODULE(rsb, simplebus, rsb_driver, rsb_devclass, 0, 0,
+BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
 MODULE_VERSION(rsb, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302585 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 20:00:57 2016
New Revision: 302585
URL: https://svnweb.freebsd.org/changeset/base/302585

Log:
  Build fix for arm64. The phy interface uses intptr_t for the "phy"
  parameter, not int.

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

Modified: head/sys/arm/allwinner/aw_usbphy.c
==
--- head/sys/arm/allwinner/aw_usbphy.c  Mon Jul 11 19:58:00 2016
(r302584)
+++ head/sys/arm/allwinner/aw_usbphy.c  Mon Jul 11 20:00:57 2016
(r302585)
@@ -148,7 +148,7 @@ awusbphy_vbus_detect(device_t dev, int *
 }
 
 static int
-awusbphy_phy_enable(device_t dev, int phy, bool enable)
+awusbphy_phy_enable(device_t dev, intptr_t phy, bool enable)
 {
struct awusbphy_softc *sc;
regulator_t reg;
@@ -177,8 +177,9 @@ awusbphy_phy_enable(device_t dev, int ph
} else
error = regulator_disable(reg);
if (error != 0) {
-   device_printf(dev, "couldn't %s regulator for phy %d\n",
-   enable ? "enable" : "disable", phy);
+   device_printf(dev,
+   "couldn't %s regulator for phy %jd\n",
+   enable ? "enable" : "disable", (intmax_t)phy);
return (error);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302584 - head/sys/arm/allwinner

2016-07-11 Thread Jared McNeill
Author: jmcneill
Date: Mon Jul 11 19:58:00 2016
New Revision: 302584
URL: https://svnweb.freebsd.org/changeset/base/302584

Log:
  Remove unused bus_space prototypes.

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

Modified: head/sys/arm/allwinner/a10_ehci.c
==
--- head/sys/arm/allwinner/a10_ehci.c   Mon Jul 11 17:31:30 2016
(r302583)
+++ head/sys/arm/allwinner/a10_ehci.c   Mon Jul 11 19:58:00 2016
(r302584)
@@ -88,9 +88,6 @@ __FBSDID("$FreeBSD$");
 static device_attach_t a10_ehci_attach;
 static device_detach_t a10_ehci_detach;
 
-bs_r_1_proto(reversed);
-bs_w_1_proto(reversed);
-
 struct aw_ehci_softc {
ehci_softc_tsc;
clk_t   clk;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302583 - stable/10/usr.bin/lastcomm/tests

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 17:31:30 2016
New Revision: 302583
URL: https://svnweb.freebsd.org/changeset/base/302583

Log:
  MFC r302327:
  
  Fix .../usr.bin/lastcomm/legacy_test:main on i386
  
  The time in the output files was ahead by 3 hours on i386. Fix the incorrect
  offset.
  
  PR: 210329

Modified:
  stable/10/usr.bin/lastcomm/tests/v1-i386.out
  stable/10/usr.bin/lastcomm/tests/v2-i386.out
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/lastcomm/tests/v1-i386.out
==
--- stable/10/usr.bin/lastcomm/tests/v1-i386.outMon Jul 11 17:30:20 
2016(r302582)
+++ stable/10/usr.bin/lastcomm/tests/v1-i386.outMon Jul 11 17:31:30 
2016(r302583)
@@ -1,28 +1,28 @@
-core -FDX root  0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
-core -DX root  0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
-cc - root  0.000 secs 0.000 us 0.000 sy 0.469 es Fri May 18 11:34
-ld - root  0.000 secs 0.000 us 0.000 sy 0.109 es Fri May 18 11:34
-as - root  0.000 secs 0.000 us 0.000 sy 0.047 es Fri May 18 11:34
-cc1 - root  0.016 secs 0.016 us 0.000 sy 0.203 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-1234567890123456 - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-ln - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-1234567890123456 - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-ln - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-123456789012345 - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-ln - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 0.359 es Fri May 18 11:34
-diff - root  0.312 secs 0.297 us 0.016 sy 0.359 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
-dd - root  0.016 secs 0.000 us 0.016 sy 0.031 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 11:34
-sleep - root  0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 3.406 es Fri May 18 11:34
-find - root  0.266 secs 0.062 us 0.203 sy 3.406 es Fri May 18 11:34
-time - root  0.000 secs 0.000 us 0.000 sy 5.047 es Fri May 18 11:33
-egrep - root  4.984 secs 4.984 us 0.000 sy 5.047 es Fri May 18 11:33
-time - root  0.000 secs 0.000 us 0.000 sy 0.484 es Fri May 18 11:33
-awk - root  0.453 secs 0.453 us 0.000 sy 0.453 es Fri May 18 11:33
-accton - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:33
+core -FDX root  0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 08:34
+core -DX root  0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 08:34
+cc - root  0.000 secs 0.000 us 0.000 sy 0.469 es Fri May 18 08:34
+ld - root  0.000 secs 0.000 us 0.000 sy 0.109 es Fri May 18 08:34
+as - root  0.000 secs 0.000 us 0.000 sy 0.047 es Fri May 18 08:34
+cc1 - root  0.016 secs 0.016 us 0.000 sy 0.203 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+1234567890123456 - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+ln - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+1234567890123456 - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+ln - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+123456789012345 - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+ln - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 0.359 es Fri May 18 08:34
+diff - root  0.312 secs 0.297 us 0.016 sy 0.359 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 08:34
+dd - root  0.016 secs 0.000 us 0.016 sy 0.031 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 08:34
+sleep - root  0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 3.406 es Fri May 18 08:34
+find - root  0.266 secs 0.062 us 0.203 sy 3.406 es Fri May 18 08:34
+time - root  0.000 secs 0.000 us 0.000 sy 5.047 es Fri May 18 08:33
+egrep - root  4.984 secs 4.984 us 0.000 sy 5.047 es Fri May 18 08:33
+time - root  0.000 secs 0.000 us 0.000 sy 0.484 es Fri May 18 08:33
+awk - root  0.453 secs 0.453 us 0.000 sy 0.453 es Fri May 18 08:33
+accton - root  0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 08:33

Modified: stable/10/usr.bin/lastcomm/tests/v2-i386.out
==
--- stable/10/usr.bin/lastcomm/tests/v2-i386.outMon Jul 11 17:30:20 
2016(r302582)
+++ 

svn commit: r302582 - stable/10/usr.bin/lastcomm/tests

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 17:30:20 2016
New Revision: 302582
URL: https://svnweb.freebsd.org/changeset/base/302582

Log:
  MFC r302326:
  
  Output the diffs to standard error when comparing the expected vs the
  obtained output from lastcomm instead of just printing out a summary, e.g.
  "they differed".
  
  This will make failures with results more apparent when running kyua debug,
  kyua report-html, etc.

Modified:
  stable/10/usr.bin/lastcomm/tests/legacy_test.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/lastcomm/tests/legacy_test.sh
==
--- stable/10/usr.bin/lastcomm/tests/legacy_test.sh Mon Jul 11 17:11:18 
2016(r302581)
+++ stable/10/usr.bin/lastcomm/tests/legacy_test.sh Mon Jul 11 17:30:20 
2016(r302582)
@@ -14,7 +14,7 @@ check()
shift
# Remove tty field, which varies between systems.
awk '{$4 = ""; print}' |
-   if diff -q - $1
+   if diff -a - $1 >&2
then
echo "ok $NUM"
else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302581 - head/sys/dev/cxgbe/tom

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 17:11:18 2016
New Revision: 302581
URL: https://svnweb.freebsd.org/changeset/base/302581

Log:
  Remove redundant declaration for tcp_dooptions, similar to r302576
  
  netinet/tcp_var.h already defines this function
  
  Differential Revision:https://reviews.freebsd.org/D7189
  MFC after:1 week
  PR:   209920
  Reported by:  Mark Millard 
  Reviewed by:  np
  Tested with:  clang 3.8.0, gcc 4.2.1, gcc 5.3.0
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/cxgbe/tom/t4_listen.c

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Mon Jul 11 17:04:22 2016
(r302580)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Mon Jul 11 17:11:18 2016
(r302581)
@@ -665,9 +665,6 @@ t4_syncache_removed(struct toedev *tod _
release_synqe(synqe);
 }
 
-/* XXX */
-extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
-
 int
 t4_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302580 - head/sys/kern

2016-07-11 Thread Konstantin Belousov
Author: kib
Date: Mon Jul 11 17:04:22 2016
New Revision: 302580
URL: https://svnweb.freebsd.org/changeset/base/302580

Log:
  Fix grammar.
  
  Submitted by: alc
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon Jul 11 17:03:35 2016(r302579)
+++ head/sys/kern/vfs_subr.cMon Jul 11 17:04:22 2016(r302580)
@@ -3235,7 +3235,7 @@ vgonel(struct vnode *vp)
 
/*
 * For VMIO bufobj, BO_DEAD is set in vm_object_terminate()
-* after the object' page queue is flushed.
+* after the object's page queue is flushed.
 */
if (vp->v_bufobj.bo_object == NULL)
vp->v_bufobj.bo_flag |= BO_DEAD;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302578 - head/sys/powerpc/ofw

2016-07-11 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Jul 11 17:02:17 2016
New Revision: 302578
URL: https://svnweb.freebsd.org/changeset/base/302578

Log:
  Remove dead code. This should have been removed in r297392, when these
  files were moved to dev/ofw, but wasn't, apparently due to some version
  control issue.
  
  MFC after:1 week

Deleted:
  head/sys/powerpc/ofw/ofw_pci.c
  head/sys/powerpc/ofw/ofw_pci.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302577 - head/sys/dev/drm2

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 17:01:07 2016
New Revision: 302577
URL: https://svnweb.freebsd.org/changeset/base/302577

Log:
  Add missing default case to capable(..) function definition
  
  By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN
  aren't possible. Add in a KASSERT safety belt and return false in
  !INVARIANTS case if an invalid value is passed in, as it would be a
  programmer error.
  
  This fixes a -Wreturn-type error with gcc 5.3.0.
  
  Differential Revision:https://reviews.freebsd.org/D7188
  MFC after:1 week
  Reported by:  devel/amd64-gcc (5.3.0)
  Reviewed by:  dumbbell
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/sys/dev/drm2/drm_os_freebsd.h
==
--- head/sys/dev/drm2/drm_os_freebsd.h  Mon Jul 11 16:56:51 2016
(r302576)
+++ head/sys/dev/drm2/drm_os_freebsd.h  Mon Jul 11 17:01:07 2016
(r302577)
@@ -438,6 +438,10 @@ capable(enum __drm_capabilities cap)
switch (cap) {
case CAP_SYS_ADMIN:
return DRM_SUSER(curthread);
+   default:
+   KASSERT(false,
+   ("%s: unhandled capability: %0x", __func__, cap));
+   return (false);
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302576 - head/sys/dev/cxgb/ulp/tom

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 16:56:51 2016
New Revision: 302576
URL: https://svnweb.freebsd.org/changeset/base/302576

Log:
  (Re-do r302574 with corrected commit message..)
  
  Remove redundant declaration for tcp_dooptions
  
  netinet/tcp_var.h already defines this function
  
  Differential Revision:https://reviews.freebsd.org/D7187
  MFC after:1 week
  PR:   209920
  Reported by:  Mark Millard 
  Reviewed by:  np
  Tested with:  clang 3.8.0, gcc 4.2.1, gcc 5.3.0
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/cxgb/ulp/tom/cxgb_listen.c

Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c
==
--- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:54:19 2016
(r302575)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:56:51 2016
(r302576)
@@ -922,9 +922,6 @@ t3_syncache_removed(struct toedev *tod _
release_synqe(synqe);
 }
 
-/* XXX */
-extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
-
 int
 t3_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302575 - head/sys/dev/cxgb/ulp/tom

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 16:54:19 2016
New Revision: 302575
URL: https://svnweb.freebsd.org/changeset/base/302575

Log:
  Revert r302574. I botched the commit message in more way than 1

Modified:
  head/sys/dev/cxgb/ulp/tom/cxgb_listen.c

Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c
==
--- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:52:04 2016
(r302574)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:54:19 2016
(r302575)
@@ -922,6 +922,9 @@ t3_syncache_removed(struct toedev *tod _
release_synqe(synqe);
 }
 
+/* XXX */
+extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
+
 int
 t3_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r302574 - head/sys/dev/cxgb/ulp/tom

2016-07-11 Thread Ngie Cooper (yaneurabeya)

> On Jul 11, 2016, at 09:52, Garrett Cooper  wrote:
> 
> Author: ngie
> Date: Mon Jul 11 16:52:04 2016
> New Revision: 302574
> URL: https://svnweb.freebsd.org/changeset/base/302574
> 
> Log:
>  Remove redundant declaration for tcp_dooptions
> 
>  netinet/tcp_var.h already defines this function
> 
>  PR:  209924
>  Reported by: Mark Millard 
>  Reviewed by: np
>  Tested with: clang 3.8.0, gcc 4.2.1, gcc 5.3.0
>  Sponsored by:EMC / Isilon Storage Division

Also:

MFC after: 1 week


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r302574 - head/sys/dev/cxgb/ulp/tom

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 16:52:04 2016
New Revision: 302574
URL: https://svnweb.freebsd.org/changeset/base/302574

Log:
  Remove redundant declaration for tcp_dooptions
  
  netinet/tcp_var.h already defines this function
  
  PR:   209924
  Reported by:  Mark Millard 
  Reviewed by:  np
  Tested with:  clang 3.8.0, gcc 4.2.1, gcc 5.3.0
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/cxgb/ulp/tom/cxgb_listen.c

Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c
==
--- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 15:52:52 2016
(r302573)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:52:04 2016
(r302574)
@@ -922,9 +922,6 @@ t3_syncache_removed(struct toedev *tod _
release_synqe(synqe);
 }
 
-/* XXX */
-extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
-
 int
 t3_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302573 - head/sys/i386/i386

2016-07-11 Thread Konstantin Belousov
Author: kib
Date: Mon Jul 11 15:52:52 2016
New Revision: 302573
URL: https://svnweb.freebsd.org/changeset/base/302573

Log:
  Fill tf_trapno for trap frames created for syscall.
  
  If tf_trapno contains garbage which appears to be equal to T_NMI,
  e.g. due to thread previously entered kernel due to NMI, doreti
  sequence skips ast, and does so until a trap or hardware interrupt
  occur.
  
  The visible effects of the issue are quite confusing.  First, signals
  delivery is postponed in observable ways.  In particular, the
  guarantee that unblocked async signals queue is flushed before a
  return from syscall, is broken.  Second, if there are pending signals,
  all interruptible sleeps of the stuck thread are aborted immediately.
  
  Since modern CPUs are relatively fast and tickless kernel generates
  low interrupt rate, the faulty condition might exist for long time (in
  an application time scale).
  
  In collaboration with:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/exception.s

Modified: head/sys/i386/i386/exception.s
==
--- head/sys/i386/i386/exception.s  Mon Jul 11 15:50:06 2016
(r302572)
+++ head/sys/i386/i386/exception.s  Mon Jul 11 15:52:52 2016
(r302573)
@@ -234,7 +234,7 @@ IDTVEC(lcall_syscall)
pushfl  /* save eflags */
popl8(%esp) /* shuffle into tf_eflags */
pushl   $7  /* sizeof "lcall 7,0" */
-   subl$4,%esp /* skip over tf_trapno */
+   pushl   $0  /* tf_trapno */
pushal
pushl   $0
movw%ds,(%esp)
@@ -263,7 +263,7 @@ IDTVEC(lcall_syscall)
SUPERALIGN_TEXT
 IDTVEC(int0x80_syscall)
pushl   $2  /* sizeof "int 0x80" */
-   subl$4,%esp /* skip over tf_trapno */
+   pushl   $0  /* tf_trapno */
pushal
pushl   $0
movw%ds,(%esp)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302572 - head/sys/dev/drm2/i915

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 15:50:06 2016
New Revision: 302572
URL: https://svnweb.freebsd.org/changeset/base/302572

Log:
  Remove redundant declarations for intel_fbc_enabled(..) and
  i915_gem_dump_object(..) to fix -Wredundant-decls warning
  
  MFC after:1 week
  PR:   209924
  Reported by:  Mark Millard 
  Tested with:  devel/amd64-gcc (5.3.0)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/drm2/i915/i915_drv.h

Modified: head/sys/dev/drm2/i915/i915_drv.h
==
--- head/sys/dev/drm2/i915/i915_drv.h   Mon Jul 11 15:47:43 2016
(r302571)
+++ head/sys/dev/drm2/i915/i915_drv.h   Mon Jul 11 15:50:06 2016
(r302572)
@@ -1618,8 +1618,6 @@ int i915_verify_lists(struct drm_device 
 #endif
 void i915_gem_object_check_coherency(struct drm_i915_gem_object *obj,
 int handle);
-void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
- const char *where, uint32_t mark);
 
 /* i915_suspend.c */
 extern int i915_save_state(struct drm_device *dev);
@@ -1673,7 +1671,6 @@ extern void intel_modeset_cleanup(struct
 extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
 extern void intel_modeset_setup_hw_state(struct drm_device *dev,
 bool force_restore);
-extern bool intel_fbc_enabled(struct drm_device *dev);
 extern void intel_disable_fbc(struct drm_device *dev);
 extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
 extern void intel_init_pch_refclk(struct drm_device *dev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302571 - head/sys/dev/drm2/radeon

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 15:47:43 2016
New Revision: 302571
URL: https://svnweb.freebsd.org/changeset/base/302571

Log:
  Remove redundant declaration for radeon_pm_acpi_event_handler(..) to fix
  -Wredundant-decls warning
  
  MFC after:1 week
  PR:   209924
  Reported by:  Mark Millard 
  Tested with:  devel/amd64-gcc (5.3.0)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/drm2/radeon/radeon_acpi.c

Modified: head/sys/dev/drm2/radeon/radeon_acpi.c
==
--- head/sys/dev/drm2/radeon/radeon_acpi.c  Mon Jul 11 15:33:49 2016
(r302570)
+++ head/sys/dev/drm2/radeon/radeon_acpi.c  Mon Jul 11 15:47:43 2016
(r302571)
@@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$");
 
 #define ACPI_AC_CLASS   "ac_adapter"
 
-extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev);
-
 struct atif_verify_interface {
u16 size;   /* structure size in bytes (includes size 
field) */
u16 version;/* version */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r302550 - head/sys/rpc

2016-07-11 Thread Conrad Meyer
On Sun, Jul 10, 2016 at 11:58 PM, Garrett Cooper  wrote:
> Author: ngie
> Date: Mon Jul 11 06:58:24 2016
> New Revision: 302550
> URL: https://svnweb.freebsd.org/changeset/base/302550
>
> Log:
...
>   MFC after: 1 week
>   Reported by: Coverity
>   CID: 1007033, 1007344
>   Sponsored by: EMC / Isilon Storage Division

FYI, your svn commit message editor appears to be eating the tabs from
the commit template.

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


svn commit: r302568 - stable/11/release/doc/share/xml

2016-07-11 Thread Glen Barber
Author: gjb
Date: Mon Jul 11 14:24:50 2016
New Revision: 302568
URL: https://svnweb.freebsd.org/changeset/base/302568

Log:
  Fix the branch name in the release notes.
  
  Approved by:  re (implicit, relnotes)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/share/xml/release.ent

Modified: stable/11/release/doc/share/xml/release.ent
==
--- stable/11/release/doc/share/xml/release.ent Mon Jul 11 14:19:09 2016
(r302567)
+++ stable/11/release/doc/share/xml/release.ent Mon Jul 11 14:24:50 2016
(r302568)
@@ -22,7 +22,7 @@
 
 
 
-
+
 
 
 https://www.FreeBSD.org/snapshots/;>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302567 - in head/sys: kern vm

2016-07-11 Thread Konstantin Belousov
Author: kib
Date: Mon Jul 11 14:19:09 2016
New Revision: 302567
URL: https://svnweb.freebsd.org/changeset/base/302567

Log:
  In vgonel(), postpone setting BO_DEAD until VOP_RECLAIM() is called,
  if vnode is VMIO.  For VMIO vnodes, set BO_DEAD in vm_object_terminate().
  
  The vnode_destroy_object(), when calling into vm_object_terminate(),
  must be able to flush buffers.  BO_DEAD purpose is to quickly destroy
  buffers on write when the underlying vnode is not operable any more
  (one example is the devfs node after geom is gone).  Setting BO_DEAD
  for reclaiming vnode before object is terminated is premature, and
  results in unability to flush buffers with live SU dependencies from
  vinvalbuf() in vm_object_terminate().
  
  Reported by:  David Cross 
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_subr.c
  head/sys/vm/vm_object.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon Jul 11 14:07:24 2016(r302566)
+++ head/sys/kern/vfs_subr.cMon Jul 11 14:19:09 2016(r302567)
@@ -3232,7 +3232,13 @@ vgonel(struct vnode *vp)
TAILQ_EMPTY(>v_bufobj.bo_clean.bv_hd) &&
vp->v_bufobj.bo_clean.bv_cnt == 0,
("vp %p bufobj not invalidated", vp));
-   vp->v_bufobj.bo_flag |= BO_DEAD;
+
+   /*
+* For VMIO bufobj, BO_DEAD is set in vm_object_terminate()
+* after the object' page queue is flushed.
+*/
+   if (vp->v_bufobj.bo_object == NULL)
+   vp->v_bufobj.bo_flag |= BO_DEAD;
BO_UNLOCK(>v_bufobj);
 
/*

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Mon Jul 11 14:07:24 2016(r302566)
+++ head/sys/vm/vm_object.c Mon Jul 11 14:19:09 2016(r302567)
@@ -741,6 +741,10 @@ vm_object_terminate(vm_object_t object)
 
vinvalbuf(vp, V_SAVE, 0, 0);
 
+   BO_LOCK(>v_bufobj);
+   vp->v_bufobj.bo_flag |= BO_DEAD;
+   BO_UNLOCK(>v_bufobj);
+
VM_OBJECT_WLOCK(object);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302566 - head/release/doc/share/xml

2016-07-11 Thread Glen Barber
Author: gjb
Date: Mon Jul 11 14:07:24 2016
New Revision: 302566
URL: https://svnweb.freebsd.org/changeset/base/302566

Log:
  Fix the naming of -CURRENT
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/doc/share/xml/release.ent

Modified: head/release/doc/share/xml/release.ent
==
--- head/release/doc/share/xml/release.ent  Mon Jul 11 13:41:40 2016
(r302565)
+++ head/release/doc/share/xml/release.ent  Mon Jul 11 14:07:24 2016
(r302566)
@@ -6,17 +6,17 @@
 
 
-
+
 
 
-
+
 
 
-
+
 
 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302565 - head/sbin/ipfw

2016-07-11 Thread Cy Schubert
Author: cy
Date: Mon Jul 11 13:41:40 2016
New Revision: 302565
URL: https://svnweb.freebsd.org/changeset/base/302565

Log:
  r302561 broke buildworld. This patch fixes that.
  
  MFC after:3 days
  X-MFC with:   r302561

Modified:
  head/sbin/ipfw/ipfw2.h

Modified: head/sbin/ipfw/ipfw2.h
==
--- head/sbin/ipfw/ipfw2.h  Mon Jul 11 13:06:17 2016(r302564)
+++ head/sbin/ipfw/ipfw2.h  Mon Jul 11 13:41:40 2016(r302565)
@@ -371,6 +371,9 @@ void fill_unreach6_code(u_short *codep, 
 void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av, int cblen);
 int fill_ext6hdr(struct _ipfw_insn *cmd, char *av);
 
+/* ipfw2.c */
+void bp_flush(struct buf_pr *b);
+
 /* tables.c */
 struct _ipfw_obj_ctlv;
 int table_check_name(const char *tablename);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302564 - head/sys/security/audit

2016-07-11 Thread Robert Watson
Author: rwatson
Date: Mon Jul 11 13:06:17 2016
New Revision: 302564
URL: https://svnweb.freebsd.org/changeset/base/302564

Log:
  Add AUE_WAIT6 handling to the BSM conversion switch statement, reusing
  the BSM encoding used for AUE_WAIT4.
  
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/security/audit/audit_bsm.c

Modified: head/sys/security/audit/audit_bsm.c
==
--- head/sys/security/audit/audit_bsm.c Mon Jul 11 13:01:42 2016
(r302563)
+++ head/sys/security/audit/audit_bsm.c Mon Jul 11 13:06:17 2016
(r302564)
@@ -1606,6 +1606,7 @@ kaudit_to_bsm(struct kaudit_record *kar,
break;
 
case AUE_WAIT4:
+   case AUE_WAIT6:
PROCESS_PID_TOKENS(1);
if (ARG_IS_VALID(kar, ARG_VALUE)) {
tok = au_to_arg32(3, "options", ar->ar_arg_value);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302563 - stable/10/sys/dev/usb/controller

2016-07-11 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jul 11 13:01:42 2016
New Revision: 302563
URL: https://svnweb.freebsd.org/changeset/base/302563

Log:
  MFC r302336:
  Fix interrupt loop when switching from USB device to USB host mode by
  clearing all endpoint interrupt bits.
  
  PR:   210736

Modified:
  stable/10/sys/dev/usb/controller/dwc_otg.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Mon Jul 11 12:59:23 2016
(r302562)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Mon Jul 11 13:01:42 2016
(r302563)
@@ -93,17 +93,6 @@
 #defineDWC_OTG_PC2UDEV(pc) \
(USB_DMATAG_TO_XROOT((pc)->tag_parent)->udev)
 
-#defineDWC_OTG_MSK_GINT_ENABLED\
-   (GINTMSK_ENUMDONEMSK |  \
-   GINTMSK_USBRSTMSK | \
-   GINTMSK_USBSUSPMSK |\
-   GINTMSK_IEPINTMSK | \
-   GINTMSK_SESSREQINTMSK | \
-   GINTMSK_RXFLVLMSK | \
-   GINTMSK_HCHINTMSK | \
-   GINTMSK_OTGINTMSK | \
-   GINTMSK_PRTINTMSK)
-
 #defineDWC_OTG_MSK_GINT_THREAD_IRQ \
(GINTSTS_USBRST | GINTSTS_ENUMDONE | GINTSTS_PRTINT |   \
GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTMSK_OTGINTMSK | \
@@ -377,6 +366,11 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
/* enable all host channel interrupts */
DWC_OTG_WRITE_4(sc, DOTG_HAINTMSK,
(1U << sc->sc_host_ch_max) - 1U);
+
+   /* enable proper host channel interrupts */
+   sc->sc_irq_mask |= GINTMSK_HCHINTMSK;
+   sc->sc_irq_mask &= ~GINTMSK_IEPINTMSK;
+   DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask);
}
 
if (mode == DWC_MODE_DEVICE) {
@@ -437,6 +431,11 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
pf->usb.max_in_frame_size,
pf->usb.max_out_frame_size);
}
+
+   /* enable proper device channel interrupts */
+   sc->sc_irq_mask &= ~GINTMSK_HCHINTMSK;
+   sc->sc_irq_mask |= GINTMSK_IEPINTMSK;
+   DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask);
}
 
/* reset RX FIFO */
@@ -2866,10 +2865,13 @@ dwc_otg_filter_interrupt(void *arg)
 
for (x = 0; x != sc->sc_dev_in_ep_max; x++) {
temp = DWC_OTG_READ_4(sc, DOTG_DIEPINT(x));
-   if (temp & DIEPMSK_XFERCOMPLMSK) {
-   DWC_OTG_WRITE_4(sc, DOTG_DIEPINT(x),
-   DIEPMSK_XFERCOMPLMSK);
-   }
+   /*
+* NOTE: Need to clear all interrupt bits,
+* because some appears to be unmaskable and
+* can cause an interrupt loop:
+*/
+   if (temp != 0)
+   DWC_OTG_WRITE_4(sc, DOTG_DIEPINT(x), temp);
}
}
 
@@ -3976,7 +3978,7 @@ dwc_otg_init(struct dwc_otg_softc *sc)
}
 
/* enable interrupts */
-   sc->sc_irq_mask = DWC_OTG_MSK_GINT_ENABLED;
+   sc->sc_irq_mask |= DWC_OTG_MSK_GINT_THREAD_IRQ;
DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask);
 
if (sc->sc_mode == DWC_MODE_OTG || sc->sc_mode == DWC_MODE_DEVICE) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302562 - stable/10/sys/dev/usb/controller

2016-07-11 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jul 11 12:59:23 2016
New Revision: 302562
URL: https://svnweb.freebsd.org/changeset/base/302562

Log:
  MFC r302306:
  Fix detection of USB device disconnects in USB host mode when the USB
  device is connected directly to the USB port of the DWC OTG, in this
  case a RPI-zero.
  
  PR:   210695

Modified:
  stable/10/sys/dev/usb/controller/dwc_otg.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Mon Jul 11 12:44:58 2016
(r302561)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Mon Jul 11 12:59:23 2016
(r302562)
@@ -2981,7 +2981,8 @@ dwc_otg_interrupt(void *arg)
else
sc->sc_flags.status_bus_reset = 0;
 
-   if (hprt & HPRT_PRTENCHNG)
+   if ((hprt & HPRT_PRTENCHNG) &&
+   (hprt & HPRT_PRTENA) == 0)
sc->sc_flags.change_enabled = 1;
 
if (hprt & HPRT_PRTENA)
@@ -4741,6 +4742,8 @@ tr_handle_get_port_status:
 
value = 0;
 
+   if (sc->sc_flags.change_enabled)
+   value |= UPS_C_PORT_ENABLED;
if (sc->sc_flags.change_connect)
value |= UPS_C_CONNECT_STATUS;
if (sc->sc_flags.change_suspend)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302561 - head/sbin/ipfw

2016-07-11 Thread Andrey V. Elsukov
Author: ae
Date: Mon Jul 11 12:44:58 2016
New Revision: 302561
URL: https://svnweb.freebsd.org/changeset/base/302561

Log:
  Flush buffer after output. This fixes adding new data to already
  printed flows.
  
  PR:   210882
  MFC after:3 days

Modified:
  head/sbin/ipfw/dummynet.c

Modified: head/sbin/ipfw/dummynet.c
==
--- head/sbin/ipfw/dummynet.c   Mon Jul 11 08:24:04 2016(r302560)
+++ head/sbin/ipfw/dummynet.c   Mon Jul 11 12:44:58 2016(r302561)
@@ -612,6 +612,7 @@ list_pipes(struct dn_id *oid, struct dn_
}
list_flow(, (struct dn_flow *)oid);
printf("%s\n", bp.buf);
+   bp_flush();
break;
 
case DN_LINK: {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302560 - head/sys/dev/ofw

2016-07-11 Thread Michal Meloun
Author: mmel
Date: Mon Jul 11 08:24:04 2016
New Revision: 302560
URL: https://svnweb.freebsd.org/changeset/base/302560

Log:
  OFWPCI: Fix style(9).
  No functional change.
  
  MFC after: 3 weeks

Modified:
  head/sys/dev/ofw/ofwpci.c

Modified: head/sys/dev/ofw/ofwpci.c
==
--- head/sys/dev/ofw/ofwpci.c   Mon Jul 11 08:12:04 2016(r302559)
+++ head/sys/dev/ofw/ofwpci.c   Mon Jul 11 08:24:04 2016(r302560)
@@ -195,7 +195,7 @@ ofw_pci_init(device_t dev)
sc->sc_io_rman.rm_type = RMAN_ARRAY;
sc->sc_io_rman.rm_descr = "PCI I/O Ports";
error = rman_init(>sc_io_rman);
-   if (error) {
+   if (error != 0) {
device_printf(dev, "rman_init() failed. error = %d\n", error);
goto out;
}
@@ -203,7 +203,7 @@ ofw_pci_init(device_t dev)
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
sc->sc_mem_rman.rm_descr = "PCI Memory";
error = rman_init(>sc_mem_rman);
-   if (error) {
+   if (error != 0) {
device_printf(dev, "rman_init() failed. error = %d\n", error);
goto out;
}
@@ -226,7 +226,7 @@ ofw_pci_init(device_t dev)
break;
}
 
-   if (error) {
+   if (error != 0) {
device_printf(dev,
"rman_manage_region(%x, %#jx, %#jx) failed. "
"error = %d\n", rp->pci_hi &
@@ -257,7 +257,7 @@ ofw_pci_attach(device_t dev)
sc = device_get_softc(dev);
if (!sc->sc_initialized) {
error = ofw_pci_init(dev);
-   if (error)
+   if (error != 0)
return (error);
}
 
@@ -437,9 +437,11 @@ ofw_pci_release_resource(device_t bus, d
 {
 
if (rman_get_flags(res) & RF_ACTIVE) {
-   int error = bus_deactivate_resource(child, type, rid, res);
-   if (error)
-   return error;
+   int error;
+
+   error = bus_deactivate_resource(child, type, rid, res);
+   if (error != 0)
+   return (error);
}
 
return (rman_release_resource(res));
@@ -544,9 +546,10 @@ static int
 ofw_pci_adjust_resource(device_t bus, device_t child, int type,
 struct resource *res, rman_res_t start, rman_res_t end)
 {
-   struct rman *rm = NULL;
-   struct ofw_pci_softc *sc = device_get_softc(bus);
+   struct rman *rm;
+   struct ofw_pci_softc *sc;
 
+   sc = device_get_softc(bus);
KASSERT(!(rman_get_flags(res) & RF_ACTIVE),
("active resources cannot be adjusted"));
if (rman_get_flags(res) & RF_ACTIVE)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302559 - in head/sys/dev/hyperv: include vmbus

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 08:12:04 2016
New Revision: 302559
URL: https://svnweb.freebsd.org/changeset/base/302559

Log:
  hyperv/vmbus: Embed channel detach task in channel itself.
  
  GC work queue stuffs.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6864

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hMon Jul 11 08:05:46 2016
(r302558)
+++ head/sys/dev/hyperv/include/hyperv.hMon Jul 11 08:12:04 2016
(r302559)
@@ -809,6 +809,8 @@ typedef struct hv_vmbus_channel {
void*hv_chan_priv1;
void*hv_chan_priv2;
void*hv_chan_priv3;
+
+   struct task ch_detach_task;
 } hv_vmbus_channel;
 
 #define HV_VMBUS_CHAN_ISPRIMARY(chan)  ((chan)->primary_channel == NULL)

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 08:05:46 2016
(r302558)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 08:12:04 2016
(r302559)
@@ -42,7 +42,7 @@ typedef void  (*vmbus_chanmsg_proc_t)
 static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc 
*);
 static voidvmbus_channel_on_offer_internal(struct vmbus_softc *,
const hv_vmbus_channel_offer_channel *offer);
-static voidvmbus_channel_on_offer_rescind_internal(void *context);
+static voidvmbus_chan_detach_task(void *, int);
 
 static voidvmbus_channel_on_offer(struct vmbus_softc *,
const struct vmbus_message *);
@@ -80,12 +80,6 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE
vmbus_channel_on_version_response
 };
 
-typedef struct hv_work_item {
-   struct task work;
-   void(*callback)(void *);
-   void*   context;
-} hv_work_item;
-
 static struct mtx  vmbus_chwait_lock;
 MTX_SYSINIT(vmbus_chwait_lk, _chwait_lock, "vmbus primarych wait lock",
 MTX_DEF);
@@ -95,41 +89,6 @@ static uint32_t  vmbus_devcnt;
 #define VMBUS_CHANCNT_DONE 0x8000
 
 /**
- * Implementation of the work abstraction.
- */
-static void
-work_item_callback(void *work, int pending)
-{
-   struct hv_work_item *w = (struct hv_work_item *)work;
-
-   w->callback(w->context);
-
-   free(w, M_DEVBUF);
-}
-
-/**
- * @brief Create work item
- */
-static int
-hv_queue_work_item(
-   void (*callback)(void *), void *context)
-{
-   struct hv_work_item *w = malloc(sizeof(struct hv_work_item),
-   M_DEVBUF, M_NOWAIT);
-   KASSERT(w != NULL, ("Error VMBUS: Failed to allocate WorkItem\n"));
-   if (w == NULL)
-   return (ENOMEM);
-
-   w->callback = callback;
-   w->context = context;
-
-   TASK_INIT(>work, 0, work_item_callback, w);
-
-   return (taskqueue_enqueue(taskqueue_thread, >work));
-}
-
-
-/**
  * @brief Allocate and initialize a vmbus channel object
  */
 static struct hv_vmbus_channel *
@@ -142,6 +101,7 @@ hv_vmbus_allocate_channel(struct vmbus_s
 
mtx_init(>sc_lock, "vmbus multi channel", NULL, MTX_DEF);
TAILQ_INIT(>sc_list_anchor);
+   TASK_INIT(>ch_detach_task, 0, vmbus_chan_detach_task, channel);
 
return (channel);
 }
@@ -431,37 +391,35 @@ vmbus_channel_on_offer_internal(struct v
  * @brief Rescind offer handler.
  *
  * We queue a work item to process this offer
- * synchronously
+ * synchronously.
+ *
+ * XXX pretty broken; need rework.
  */
 static void
 vmbus_channel_on_offer_rescind(struct vmbus_softc *sc,
 const struct vmbus_message *msg)
 {
-   const hv_vmbus_channel_msg_header *hdr =
-   (const hv_vmbus_channel_msg_header *)msg->msg_data;
-
const hv_vmbus_channel_rescind_offer *rescind;
hv_vmbus_channel*   channel;
 
-   rescind = (const hv_vmbus_channel_rescind_offer *)hdr;
+   rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data;
 
channel = hv_vmbus_g_connection.channels[rescind->child_rel_id];
if (channel == NULL)
return;
-
-   hv_queue_work_item(vmbus_channel_on_offer_rescind_internal, channel);
hv_vmbus_g_connection.channels[rescind->child_rel_id] = NULL;
+
+   taskqueue_enqueue(taskqueue_thread, >ch_detach_task);
 }
 
 static void
-vmbus_channel_on_offer_rescind_internal(void *context)
+vmbus_chan_detach_task(void *xchan, int pending __unused)
 {
-   hv_vmbus_channel*   channel;
+   struct hv_vmbus_channel *chan = xchan;
 
-   channel = (hv_vmbus_channel*)context;
-   if 

svn commit: r302558 - head/usr.bin/ul

2016-07-11 Thread Pietro Cerutti
Author: gahr (ports committer)
Date: Mon Jul 11 08:05:46 2016
New Revision: 302558
URL: https://svnweb.freebsd.org/changeset/base/302558

Log:
  Do not truncate lines longer than 512 chars.
  
  PR:   210344
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D6881

Modified:
  head/usr.bin/ul/ul.c

Modified: head/usr.bin/ul/ul.c
==
--- head/usr.bin/ul/ul.cMon Jul 11 07:54:58 2016(r302557)
+++ head/usr.bin/ul/ul.cMon Jul 11 08:05:46 2016(r302558)
@@ -78,7 +78,9 @@ structCHAR{
int c_width;/* width or -1 if multi-column char. filler */
 } ;
 
-static struct  CHARobuf[MAXBUF];
+static struct  CHARsobuf[MAXBUF]; /* static output buffer */
+static struct  CHAR*obuf = sobuf;
+static int buflen = MAXBUF;
 static int col, maxcol;
 static int mode;
 static int halfpos;
@@ -151,6 +153,9 @@ main(int argc, char **argv)
else
filter(f);
}
+   if (obuf != sobuf) {
+   free(obuf);
+   }
exit(0);
 }
 
@@ -166,128 +171,148 @@ filter(FILE *f)
 {
wint_t c;
int i, w;
+   int copy;
+   
+   copy = 0;
+
+   while ((c = getwc(f)) != WEOF) {
+   if (col == buflen) {
+   if (obuf == sobuf) {
+   obuf = NULL;
+   copy = 1;
+   }
+   obuf = realloc(obuf, sizeof(*obuf) * 2 * buflen);
+   if (obuf == NULL) {
+   obuf = sobuf;
+   break;
+   } else if (copy) {
+   memcpy(obuf, sobuf, sizeof(*obuf) * buflen);
+   copy = 0;
+   }
+   bzero((char *)(obuf + buflen), sizeof(*obuf) * buflen);
+   buflen *= 2;
+   }
+   switch(c) {
+   case '\b':
+   if (col > 0)
+   col--;
+   continue;
 
-   while ((c = getwc(f)) != WEOF && col < MAXBUF) switch(c) {
+   case '\t':
+   col = (col+8) & ~07;
+   if (col > maxcol)
+   maxcol = col;
+   continue;
 
-   case '\b':
-   if (col > 0)
-   col--;
-   continue;
-
-   case '\t':
-   col = (col+8) & ~07;
-   if (col > maxcol)
-   maxcol = col;
-   continue;
-
-   case '\r':
-   col = 0;
-   continue;
-
-   case SO:
-   mode |= ALTSET;
-   continue;
-
-   case SI:
-   mode &= ~ALTSET;
-   continue;
-
-   case IESC:
-   switch (c = getwc(f)) {
-
-   case HREV:
-   if (halfpos == 0) {
-   mode |= SUPERSC;
-   halfpos--;
-   } else if (halfpos > 0) {
-   mode &= ~SUBSC;
-   halfpos--;
-   } else {
-   halfpos = 0;
-   reverse();
-   }
+   case '\r':
+   col = 0;
continue;
 
-   case HFWD:
-   if (halfpos == 0) {
-   mode |= SUBSC;
-   halfpos++;
-   } else if (halfpos < 0) {
-   mode &= ~SUPERSC;
-   halfpos++;
-   } else {
-   halfpos = 0;
-   fwd();
-   }
+   case SO:
+   mode |= ALTSET;
continue;
 
-   case FREV:
-   reverse();
+   case SI:
+   mode &= ~ALTSET;
continue;
 
-   default:
-   errx(1, "unknown escape sequence in input: %o, %o", 
IESC, c);
-   }
-   continue;
+   case IESC:
+   switch (c = getwc(f)) {
 
-   case '_':
-   if (obuf[col].c_char || obuf[col].c_width < 0) {
-   while (col > 0 && obuf[col].c_width < 0)
-   col--;
-   w = obuf[col].c_width;
-   for (i = 0; i < w; i++)
-   obuf[col++].c_mode |= UNDERL | mode;
+   case HREV:
+   if (halfpos == 0) {
+  

svn commit: r302557 - in head/sys/dev/hyperv: include vmbus

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 07:54:58 2016
New Revision: 302557
URL: https://svnweb.freebsd.org/changeset/base/302557

Log:
  hyperv/vmbus: Save vmbus softc to channels.
  
  So that we don't need to access the global vmbus softc.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6863

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hMon Jul 11 07:45:31 2016
(r302556)
+++ head/sys/dev/hyperv/include/hyperv.hMon Jul 11 07:54:58 2016
(r302557)
@@ -713,6 +713,7 @@ typedef struct {
 typedef struct hv_vmbus_channel {
TAILQ_ENTRY(hv_vmbus_channel)   list_entry;
struct hv_device*   device;
+   struct vmbus_softc  *vmbus_sc;
hv_vmbus_channel_state  state;
hv_vmbus_channel_offer_channel  offer_msg;
/*

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Mon Jul 11 07:45:31 2016
(r302556)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Mon Jul 11 07:54:58 2016
(r302557)
@@ -67,7 +67,7 @@ static void
 vmbus_channel_set_event(hv_vmbus_channel *channel)
 {
if (channel->offer_msg.monitor_allocated) {
-   struct vmbus_softc *sc = vmbus_get_softc();
+   struct vmbus_softc *sc = channel->vmbus_sc;
hv_vmbus_monitor_page *monitor_page;
uint32_t chanid = channel->offer_msg.child_rel_id;
 
@@ -205,7 +205,7 @@ hv_vmbus_channel_open(
 
vmbus_on_channel_open(new_channel);
 
-   new_channel->rxq = VMBUS_PCPU_GET(vmbus_get_softc(), event_tq,
+   new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq,
new_channel->target_cpu);
TASK_INIT(_channel->channel_task, 0, VmbusProcessChannelEvent, 
new_channel);
 

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:45:31 2016
(r302556)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:54:58 2016
(r302557)
@@ -39,7 +39,8 @@
 typedef void   (*vmbus_chanmsg_proc_t)
(struct vmbus_softc *, const struct vmbus_message *);
 
-static voidvmbus_channel_on_offer_internal(
+static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc 
*);
+static voidvmbus_channel_on_offer_internal(struct vmbus_softc *,
const hv_vmbus_channel_offer_channel *offer);
 static voidvmbus_channel_on_offer_rescind_internal(void *context);
 
@@ -131,15 +132,13 @@ hv_queue_work_item(
 /**
  * @brief Allocate and initialize a vmbus channel object
  */
-hv_vmbus_channel*
-hv_vmbus_allocate_channel(void)
+static struct hv_vmbus_channel *
+hv_vmbus_allocate_channel(struct vmbus_softc *sc)
 {
-   hv_vmbus_channel* channel;
+   struct hv_vmbus_channel *channel;
 
-   channel = (hv_vmbus_channel*) malloc(
-   sizeof(hv_vmbus_channel),
-   M_DEVBUF,
-   M_WAITOK | M_ZERO);
+   channel = malloc(sizeof(*channel), M_DEVBUF, M_WAITOK | M_ZERO);
+   channel->vmbus_sc = sc;
 
mtx_init(>sc_lock, "vmbus multi channel", NULL, MTX_DEF);
TAILQ_INIT(>sc_list_anchor);
@@ -297,7 +296,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch
}
 
chan->target_cpu = cpu;
-   chan->target_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, cpu);
+   chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu);
 
if (bootverbose) {
printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n",
@@ -379,16 +378,17 @@ vmbus_channel_on_offer(struct vmbus_soft
mtx_unlock(_chwait_lock);
 
offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data;
-   vmbus_channel_on_offer_internal(offer);
+   vmbus_channel_on_offer_internal(sc, offer);
 }
 
 static void
-vmbus_channel_on_offer_internal(const hv_vmbus_channel_offer_channel *offer)
+vmbus_channel_on_offer_internal(struct vmbus_softc *sc,
+const hv_vmbus_channel_offer_channel *offer)
 {
hv_vmbus_channel* new_channel;
 
/* Allocate the channel object and save this offer */
-   new_channel = hv_vmbus_allocate_channel();
+   new_channel = hv_vmbus_allocate_channel(sc);
 
/*
 * By default we setup state to enable batched
@@ -681,7 +681,7 @@ vmbus_select_outgoing_channel(struct hv_
   

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 07:45:31 2016
New Revision: 302556
URL: https://svnweb.freebsd.org/changeset/base/302556

Log:
  hyperv/vmbus: Create channel synchronously.
  
  The device probe/attach has been move to a different thread, so the
  reasons to create the channel asynchronously are no longer valid.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6862

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

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:35:58 2016
(r302555)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:45:31 2016
(r302556)
@@ -39,7 +39,8 @@
 typedef void   (*vmbus_chanmsg_proc_t)
(struct vmbus_softc *, const struct vmbus_message *);
 
-static voidvmbus_channel_on_offer_internal(void *context);
+static voidvmbus_channel_on_offer_internal(
+   const hv_vmbus_channel_offer_channel *offer);
 static voidvmbus_channel_on_offer_rescind_internal(void *context);
 
 static voidvmbus_channel_on_offer(struct vmbus_softc *,
@@ -365,44 +366,27 @@ vmbus_channel_select_defcpu(struct hv_vm
 /**
  * @brief Handler for channel offers from Hyper-V/Azure
  *
- * Handler for channel offers from vmbus in parent partition. We ignore
- * all offers except network and storage offers. For each network and storage
- * offers, we create a channel object and queue a work item to the channel
- * object to process the offer synchronously
+ * Handler for channel offers from vmbus in parent partition.
  */
 static void
 vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg)
 {
-   const hv_vmbus_channel_msg_header *hdr =
-   (const hv_vmbus_channel_msg_header *)msg->msg_data;
-
const hv_vmbus_channel_offer_channel *offer;
-   hv_vmbus_channel_offer_channel *copied;
-
-   offer = (const hv_vmbus_channel_offer_channel *)hdr;
-
-   // copy offer data
-   copied = malloc(sizeof(*copied), M_DEVBUF, M_NOWAIT);
-   if (copied == NULL) {
-   printf("fail to allocate memory\n");
-   return;
-   }
-
-   memcpy(copied, hdr, sizeof(*copied));
-   hv_queue_work_item(vmbus_channel_on_offer_internal, copied);
 
mtx_lock(_chwait_lock);
if ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0)
vmbus_chancnt++;
mtx_unlock(_chwait_lock);
+
+   offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data;
+   vmbus_channel_on_offer_internal(offer);
 }
 
 static void
-vmbus_channel_on_offer_internal(void* context)
+vmbus_channel_on_offer_internal(const hv_vmbus_channel_offer_channel *offer)
 {
hv_vmbus_channel* new_channel;
 
-   hv_vmbus_channel_offer_channel* offer = 
(hv_vmbus_channel_offer_channel*)context;
/* Allocate the channel object and save this offer */
new_channel = hv_vmbus_allocate_channel();
 
@@ -441,8 +425,6 @@ vmbus_channel_on_offer_internal(void* co
vmbus_channel_select_defcpu(new_channel);
 
vmbus_channel_process_offer(new_channel);
-
-   free(offer, M_DEVBUF);
 }
 
 /**
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302555 - in stable/10: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src lib/libmagic

2016-07-11 Thread Xin LI
Author: delphij
Date: Mon Jul 11 07:35:58 2016
New Revision: 302555
URL: https://svnweb.freebsd.org/changeset/base/302555

Log:
  MFC r302221,30:
  
  MFV r302218: file 5.28.
  
  Relnotes: yes

Added:
  stable/10/contrib/file/magic/Magdir/ber
 - copied unchanged from r302221, head/contrib/file/magic/Magdir/ber
  stable/10/contrib/file/magic/Magdir/coverage
 - copied unchanged from r302221, head/contrib/file/magic/Magdir/coverage
  stable/10/contrib/file/magic/Magdir/pc88
 - copied unchanged from r302221, head/contrib/file/magic/Magdir/pc88
  stable/10/contrib/file/magic/Magdir/pc98
 - copied unchanged from r302221, head/contrib/file/magic/Magdir/pc98
  stable/10/contrib/file/magic/Magdir/x68000
 - copied unchanged from r302221, head/contrib/file/magic/Magdir/x68000
Deleted:
  stable/10/contrib/file/src/magic.h
Modified:
  stable/10/contrib/file/ChangeLog
  stable/10/contrib/file/config.h.in
  stable/10/contrib/file/configure
  stable/10/contrib/file/configure.ac
  stable/10/contrib/file/doc/file.man
  stable/10/contrib/file/magic/Magdir/c-lang
  stable/10/contrib/file/magic/Magdir/console
  stable/10/contrib/file/magic/Magdir/database
  stable/10/contrib/file/magic/Magdir/elf
  stable/10/contrib/file/magic/Magdir/msdos
  stable/10/contrib/file/magic/Magdir/msx
  stable/10/contrib/file/magic/Magdir/perl
  stable/10/contrib/file/magic/Makefile.am
  stable/10/contrib/file/magic/Makefile.in
  stable/10/contrib/file/src/Makefile.am
  stable/10/contrib/file/src/Makefile.in
  stable/10/contrib/file/src/apprentice.c
  stable/10/contrib/file/src/cdf.c
  stable/10/contrib/file/src/compress.c
  stable/10/contrib/file/src/der.c
  stable/10/contrib/file/src/file.c
  stable/10/contrib/file/src/softmagic.c
  stable/10/lib/libmagic/Makefile
  stable/10/lib/libmagic/config.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/file/ChangeLog
==
--- stable/10/contrib/file/ChangeLogMon Jul 11 07:28:15 2016
(r302554)
+++ stable/10/contrib/file/ChangeLogMon Jul 11 07:35:58 2016
(r302555)
@@ -1,3 +1,15 @@
+2016-06-13  19:40  Christos Zoulas 
+
+   * release 5.28
+   * fix leak on allocation failure
+
+2016-06-01   1:20  Christos Zoulas 
+
+   * PR/555: Avoid overflow for offset > nbytes
+   * PR/550: Segv on DER parsing:
+   - use the correct variable for length
+   - set offset to 0 on failure.
+
 2016-05-13  12:00  Christos Zoulas 

* release 5.27

Modified: stable/10/contrib/file/config.h.in
==
--- stable/10/contrib/file/config.h.in  Mon Jul 11 07:28:15 2016
(r302554)
+++ stable/10/contrib/file/config.h.in  Mon Jul 11 07:35:58 2016
(r302555)
@@ -328,6 +328,9 @@
 # endif
 #endif
 
+/* Enable zlib compression support */
+#undef ZLIBSUPPORT
+
 /* Enable large inode numbers on Mac OS X 10.5.  */
 #ifndef _DARWIN_USE_64_BIT_INODE
 # define _DARWIN_USE_64_BIT_INODE 1

Modified: stable/10/contrib/file/configure
==
--- stable/10/contrib/file/configureMon Jul 11 07:28:15 2016
(r302554)
+++ stable/10/contrib/file/configureMon Jul 11 07:35:58 2016
(r302555)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for file 5.27.
+# Generated by GNU Autoconf 2.69 for file 5.28.
 #
 # Report bugs to .
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.27'
-PACKAGE_STRING='file 5.27'
+PACKAGE_VERSION='5.28'
+PACKAGE_STRING='file 5.28'
 PACKAGE_BUGREPORT='chris...@astron.com'
 PACKAGE_URL=''
 
@@ -766,6 +766,7 @@ enable_option_checking
 enable_silent_rules
 enable_elf
 enable_elf_core
+enable_zlib
 enable_fsect_man5
 enable_dependency_tracking
 enable_static
@@ -1327,7 +1328,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures file 5.27 to adapt to many kinds of systems.
+\`configure' configures file 5.28 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1397,7 +1398,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of file 5.27:";;
+ short | recursive ) echo "Configuration of file 5.28:";;
esac
   cat <<\_ACEOF
 
@@ -1409,6 +1410,7 @@ Optional Features:
   --disable-silent-rules  verbose build output (undo: "make V=0")
   --disable-elfdisable builtin ELF support
   --disable-elf-core   disable ELF core file support
+  

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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 07:28:15 2016
New Revision: 302554
URL: https://svnweb.freebsd.org/changeset/base/302554

Log:
  hyperv/vmbus: Use post message Hypercall APIs for unload
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6861

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

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Mon Jul 11 07:24:56 2016
(r302553)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Mon Jul 11 07:28:15 2016
(r302554)
@@ -92,19 +92,13 @@ hv_vmbus_connect(struct vmbus_softc *sc)
 int
 hv_vmbus_disconnect(void)
 {
-   int  ret = 0;
-   hv_vmbus_channel_unload  msg;
-
-   msg.message_type = HV_CHANNEL_MESSAGE_UNLOAD;
-
-   ret = hv_vmbus_post_message(, sizeof(hv_vmbus_channel_unload));
 
mtx_destroy(_vmbus_g_connection.channel_msg_lock);
 
free(hv_vmbus_g_connection.channels, M_DEVBUF);
hv_vmbus_g_connection.connect_state = HV_DISCONNECTED;
 
-   return (ret);
+   return (0);
 }
 
 static __inline void

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 07:24:56 2016
(r302553)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 07:28:15 2016
(r302554)
@@ -99,6 +99,7 @@ static intvmbus_init(struct vmbus_sof
 static int vmbus_init_contact(struct vmbus_softc *,
uint32_t);
 static int vmbus_req_channels(struct vmbus_softc *sc);
+static voidvmbus_uninit(struct vmbus_softc *);
 
 static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS);
 
@@ -420,6 +421,32 @@ vmbus_init(struct vmbus_softc *sc)
return ENXIO;
 }
 
+static void
+vmbus_uninit(struct vmbus_softc *sc)
+{
+   struct vmbus_chanmsg_unload *req;
+   struct vmbus_msghc *mh;
+   int error;
+
+   mh = vmbus_msghc_get(sc, sizeof(*req));
+   if (mh == NULL) {
+   device_printf(sc->vmbus_dev,
+   "can not get msg hypercall for unload\n");
+   return;
+   }
+
+   req = vmbus_msghc_dataptr(mh);
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_UNLOAD;
+
+   error = vmbus_msghc_exec_noresult(mh);
+   vmbus_msghc_put(sc, mh);
+
+   if (error) {
+   device_printf(sc->vmbus_dev,
+   "unload msg hypercall failed\n");
+   }
+}
+
 static int
 vmbus_req_channels(struct vmbus_softc *sc)
 {
@@ -1134,6 +1161,8 @@ vmbus_detach(device_t dev)
struct vmbus_softc *sc = device_get_softc(dev);
 
hv_vmbus_release_unattached_channels();
+
+   vmbus_uninit(sc);
hv_vmbus_disconnect();
 
if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) {

Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_reg.h   Mon Jul 11 07:24:56 2016
(r302553)
+++ head/sys/dev/hyperv/vmbus/vmbus_reg.h   Mon Jul 11 07:28:15 2016
(r302554)
@@ -86,6 +86,7 @@ CTASSERT(sizeof(struct vmbus_evtflags) =
 #define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3   /* REQ */
 #define VMBUS_CHANMSG_TYPE_INIT_CONTACT14  /* REQ */
 #define VMBUS_CHANMSG_TYPE_VERSION_RESP15  /* RESP */
+#define VMBUS_CHANMSG_TYPE_UNLOAD  16  /* REQ */
 
 struct vmbus_chanmsg_hdr {
uint32_tchm_type;   /* VMBUS_CHANMSG_TYPE_ */
@@ -113,4 +114,9 @@ struct vmbus_chanmsg_channel_req {
struct vmbus_chanmsg_hdr chm_hdr;
 } __packed;
 
+/* VMBUS_CHANMSG_TYPE_UNLOAD */
+struct vmbus_chanmsg_unload {
+   struct vmbus_chanmsg_hdr chm_hdr;
+} __packed;
+
 #endif /* !_VMBUS_REG_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302553 - head/sys/rpc

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 07:24:56 2016
New Revision: 302553
URL: https://svnweb.freebsd.org/changeset/base/302553

Log:
  Don't test for xpt not being NULL before calling svc_xprt_free(..)
  
  svc_xprt_alloc(..) will always return initialized memory as it uses
  mem_alloc(..) under the covers, which uses malloc(.., M_WAITOK, ..).
  
  MFC after: 1 week
  Reported by: Coverity
  CID: 1007341
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/rpc/svc_dg.c

Modified: head/sys/rpc/svc_dg.c
==
--- head/sys/rpc/svc_dg.c   Mon Jul 11 07:17:52 2016(r302552)
+++ head/sys/rpc/svc_dg.c   Mon Jul 11 07:24:56 2016(r302553)
@@ -142,9 +142,8 @@ svc_dg_create(SVCPOOL *pool, struct sock
return (xprt);
 freedata:
(void) printf(svc_dg_str, __no_mem_str);
-   if (xprt) {
-   svc_xprt_free(xprt);
-   }
+   svc_xprt_free(xprt);
+
return (NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302552 - head/sys/rpc

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 07:17:52 2016
New Revision: 302552
URL: https://svnweb.freebsd.org/changeset/base/302552

Log:
  Convert `svc_xprt_alloc(..)` and `svc_xprt_free(..)`'s prototypes to
  ANSI C style prototypes
  
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/rpc/svc.c

Modified: head/sys/rpc/svc.c
==
--- head/sys/rpc/svc.c  Mon Jul 11 07:07:15 2016(r302551)
+++ head/sys/rpc/svc.c  Mon Jul 11 07:17:52 2016(r302552)
@@ -841,7 +841,7 @@ svcerr_progvers(struct svc_req *rqstp, r
  * parameters.
  */
 SVCXPRT *
-svc_xprt_alloc()
+svc_xprt_alloc(void)
 {
SVCXPRT *xprt;
SVCXPRT_EXT *ext;
@@ -858,8 +858,7 @@ svc_xprt_alloc()
  * Free a server transport structure.
  */
 void
-svc_xprt_free(xprt)
-   SVCXPRT *xprt;
+svc_xprt_free(SVCXPRT *xprt)
 {
 
mem_free(xprt->xp_p3, sizeof(SVCXPRT_EXT));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302551 - head/sys/rpc

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 07:07:15 2016
New Revision: 302551
URL: https://svnweb.freebsd.org/changeset/base/302551

Log:
  Deobfuscate cleanup path in clnt_vc_create(..)
  
  Similar to r300836, r301800, and r302550, cl and ct will always
  be non-NULL as they're allocated using the mem_alloc routines,
  which always use `malloc(..., M_WAITOK)`.
  
  MFC after: 1 week
  Reported by: Coverity
  CID: 1007342
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/rpc/clnt_vc.c

Modified: head/sys/rpc/clnt_vc.c
==
--- head/sys/rpc/clnt_vc.c  Mon Jul 11 06:58:24 2016(r302550)
+++ head/sys/rpc/clnt_vc.c  Mon Jul 11 07:07:15 2016(r302551)
@@ -270,12 +270,10 @@ clnt_vc_create(
return (cl);
 
 err:
-   if (ct) {
-   mtx_destroy(>ct_lock);
-   mem_free(ct, sizeof (struct ct_data));
-   }
-   if (cl)
-   mem_free(cl, sizeof (CLIENT));
+   mtx_destroy(>ct_lock);
+   mem_free(ct, sizeof (struct ct_data));
+   mem_free(cl, sizeof (CLIENT));
+
return ((CLIENT *)NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302550 - head/sys/rpc

2016-07-11 Thread Garrett Cooper
Author: ngie
Date: Mon Jul 11 06:58:24 2016
New Revision: 302550
URL: https://svnweb.freebsd.org/changeset/base/302550

Log:
  Deobfuscate cleanup path in clnt_dg_create(..)
  
  Similar to r300836 and r301800, cl and cu will always be non-NULL as they're
  allocated using the mem_alloc routines, which always use
  `malloc(..., M_WAITOK)`.
  
  Deobfuscating the cleanup path fixes a leak where if cl was NULL and
  cu was not, cu would not be free'd, and also removes a duplicate test for
  cl not being NULL.
  
  MFC after: 1 week
  Reported by: Coverity
  CID: 1007033, 1007344
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/rpc/clnt_dg.c

Modified: head/sys/rpc/clnt_dg.c
==
--- head/sys/rpc/clnt_dg.c  Mon Jul 11 06:55:02 2016(r302549)
+++ head/sys/rpc/clnt_dg.c  Mon Jul 11 06:58:24 2016(r302550)
@@ -313,11 +313,9 @@ recheck_socket:
cl->cl_netid = NULL;
return (cl);
 err2:
-   if (cl) {
-   mem_free(cl, sizeof (CLIENT));
-   if (cu)
-   mem_free(cu, sizeof (*cu));
-   }
+   mem_free(cl, sizeof (CLIENT));
+   mem_free(cu, sizeof (*cu));
+
return (NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 06:55:02 2016
New Revision: 302549
URL: https://svnweb.freebsd.org/changeset/base/302549

Log:
  hyperv/vmbus: Add sysctl to expose vmbus version.
  
  Requested by: Hongxiong Xian 
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6860

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

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 06:49:56 2016
(r302548)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 06:55:02 2016
(r302549)
@@ -100,6 +100,8 @@ static int  vmbus_init_contact(struct v
uint32_t);
 static int vmbus_req_channels(struct vmbus_softc *sc);
 
+static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS);
+
 static struct vmbus_msghc_ctx  *vmbus_msghc_ctx_create(bus_dma_tag_t);
 static voidvmbus_msghc_ctx_destroy(
struct vmbus_msghc_ctx *);
@@ -948,6 +950,17 @@ hv_vmbus_child_device_unregister(struct 
 }
 
 static int
+vmbus_sysctl_version(SYSCTL_HANDLER_ARGS)
+{
+   char verstr[16];
+
+   snprintf(verstr, sizeof(verstr), "%u.%u",
+   hv_vmbus_protocal_version >> 16,
+   hv_vmbus_protocal_version & 0x);
+   return sysctl_handle_string(oidp, verstr, sizeof(verstr), req);
+}
+
+static int
 vmbus_probe(device_t dev)
 {
char *id[] = { "VMBUS", NULL };
@@ -977,6 +990,8 @@ vmbus_probe(device_t dev)
 static int
 vmbus_doattach(struct vmbus_softc *sc)
 {
+   struct sysctl_oid_list *child;
+   struct sysctl_ctx_list *ctx;
int ret;
 
if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
@@ -1040,6 +1055,12 @@ vmbus_doattach(struct vmbus_softc *sc)
bus_generic_attach(sc->vmbus_dev);
device_printf(sc->vmbus_dev, "device scan, probe and attach done\n");
 
+   ctx = device_get_sysctl_ctx(sc->vmbus_dev);
+   child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vmbus_dev));
+   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "version",
+   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
+   vmbus_sysctl_version, "A", "vmbus version");
+
return (ret);
 
 cleanup:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Pyun YongHyeon
Author: yongari
Date: Mon Jul 11 06:49:56 2016
New Revision: 302548
URL: https://svnweb.freebsd.org/changeset/base/302548

Log:
  Belatedly remove CSUM_IP_FRAGS and CSUM_FRAGMENT offloading
  capabilities.  It was removed in r243624 and r254804/r271006
  respectively.
  This file and mbuf(9) needs updates for other offloading
  capabilities(i.e. CSUM_SCTP and CSUM_TSO).

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

Modified: head/share/man/man9/ifnet.9
==
--- head/share/man/man9/ifnet.9 Mon Jul 11 06:37:04 2016(r302547)
+++ head/share/man/man9/ifnet.9 Mon Jul 11 06:49:56 2016(r302548)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 29, 2014
+.Dd July 11, 2016
 .Dt IFNET 9
 .Os
 .Sh NAME
@@ -787,18 +787,6 @@ The interface will compute IP checksums.
 The interface will compute TCP checksums.
 .It Dv CSUM_UDP
 The interface will compute UDP checksums.
-.It Dv CSUM_IP_FRAGS
-The interface can compute a TCP or UDP checksum for a packet
-fragmented by the host CPU.
-Makes sense only along with
-.Dv CSUM_TCP
-or
-.Dv CSUM_UDP .
-.It Dv CSUM_FRAGMENT
-The interface will do the fragmentation of IP packets if necessary.
-The host CPU does not need to care about MTU on this interface
-as long as a packet to transmit through it is an IP one and it
-does not exceed the size of the hardware buffer.
 .El
 .Pp
 An interface notifies the TCP/IP module about the tasks
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 06:37:04 2016
New Revision: 302547
URL: https://svnweb.freebsd.org/changeset/base/302547

Log:
  hyperv/vmbus: Explicitly assign channel message process array.
  
  While I'm here, remove the useless message type from message process
  array, which is not used and serves no purposes at all.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6858

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

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 06:31:15 2016
(r302546)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 06:37:04 2016
(r302547)
@@ -36,16 +36,8 @@
 #include 
 #include 
 
-/*
- * Internal functions
- */
-
-typedef struct hv_vmbus_channel_msg_table_entry {
-   hv_vmbus_channel_msg_typemessageType;
-   void(*messageHandler)
-   (struct vmbus_softc *sc,
-const struct vmbus_message *msg);
-} hv_vmbus_channel_msg_table_entry;
+typedef void   (*vmbus_chanmsg_proc_t)
+   (struct vmbus_softc *, const struct vmbus_message *);
 
 static voidvmbus_channel_on_offer_internal(void *context);
 static voidvmbus_channel_on_offer_rescind_internal(void *context);
@@ -68,42 +60,22 @@ static void vmbus_channel_on_version_res
 /**
  * Channel message dispatch table
  */
-static const hv_vmbus_channel_msg_table_entry
-g_channel_message_table[HV_CHANNEL_MESSAGE_COUNT] = {
-   { HV_CHANNEL_MESSAGE_INVALID,
-   NULL },
-   { HV_CHANNEL_MESSAGE_OFFER_CHANNEL,
-   vmbus_channel_on_offer },
-   { HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER,
-   vmbus_channel_on_offer_rescind },
-   { HV_CHANNEL_MESSAGE_REQUEST_OFFERS,
-   NULL },
-   { HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED,
-   vmbus_channel_on_offers_delivered },
-   { HV_CHANNEL_MESSAGE_OPEN_CHANNEL,
-   NULL },
-   { HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT,
-   vmbus_channel_on_open_result },
-   { HV_CHANNEL_MESSAGE_CLOSE_CHANNEL,
-   NULL },
-   { HV_CHANNEL_MESSAGEL_GPADL_HEADER,
-   NULL },
-   { HV_CHANNEL_MESSAGE_GPADL_BODY,
-   NULL },
-   { HV_CHANNEL_MESSAGE_GPADL_CREATED,
-   vmbus_channel_on_gpadl_created },
-   { HV_CHANNEL_MESSAGE_GPADL_TEARDOWN,
-   NULL },
-   { HV_CHANNEL_MESSAGE_GPADL_TORNDOWN,
-   vmbus_channel_on_gpadl_torndown },
-   { HV_CHANNEL_MESSAGE_REL_ID_RELEASED,
-   NULL },
-   { HV_CHANNEL_MESSAGE_INITIATED_CONTACT,
-   NULL },
-   { HV_CHANNEL_MESSAGE_VERSION_RESPONSE,
-   vmbus_channel_on_version_response },
-   { HV_CHANNEL_MESSAGE_UNLOAD,
-   NULL }
+static const vmbus_chanmsg_proc_t
+vmbus_chanmsg_process[HV_CHANNEL_MESSAGE_COUNT] = {
+   [HV_CHANNEL_MESSAGE_OFFER_CHANNEL] =
+   vmbus_channel_on_offer,
+   [HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] =
+   vmbus_channel_on_offer_rescind,
+   [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] =
+   vmbus_channel_on_offers_delivered,
+   [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] =
+   vmbus_channel_on_open_result,
+   [HV_CHANNEL_MESSAGE_GPADL_CREATED] =
+   vmbus_channel_on_gpadl_created,
+   [HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] =
+   vmbus_channel_on_gpadl_torndown,
+   [HV_CHANNEL_MESSAGE_VERSION_RESPONSE] =
+   vmbus_channel_on_version_response
 };
 
 typedef struct hv_work_item {
@@ -812,20 +784,17 @@ vmbus_rel_subchan(struct hv_vmbus_channe
 void
 vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg)
 {
-   const hv_vmbus_channel_msg_table_entry *entry;
-   const hv_vmbus_channel_msg_header *hdr;
-   hv_vmbus_channel_msg_type msg_type;
-
-   hdr = (const hv_vmbus_channel_msg_header *)msg->msg_data;
-   msg_type = hdr->message_type;
+   vmbus_chanmsg_proc_t msg_proc;
+   uint32_t msg_type;
 
+   msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type;
if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) {
device_printf(sc->vmbus_dev, "unknown message type 0x%x\n",
msg_type);
return;
}
 
-   entry = _channel_message_table[msg_type];
-   if (entry->messageHandler)
-   entry->messageHandler(sc, msg);
+   msg_proc = vmbus_chanmsg_process[msg_type];
+   if (msg_proc != NULL)
+   msg_proc(sc, msg);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r302546 - head/usr.sbin/bhyve

2016-07-11 Thread Peter Grehan
Author: grehan
Date: Mon Jul 11 06:31:15 2016
New Revision: 302546
URL: https://svnweb.freebsd.org/changeset/base/302546

Log:
  Implement right shift/ctl, and convert the VNC/xorg scancode
  of 0xff03 into right-alt.
  
  Reported by:  lme@
  MFC after:1 week

Modified:
  head/usr.sbin/bhyve/ps2kbd.c

Modified: head/usr.sbin/bhyve/ps2kbd.c
==
--- head/usr.sbin/bhyve/ps2kbd.cMon Jul 11 06:29:56 2016
(r302545)
+++ head/usr.sbin/bhyve/ps2kbd.cMon Jul 11 06:31:15 2016
(r302546)
@@ -324,7 +324,9 @@ ps2kbd_keysym_queue(struct ps2kbd_softc 
fifo_put(sc, 0x12);
break;
case 0xffe2:/* Right shift */
-   /* XXX */
+   if (!down)
+   fifo_put(sc, 0xf0);
+   fifo_put(sc, 0x59);
break;
case 0xffe3:/* Left control */
if (!down)
@@ -332,7 +334,10 @@ ps2kbd_keysym_queue(struct ps2kbd_softc 
fifo_put(sc, 0x14);
break;
case 0xffe4:/* Right control */
-   /* XXX */
+   fifo_put(sc, 0xe0);
+   if (!down)
+   fifo_put(sc, 0xf0);
+   fifo_put(sc, 0x14);
break;
case 0xffe7:/* Left meta */
/* XXX */
@@ -345,6 +350,7 @@ ps2kbd_keysym_queue(struct ps2kbd_softc 
fifo_put(sc, 0xf0);
fifo_put(sc, 0x11);
break;
+   case 0xfe03:/* AltGr */
case 0xffea:/* Right alt */
fifo_put(sc, 0xe0);
if (!down)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 06:29:56 2016
New Revision: 302545
URL: https://svnweb.freebsd.org/changeset/base/302545

Log:
  hyperv/vmbus: Function renaming.
  
  And pass vmbus_softc to vmbus_doattach()
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6842

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

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 06:23:01 2016
(r302544)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 06:29:56 2016
(r302545)
@@ -975,9 +975,8 @@ vmbus_probe(device_t dev)
  * - retrieve the channel offers
  */
 static int
-vmbus_bus_init(void)
+vmbus_doattach(struct vmbus_softc *sc)
 {
-   struct vmbus_softc *sc = vmbus_get_softc();
int ret;
 
if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
@@ -1082,7 +1081,7 @@ vmbus_attach(device_t dev)
 */
if (!cold)
 #endif
-   vmbus_bus_init();
+   vmbus_doattach(vmbus_sc);
 
bus_generic_probe(dev);
return (0);
@@ -1091,7 +1090,9 @@ vmbus_attach(device_t dev)
 static void
 vmbus_sysinit(void *arg __unused)
 {
-   if (vm_guest != VM_GUEST_HV || vmbus_get_softc() == NULL)
+   struct vmbus_softc *sc = vmbus_get_softc();
+
+   if (vm_guest != VM_GUEST_HV || sc == NULL)
return;
 
 #ifndef EARLY_AP_STARTUP
@@ -1103,7 +1104,7 @@ vmbus_sysinit(void *arg __unused)
 */
if (!cold) 
 #endif
-   vmbus_bus_init();
+   vmbus_doattach(sc);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302544 - head/sys/dev/hyperv/netvsc

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 06:23:01 2016
New Revision: 302544
URL: https://svnweb.freebsd.org/changeset/base/302544

Log:
  hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf()
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6841

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jul 11 06:11:24 
2016(r302543)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Jul 11 06:23:01 
2016(r302544)
@@ -299,6 +299,12 @@ static int hn_tx_swq_depth = 0;
 SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN,
 _tx_swq_depth, 0, "Depth of IFQ or BUFRING");
 
+#if __FreeBSD_version >= 1100095
+static u_int hn_lro_mbufq_depth = 0;
+SYSCTL_UINT(_hw_hn, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN,
+_lro_mbufq_depth, 0, "Depth of LRO mbuf queue");
+#endif
+
 static u_int hn_cpu_index;
 
 /*
@@ -1283,6 +1289,19 @@ hv_m_append(struct mbuf *m0, int len, c_
return (remainder == 0);
 }
 
+#if defined(INET) || defined(INET6)
+static __inline int
+hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m)
+{
+#if __FreeBSD_version >= 1100095
+   if (hn_lro_mbufq_depth) {
+   tcp_lro_queue_mbuf(lc, m);
+   return 0;
+   }
+#endif
+   return tcp_lro_rx(lc, m, 0);
+}
+#endif
 
 /*
  * Called when we receive a data packet from the "wire" on the
@@ -1488,7 +1507,7 @@ skip:
 
if (lro->lro_cnt) {
rxr->hn_lro_tried++;
-   if (tcp_lro_rx(lro, m_new, 0) == 0) {
+   if (hn_lro_rx(lro, m_new) == 0) {
/* DONE! */
return 0;
}
@@ -2223,7 +2242,8 @@ hn_create_rx_data(struct hn_softc *sc, i
 */
 #if defined(INET) || defined(INET6)
 #if __FreeBSD_version >= 1100095
-   tcp_lro_init_args(>hn_lro, sc->hn_ifp, lroent_cnt, 0);
+   tcp_lro_init_args(>hn_lro, sc->hn_ifp, lroent_cnt,
+   hn_lro_mbufq_depth);
 #else
tcp_lro_init(>hn_lro);
rxr->hn_lro.ifp = sc->hn_ifp;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-07-11 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 06:11:24 2016
New Revision: 302543
URL: https://svnweb.freebsd.org/changeset/base/302543

Log:
  hyperv/vmbus: Use post message Hypercall APIs for channel request
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6831

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 05:44:58 2016
(r302542)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 06:11:24 2016
(r302543)
@@ -675,36 +675,6 @@ vmbus_channel_on_version_response(struct
 }
 
 /**
- *  @brief Send a request to get all our pending offers.
- */
-int
-hv_vmbus_request_channel_offers(void)
-{
-   int ret;
-   hv_vmbus_channel_msg_header*msg;
-   hv_vmbus_channel_msg_info*  msg_info;
-
-   msg_info = (hv_vmbus_channel_msg_info *)
-   malloc(sizeof(hv_vmbus_channel_msg_info)
-   + sizeof(hv_vmbus_channel_msg_header), M_DEVBUF, M_NOWAIT);
-
-   if (msg_info == NULL) {
-   if(bootverbose)
-   printf("Error VMBUS: malloc failed for Request Offers\n");
-   return (ENOMEM);
-   }
-
-   msg = (hv_vmbus_channel_msg_header*) msg_info->msg;
-   msg->message_type = HV_CHANNEL_MESSAGE_REQUEST_OFFERS;
-
-   ret = hv_vmbus_post_message(msg, sizeof(hv_vmbus_channel_msg_header));
-
-   free(msg_info, M_DEVBUF);
-
-   return (ret);
-}
-
-/**
  * @brief Release channels that are unattached/unconnected (i.e., no drivers 
associated)
  */
 void

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon Jul 11 05:44:58 2016
(r302542)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon Jul 11 06:11:24 2016
(r302543)
@@ -397,7 +397,6 @@ uint32_thv_ring_buffer_read_end(
 
 hv_vmbus_channel*  hv_vmbus_allocate_channel(void);
 void   hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel);
-inthv_vmbus_request_channel_offers(void);
 void   hv_vmbus_release_unattached_channels(void);
 
 uint16_t   hv_vmbus_post_msg_via_msg_ipc(

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 05:44:58 2016
(r302542)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Mon Jul 11 06:11:24 2016
(r302543)
@@ -98,6 +98,7 @@ struct vmbus_msghc_ctx {
 static int vmbus_init(struct vmbus_softc *);
 static int vmbus_init_contact(struct vmbus_softc *,
uint32_t);
+static int vmbus_req_channels(struct vmbus_softc *sc);
 
 static struct vmbus_msghc_ctx  *vmbus_msghc_ctx_create(bus_dma_tag_t);
 static voidvmbus_msghc_ctx_destroy(
@@ -417,6 +418,26 @@ vmbus_init(struct vmbus_softc *sc)
return ENXIO;
 }
 
+static int
+vmbus_req_channels(struct vmbus_softc *sc)
+{
+   struct vmbus_chanmsg_channel_req *req;
+   struct vmbus_msghc *mh;
+   int error;
+
+   mh = vmbus_msghc_get(sc, sizeof(*req));
+   if (mh == NULL)
+   return ENXIO;
+
+   req = vmbus_msghc_dataptr(mh);
+   req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHANNEL_REQ;
+
+   error = vmbus_msghc_exec_noresult(mh);
+   vmbus_msghc_put(sc, mh);
+
+   return error;
+}
+
 static void
 vmbus_msg_task(void *xsc, int pending __unused)
 {
@@ -1012,7 +1033,9 @@ vmbus_bus_init(void)
else
sc->vmbus_event_proc = vmbus_event_proc;
 
-   hv_vmbus_request_channel_offers();
+   ret = vmbus_req_channels(sc);
+   if (ret != 0)
+   goto cleanup;
 
vmbus_scan();
bus_generic_attach(sc->vmbus_dev);

Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_reg.h   Mon Jul 11 05:44:58 2016
(r302542)
+++ head/sys/dev/hyperv/vmbus/vmbus_reg.h   Mon Jul 11 06:11:24 2016
(r302543)
@@ -83,6 +83,7 @@ CTASSERT(sizeof(struct vmbus_evtflags) =
  * - Embedded in hypercall_postmsg_in.hc_data, e.g. request.
  */
 
+#define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3   /* REQ */
 #define VMBUS_CHANMSG_TYPE_INIT_CONTACT14  /* REQ */
 #define VMBUS_CHANMSG_TYPE_VERSION_RESP15  /* RESP */
 
@@ -107,4 +108,9 @@ struct vmbus_chanmsg_version_resp {
uint8_t chm_supp;
 }