Skip to content

Commit 9a2d78e

Browse files
kattisrinivasanKAGA-KOKO
authored andcommitted
X86/Hyper-V: Consolidate the allocation of the hypercall input page
Consolidate the allocation of the hypercall input page. Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 800b8f0 commit 9a2d78e

File tree

3 files changed

+6
-27
lines changed

3 files changed

+6
-27
lines changed

arch/x86/hyperv/hv_init.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ void __init hyperv_init(void)
324324
hypercall_msr.guest_physical_address = vmalloc_to_pfn(hv_hypercall_pg);
325325
wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
326326

327-
hyper_alloc_mmu();
328-
329327
hv_apic_init();
330328

331329
/*

arch/x86/hyperv/mmu.c

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ struct hv_flush_pcpu_ex {
3232
/* Each gva in gva_list encodes up to 4096 pages to flush */
3333
#define HV_TLB_FLUSH_UNIT (4096 * PAGE_SIZE)
3434

35-
static struct hv_flush_pcpu __percpu **pcpu_flush;
36-
37-
static struct hv_flush_pcpu_ex __percpu **pcpu_flush_ex;
3835

3936
/*
4037
* Fills in gva_list starting from offset. Returns the number of items added.
@@ -77,18 +74,16 @@ static void hyperv_flush_tlb_others(const struct cpumask *cpus,
7774

7875
trace_hyperv_mmu_flush_tlb_others(cpus, info);
7976

80-
if (!pcpu_flush || !hv_hypercall_pg)
77+
if (!hv_hypercall_pg)
8178
goto do_native;
8279

8380
if (cpumask_empty(cpus))
8481
return;
8582

8683
local_irq_save(flags);
8784

88-
flush_pcpu = this_cpu_ptr(pcpu_flush);
89-
90-
if (unlikely(!*flush_pcpu))
91-
*flush_pcpu = page_address(alloc_page(GFP_ATOMIC));
85+
flush_pcpu = (struct hv_flush_pcpu **)
86+
this_cpu_ptr(hyperv_pcpu_input_arg);
9287

9388
flush = *flush_pcpu;
9489

@@ -164,18 +159,16 @@ static void hyperv_flush_tlb_others_ex(const struct cpumask *cpus,
164159

165160
trace_hyperv_mmu_flush_tlb_others(cpus, info);
166161

167-
if (!pcpu_flush_ex || !hv_hypercall_pg)
162+
if (!hv_hypercall_pg)
168163
goto do_native;
169164

170165
if (cpumask_empty(cpus))
171166
return;
172167

173168
local_irq_save(flags);
174169

175-
flush_pcpu = this_cpu_ptr(pcpu_flush_ex);
176-
177-
if (unlikely(!*flush_pcpu))
178-
*flush_pcpu = page_address(alloc_page(GFP_ATOMIC));
170+
flush_pcpu = (struct hv_flush_pcpu_ex **)
171+
this_cpu_ptr(hyperv_pcpu_input_arg);
179172

180173
flush = *flush_pcpu;
181174

@@ -257,14 +250,3 @@ void hyperv_setup_mmu_ops(void)
257250
pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others_ex;
258251
}
259252
}
260-
261-
void hyper_alloc_mmu(void)
262-
{
263-
if (!(ms_hyperv.hints & HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED))
264-
return;
265-
266-
if (!(ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED))
267-
pcpu_flush = alloc_percpu(struct hv_flush_pcpu *);
268-
else
269-
pcpu_flush_ex = alloc_percpu(struct hv_flush_pcpu_ex *);
270-
}

arch/x86/include/asm/mshyperv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
294294

295295
void __init hyperv_init(void);
296296
void hyperv_setup_mmu_ops(void);
297-
void hyper_alloc_mmu(void);
298297
void hyperv_report_panic(struct pt_regs *regs, long err);
299298
bool hv_is_hyperv_initialized(void);
300299
void hyperv_cleanup(void);

0 commit comments

Comments
 (0)