History

Drivers: hv: vmbus: Remove the target_vp field from the vmbus_channel struct

The field is read only in __vmbus_open() and it is already stored twice (after a call to hv_cpu_number_to_vp_number()) in target_cpu_store() and init_vp_index(); there is no need to "cache" its value in the channel data structure.

Andrea Parri (Microsoft) committed 6 years ago

Commit 5bf74681 parent b3a9e3b4 files · +9 −14Browse files

Unified · Split

4 files
  1. drivers/hv/channel.c +2 −1
  2. drivers/hv/channel_mgmt.c +0 −3
  3. drivers/hv/vmbus_drv.c +0 −2
  4. include/linux/hyperv.h +7 −8
drivers/hv/channel.c+2−1
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/uio.h>
1919 #include <linux/interrupt.h>
2020 #include <asm/page.h>
21+#include <asm/mshyperv.h>
2122
2223 #include "hyperv_vmbus.h"
2324
@@ -176,7 +177,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel, · 152 unmodified lines
176177 open_msg->child_relid = newchannel->offermsg.child_relid;
177178 open_msg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle;
178179 open_msg->downstream_ringbuffer_pageoffset = newchannel->ringbuffer_send_offset;
179− open_msg->target_vp = newchannel->target_vp;
180+ open_msg->target_vp = hv_cpu_number_to_vp_number(newchannel->target_cpu);
180181
181182 if (userdatalen)
182183 memcpy(open_msg->userdata, userdata, userdatalen);
drivers/hv/channel_mgmt.c+0−3
@@ -704,8 +704,6 @@ static void init_vp_index(struct vmbus_channel *channel) · 703 unmodified lines
704704 */
705705 channel->numa_node = cpu_to_node(VMBUS_CONNECT_CPU);
706706 channel->target_cpu = VMBUS_CONNECT_CPU;
707− channel->target_vp =
708− hv_cpu_number_to_vp_number(VMBUS_CONNECT_CPU);
709707 if (perf_chn)
710708 hv_set_alloced_cpu(VMBUS_CONNECT_CPU);
711709 return;
@@ -739,7 +737,6 @@ static void init_vp_index(struct vmbus_channel *channel) · 27 unmodified lines
739737 cpumask_set_cpu(target_cpu, alloced_mask);
740738
741739 channel->target_cpu = target_cpu;
742− channel->target_vp = hv_cpu_number_to_vp_number(target_cpu);
743740
744741 free_cpumask_var(available_mask);
745742 }
drivers/hv/vmbus_drv.c+0−2
@@ -23,7 +23,6 @@ · 22 unmodified lines
2323 #include <linux/cpu.h>
2424 #include <linux/sched/task_stack.h>
2525
26−#include <asm/mshyperv.h>
2726 #include <linux/delay.h>
2827 #include <linux/notifier.h>
2928 #include <linux/ptrace.h>
@@ -1779,7 +1778,6 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel, · 1749 unmodified lines
17791778 */
17801779
17811780 channel->target_cpu = target_cpu;
1782− channel->target_vp = hv_cpu_number_to_vp_number(target_cpu);
17831781 channel->numa_node = cpu_to_node(target_cpu);
17841782
17851783 /* See init_vp_index(). */
include/linux/hyperv.h+7−8
@@ -803,15 +803,14 @@ struct vmbus_channel { · 802 unmodified lines
803803 u64 sig_event;
804804
805805 /*
806− * Starting with win8, this field will be used to specify
807− * the target virtual processor on which to deliver the interrupt for
808− * the host to guest communication.
809− * Prior to win8, incoming channel interrupts would only
810− * be delivered on cpu 0. Setting this value to 0 would
811− * preserve the earlier behavior.
806+ * Starting with win8, this field will be used to specify the
807+ * target CPU on which to deliver the interrupt for the host
808+ * to guest communication.
809+ *
810+ * Prior to win8, incoming channel interrupts would only be
811+ * delivered on CPU 0. Setting this value to 0 would preserve
812+ * the earlier behavior.
812813 */
813− u32 target_vp;
814− /* The corresponding CPUID in the guest */
815814 u32 target_cpu;
816815 int numa_node;
817816 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t