Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160064778
D7141.id18192.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D7141.id18192.diff
View Options
Index: sys/dev/hyperv/include/hyperv.h
===================================================================
--- sys/dev/hyperv/include/hyperv.h
+++ sys/dev/hyperv/include/hyperv.h
@@ -274,16 +274,13 @@
struct hyperv_mon_param *ch_monprm;
struct hyperv_dma ch_monprm_dma;
+ int ch_cpuid; /* owner cpu */
/*
- * From Win8, this field specifies the target virtual process
- * on which to deliver the interrupt from the host to guest.
- * Before Win8, all channel interrupts would only be
- * delivered on cpu 0. Setting this value to 0 would preserve
- * the earlier behavior.
+ * Virtual cpuid for ch_cpuid; it is used to communicate cpuid
+ * related information w/ Hyper-V. If MSR_HV_VP_INDEX does not
+ * exist, ch_vcpuid will always be 0 for compatibility.
*/
- uint32_t target_vcpu;
- /* The corresponding CPUID in the guest */
- uint32_t target_cpu;
+ uint32_t ch_vcpuid;
/*
* If this is a primary channel, ch_subchan* fields
Index: sys/dev/hyperv/vmbus/hv_channel.c
===================================================================
--- sys/dev/hyperv/vmbus/hv_channel.c
+++ sys/dev/hyperv/vmbus/hv_channel.c
@@ -157,7 +157,7 @@
&channel->ch_id, 0, "channel id");
}
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO,
- "cpu", CTLFLAG_RD, &channel->target_cpu, 0, "owner CPU id");
+ "cpu", CTLFLAG_RD, &channel->ch_cpuid, 0, "owner CPU id");
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO,
"monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
channel, 0, vmbus_channel_sysctl_monalloc, "I",
@@ -226,7 +226,7 @@
vmbus_chan_update_evtflagcnt(sc, new_channel);
new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq,
- new_channel->target_cpu);
+ new_channel->ch_cpuid);
if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) {
TASK_INIT(&new_channel->channel_task, 0,
vmbus_chan_task, new_channel);
@@ -290,7 +290,7 @@
req->chm_chanid = new_channel->ch_id;
req->chm_openid = new_channel->ch_id;
req->chm_gpadl = new_channel->ch_bufring_gpadl;
- req->chm_vcpuid = new_channel->target_vcpu;
+ req->chm_vcpuid = new_channel->ch_vcpuid;
req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT;
if (user_data_len)
memcpy(req->chm_udata, user_data, user_data_len);
@@ -1005,7 +1005,7 @@
int flag_cnt;
flag_cnt = (chan->ch_id / VMBUS_EVTFLAG_LEN) + 1;
- flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu);
+ flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->ch_cpuid);
for (;;) {
int old_flag_cnt;
@@ -1017,8 +1017,7 @@
if (bootverbose) {
device_printf(sc->vmbus_dev,
"channel%u update cpu%d flag_cnt to %d\n",
- chan->ch_id,
- chan->target_cpu, flag_cnt);
+ chan->ch_id, chan->ch_cpuid, flag_cnt);
}
break;
}
@@ -1162,13 +1161,12 @@
cpu = 0;
}
- chan->target_cpu = cpu;
- chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu);
+ chan->ch_cpuid = cpu;
+ chan->ch_vcpuid = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu);
if (bootverbose) {
printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n",
- chan->ch_id,
- chan->target_cpu, chan->target_vcpu);
+ chan->ch_id, chan->ch_cpuid, chan->ch_vcpuid);
}
}
@@ -1401,17 +1399,17 @@
continue;
}
- if (new_channel->target_vcpu == cur_vcpu){
+ if (new_channel->ch_vcpuid == cur_vcpu){
return new_channel;
}
- old_cpu_distance = ((outgoing_channel->target_vcpu > cur_vcpu) ?
- (outgoing_channel->target_vcpu - cur_vcpu) :
- (cur_vcpu - outgoing_channel->target_vcpu));
+ old_cpu_distance = ((outgoing_channel->ch_vcpuid > cur_vcpu) ?
+ (outgoing_channel->ch_vcpuid - cur_vcpu) :
+ (cur_vcpu - outgoing_channel->ch_vcpuid));
- new_cpu_distance = ((new_channel->target_vcpu > cur_vcpu) ?
- (new_channel->target_vcpu - cur_vcpu) :
- (cur_vcpu - new_channel->target_vcpu));
+ new_cpu_distance = ((new_channel->ch_vcpuid > cur_vcpu) ?
+ (new_channel->ch_vcpuid - cur_vcpu) :
+ (cur_vcpu - new_channel->ch_vcpuid));
if (old_cpu_distance < new_cpu_distance) {
continue;
Index: sys/dev/hyperv/vmbus/vmbus.c
===================================================================
--- sys/dev/hyperv/vmbus/vmbus.c
+++ sys/dev/hyperv/vmbus/vmbus.c
@@ -726,19 +726,11 @@
uint32_t sint;
if (hyperv_features & CPUID_HV_MSR_VP_INDEX) {
- /*
- * Save virtual processor id.
- */
+ /* Save virtual processor id. */
VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX);
} else {
- /*
- * XXX
- * Virtual processoor id is only used by a pretty broken
- * channel selection code from storvsc. It's nothing
- * critical even if CPUID_HV_MSR_VP_INDEX is not set; keep
- * moving on.
- */
- VMBUS_PCPU_GET(sc, vcpuid, cpu) = cpu;
+ /* Set virtual processor id to 0 for compatibility. */
+ VMBUS_PCPU_GET(sc, vcpuid, cpu) = 0;
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jun 22, 1:18 AM (13 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34170114
Default Alt Text
D7141.id18192.diff (4 KB)
Attached To
Mode
D7141: hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist.
Attached
Detach File
Event Timeline
Log In to Comment