Skip to content

Commit d8e6b23

Browse files
vittyvkKAGA-KOKO
authored andcommitted
x86/hyper-v: Use 'fast' hypercall for HVCALL_SEND_IPI
Current Hyper-V TLFS (v5.0b) claims that HvCallSendSyntheticClusterIpi hypercall can't be 'fast' (passing parameters through registers) but apparently this is not true, Windows always uses 'fast' version. We can do the same in Linux too. Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Cc: [email protected] Cc: "K. Y. Srinivasan" <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Stephen Hemminger <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Tianyu Lan <[email protected]> Cc: "Michael Kelley (EOSG)" <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 53e5296 commit d8e6b23

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

arch/x86/hyperv/hv_apic.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ static bool __send_ipi_mask_ex(const struct cpumask *mask, int vector)
128128
static bool __send_ipi_mask(const struct cpumask *mask, int vector)
129129
{
130130
int cur_cpu, vcpu;
131-
struct ipi_arg_non_ex **arg;
132-
struct ipi_arg_non_ex *ipi_arg;
131+
struct ipi_arg_non_ex ipi_arg;
133132
int ret = 1;
134-
unsigned long flags;
135133

136134
if (cpumask_empty(mask))
137135
return true;
@@ -145,16 +143,8 @@ static bool __send_ipi_mask(const struct cpumask *mask, int vector)
145143
if ((ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED))
146144
return __send_ipi_mask_ex(mask, vector);
147145

148-
local_irq_save(flags);
149-
arg = (struct ipi_arg_non_ex **)this_cpu_ptr(hyperv_pcpu_input_arg);
150-
151-
ipi_arg = *arg;
152-
if (unlikely(!ipi_arg))
153-
goto ipi_mask_done;
154-
155-
ipi_arg->vector = vector;
156-
ipi_arg->reserved = 0;
157-
ipi_arg->cpu_mask = 0;
146+
ipi_arg.vector = vector;
147+
ipi_arg.cpu_mask = 0;
158148

159149
for_each_cpu(cur_cpu, mask) {
160150
vcpu = hv_cpu_number_to_vp_number(cur_cpu);
@@ -165,13 +155,13 @@ static bool __send_ipi_mask(const struct cpumask *mask, int vector)
165155
if (vcpu >= 64)
166156
goto ipi_mask_done;
167157

168-
__set_bit(vcpu, (unsigned long *)&ipi_arg->cpu_mask);
158+
__set_bit(vcpu, (unsigned long *)&ipi_arg.cpu_mask);
169159
}
170160

171-
ret = hv_do_hypercall(HVCALL_SEND_IPI, ipi_arg, NULL);
161+
ret = hv_do_fast_hypercall16(HVCALL_SEND_IPI, ipi_arg.vector,
162+
ipi_arg.cpu_mask);
172163

173164
ipi_mask_done:
174-
local_irq_restore(flags);
175165
return ((ret == 0) ? true : false);
176166
}
177167

0 commit comments

Comments
 (0)