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
18#include <linux/uio.h>18#include <linux/uio.h>
19#include <linux/interrupt.h>19#include <linux/interrupt.h>
20#include <asm/page.h>20#include <asm/page.h>
21#include <asm/mshyperv.h>
21 22
22#include "hyperv_vmbus.h"23#include "hyperv_vmbus.h"
23 24
@@ -176,7 +177,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel, · 152 unmodified lines
176 open_msg->child_relid = newchannel->offermsg.child_relid;177 open_msg->child_relid = newchannel->offermsg.child_relid;
177 open_msg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle;178 open_msg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle;
178 open_msg->downstream_ringbuffer_pageoffset = newchannel->ringbuffer_send_offset;179 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);
180 181
181 if (userdatalen)182 if (userdatalen)
182 memcpy(open_msg->userdata, userdata, userdatalen);183 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
704 */704 */
705 channel->numa_node = cpu_to_node(VMBUS_CONNECT_CPU);705 channel->numa_node = cpu_to_node(VMBUS_CONNECT_CPU);
706 channel->target_cpu = VMBUS_CONNECT_CPU;706 channel->target_cpu = VMBUS_CONNECT_CPU;
707 channel->target_vp =
708 hv_cpu_number_to_vp_number(VMBUS_CONNECT_CPU);
709 if (perf_chn)707 if (perf_chn)
710 hv_set_alloced_cpu(VMBUS_CONNECT_CPU);708 hv_set_alloced_cpu(VMBUS_CONNECT_CPU);
711 return;709 return;
@@ -739,7 +737,6 @@ static void init_vp_index(struct vmbus_channel *channel) · 27 unmodified lines
739 cpumask_set_cpu(target_cpu, alloced_mask);737 cpumask_set_cpu(target_cpu, alloced_mask);
740 738
741 channel->target_cpu = target_cpu;739 channel->target_cpu = target_cpu;
742 channel->target_vp = hv_cpu_number_to_vp_number(target_cpu);
743 740
744 free_cpumask_var(available_mask);741 free_cpumask_var(available_mask);
745}742}
drivers/hv/vmbus_drv.c+0−2
@@ -23,7 +23,6 @@ · 22 unmodified lines
23#include <linux/cpu.h>23#include <linux/cpu.h>
24#include <linux/sched/task_stack.h>24#include <linux/sched/task_stack.h>
25 25
26#include <asm/mshyperv.h>
27#include <linux/delay.h>26#include <linux/delay.h>
28#include <linux/notifier.h>27#include <linux/notifier.h>
29#include <linux/ptrace.h>28#include <linux/ptrace.h>
@@ -1779,7 +1778,6 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel, · 1749 unmodified lines
1779 */1778 */
1780 1779
1781 channel->target_cpu = target_cpu;1780 channel->target_cpu = target_cpu;
1782 channel->target_vp = hv_cpu_number_to_vp_number(target_cpu);
1783 channel->numa_node = cpu_to_node(target_cpu);1781 channel->numa_node = cpu_to_node(target_cpu);
1784 1782
1785 /* See init_vp_index(). */1783 /* See init_vp_index(). */
include/linux/hyperv.h+7−8
@@ -803,15 +803,14 @@ struct vmbus_channel { · 802 unmodified lines
803 u64 sig_event;803 u64 sig_event;
804 804
805 /*805 /*
806 * Starting with win8, this field will be used to specify806 * Starting with win8, this field will be used to specify the
807 * the target virtual processor on which to deliver the interrupt for807 * target CPU on which to deliver the interrupt for the host
808 * the host to guest communication.808 * to guest communication.
809 * Prior to win8, incoming channel interrupts would only809 *
810 * be delivered on cpu 0. Setting this value to 0 would810 * Prior to win8, incoming channel interrupts would only be
811 * preserve the earlier behavior.811 * delivered on CPU 0. Setting this value to 0 would preserve
812 * the earlier behavior.
812 */813 */
813 u32 target_vp;
814 /* The corresponding CPUID in the guest */
815 u32 target_cpu;814 u32 target_cpu;
816 int numa_node;815 int numa_node;
817 /*816 /*

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