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.
Unified · Split
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/uio.h> |
| 19 | 19 | #include <linux/interrupt.h> |
| 20 | 20 | #include <asm/page.h> |
| 21 | +#include <asm/mshyperv.h> | |
| 21 | 22 | |
| 22 | 23 | #include "hyperv_vmbus.h" |
| 23 | 24 | |
| @@ -176,7 +177,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel, · 152 unmodified lines | ||
| 176 | 177 | open_msg->child_relid = newchannel->offermsg.child_relid; |
| 177 | 178 | open_msg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle; |
| 178 | 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 | 182 | if (userdatalen) |
| 182 | 183 | memcpy(open_msg->userdata, userdata, userdatalen); |
| @@ -704,8 +704,6 @@ static void init_vp_index(struct vmbus_channel *channel) · 703 unmodified lines | ||
| 704 | 704 | */ |
| 705 | 705 | channel->numa_node = cpu_to_node(VMBUS_CONNECT_CPU); |
| 706 | 706 | channel->target_cpu = VMBUS_CONNECT_CPU; |
| 707 | − channel->target_vp = | |
| 708 | − hv_cpu_number_to_vp_number(VMBUS_CONNECT_CPU); | |
| 709 | 707 | if (perf_chn) |
| 710 | 708 | hv_set_alloced_cpu(VMBUS_CONNECT_CPU); |
| 711 | 709 | return; |
| @@ -739,7 +737,6 @@ static void init_vp_index(struct vmbus_channel *channel) · 27 unmodified lines | ||
| 739 | 737 | cpumask_set_cpu(target_cpu, alloced_mask); |
| 740 | 738 | |
| 741 | 739 | channel->target_cpu = target_cpu; |
| 742 | − channel->target_vp = hv_cpu_number_to_vp_number(target_cpu); | |
| 743 | 740 | |
| 744 | 741 | free_cpumask_var(available_mask); |
| 745 | 742 | } |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/cpu.h> |
| 24 | 24 | #include <linux/sched/task_stack.h> |
| 25 | 25 | |
| 26 | −#include <asm/mshyperv.h> | |
| 27 | 26 | #include <linux/delay.h> |
| 28 | 27 | #include <linux/notifier.h> |
| 29 | 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 | 1780 | channel->target_cpu = target_cpu; |
| 1782 | − channel->target_vp = hv_cpu_number_to_vp_number(target_cpu); | |
| 1783 | 1781 | channel->numa_node = cpu_to_node(target_cpu); |
| 1784 | 1782 | |
| 1785 | 1783 | /* See init_vp_index(). */ |
| @@ -803,15 +803,14 @@ struct vmbus_channel { · 802 unmodified lines | ||
| 803 | 803 | u64 sig_event; |
| 804 | 804 | |
| 805 | 805 | /* |
| 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. | |
| 812 | 813 | */ |
| 813 | − u32 target_vp; | |
| 814 | − /* The corresponding CPUID in the guest */ | |
| 815 | 814 | u32 target_cpu; |
| 816 | 815 | int numa_node; |
| 817 | 816 | /* |