Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F172914726
D6918.id18314.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D6918.id18314.diff
View Options
Index: head/sys/dev/hyperv/include/hyperv.h
===================================================================
--- head/sys/dev/hyperv/include/hyperv.h
+++ head/sys/dev/hyperv/include/hyperv.h
@@ -707,6 +707,7 @@
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);
Index: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
===================================================================
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -361,6 +361,7 @@
memset(&props, 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 @@
/*
* Open the channel
*/
-
+ vmbus_channel_cpu_rr(dev->channel);
ret = hv_vmbus_channel_open(
dev->channel,
sc->hs_drv_props->drv_ringbuffer_size,
Index: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
@@ -238,61 +238,25 @@
}
}
-/**
- * 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(&vmbus_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 = &channel->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}().
+ */
+ vmbus_channel_cpu_set(chan, 0);
}
/**
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 23, 1:44 AM (13 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39447803
Default Alt Text
D6918.id18314.diff (3 KB)
Attached To
Mode
D6918: hyperv/vmbus: Don't be oversmart in default cpu selection.
Attached
Detach File
Event Timeline
Log In to Comment