Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140660480
D5504.id54425.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5504.id54425.diff
View Options
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
@@ -274,6 +274,21 @@
}
}
+static void
+vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu)
+{
+ KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu));
+
+ chan->target_cpu = cpu;
+ chan->target_vcpu = hv_vmbus_g_context.hv_vcpu_index[cpu];
+
+ if (bootverbose) {
+ printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n",
+ chan->offer_msg.child_rel_id,
+ chan->target_cpu, chan->target_vcpu);
+ }
+}
+
/**
* Array of device guids that are performance critical. We try to distribute
* the interrupt load for these devices across all online cpus.
@@ -306,11 +321,12 @@
* distributed across all available CPUs.
*/
static void
-vmbus_channel_select_cpu(hv_vmbus_channel *channel, hv_guid *guid)
+vmbus_channel_select_defcpu(struct hv_vmbus_channel *channel)
{
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,
@@ -323,21 +339,13 @@
if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
(hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) ||
(!is_perf_channel)) {
- /* Host's view of guest cpu */
- channel->target_vcpu = 0;
- /* Guest's own view of cpu */
- channel->target_cpu = 0;
+ /* 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);
- channel->target_cpu = current_cpu;
- channel->target_vcpu =
- hv_vmbus_g_context.hv_vcpu_index[current_cpu];
- if (bootverbose)
- printf("VMBUS: Total online cpus %d, assign perf channel %d "
- "to vcpu %d, cpu %d\n", mp_ncpus, i, channel->target_vcpu,
- current_cpu);
+ vmbus_channel_cpu_set(channel, current_cpu);
}
/**
@@ -408,17 +416,14 @@
offer->connection_id;
}
- /*
- * Bind the channel to a chosen cpu.
- */
- vmbus_channel_select_cpu(new_channel,
- &offer->offer.interface_type);
-
memcpy(&new_channel->offer_msg, offer,
sizeof(hv_vmbus_channel_offer_channel));
new_channel->monitor_group = (uint8_t) offer->monitor_id / 32;
new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32;
+ /* Select default cpu for this channel. */
+ vmbus_channel_select_defcpu(new_channel);
+
vmbus_channel_process_offer(new_channel);
free(offer, M_DEVBUF);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 27, 1:36 PM (21 m, 8 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27306021
Default Alt Text
D5504.id54425.diff (2 KB)
Attached To
Mode
D5504: hyperv/chan: Factor out the vcpu setting
Attached
Detach File
Event Timeline
Log In to Comment