Skip to content

Commit 5bf7468

Browse files
andrea-parriliuw
authored andcommitted
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. Suggested-by: Michael Kelley <[email protected]> Signed-off-by: Andrea Parri (Microsoft) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Wei Liu <[email protected]>
1 parent b3a9e3b commit 5bf7468

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

drivers/hv/channel.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
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,
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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,6 @@ static void init_vp_index(struct vmbus_channel *channel)
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)
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
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,
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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,15 +803,14 @@ struct vmbus_channel {
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
/*

0 commit comments

Comments
 (0)