Patch "x86/mm: Pass flush_tlb_info to flush_tlb_others() etc" has been added to the 4.9-stable tree
Subsystems (6)
This is a note to let you know that I've just added the patch titled
x86/mm: Pass flush_tlb_info to flush_tlb_others() etc
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-mm-pass-flush_tlb_info-to-flush_tlb_others-etc.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
a2055abe9c6789cedef29abbdaa488a087faccc3Mon Sep 17 00:00:00 2001
From: Andy Lutomirski <[email protected]>
Date: Sun, 28 May 2017 10:00:10 -0700
Subject: x86/mm: Pass flush_tlb_info to flush_tlb_others() etc
From: Andy Lutomirski <[email protected]>
commit a2055abe9c6789cedef29abbdaa488a087faccc3 upstream.
Rather than passing all the contents of flush_tlb_info to flush_tlb_others(), pass a pointer to the structure directly. For consistency, this also removes the unnecessary cpu parameter from uv_flush_tlb_others() to make its signature match the other *flush_tlb_others() functions.
This serves two purposes:
- It will dramatically simplify future patches that change struct flush_tlb_info, which I'm planning to do.
- struct flush_tlb_info is an adequate description of what to do for a local flush, too, so by reusing it we can remove duplicated code between local and remove flushes in a future patch.
--- arch/x86/include/asm/paravirt.h | 6 -- arch/x86/include/asm/paravirt_types.h | 5 -- arch/x86/include/asm/tlbflush.h | 19 +++++--- arch/x86/include/asm/uv/uv.h | 11 ++--- arch/x86/mm/tlb.c | 72 ++++++++++++++++++---------------- arch/x86/platform/uv/tlb_uv.c | 10 +--- arch/x86/xen/mmu.c | 10 ++-- 7 files changed, 68 insertions(+), 65 deletions(-)
arch/x86/include/asm/paravirt.h +2 -4
@@ -317,11 +317,9 @@ static inline void __flush_tlb_single(un }static inline void flush_tlb_others (const struct cpumask *cpumask, -struct mm_struct *mm, -unsigned long start, -unsigned long end) +const struct flush_tlb_info *info) { -PVOP_VCALL4 (pv_mmu_ops.flush_tlb_others, cpumask, mm, start, end); +PVOP_VCALL2 (pv_mmu_ops.flush_tlb_others, cpumask, info); }static inline int paravirt_pgd_alloc (struct mm_struct *mm)
arch/x86/include/asm/paravirt_types.h +2 -3
@@ -51,6 +51,7 @@ struct mm_struct;struct desc_struct ;struct task_struct ;struct cpumask ; +struct flush_tlb_info ;/* * Wrapper type for pointers to code which uses the non-standard
@@ -225,9 +226,7 @@ struct pv_mmu_ops {void (*flush_tlb_kernel)(void );void (*flush_tlb_single)(unsigned long addr);void (*flush_tlb_others)(const struct cpumask *cpus, -struct mm_struct *mm, -unsigned long start, -unsigned long end); +const struct flush_tlb_info *info);/* Hooks for allocating and freeing a pagetable top-level */ int (*pgd_alloc)(struct mm_struct *mm);
arch/x86/include/asm/tlbflush.h +11 -8
@@ -211,12 +211,18 @@ static inline void __flush_tlb_one(unsig* - flush_tlb_page(vma, vmaddr) flushes one page * - flush_tlb_range(vma, start, end) flushes a range of pages * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages -* - flush_tlb_others(cpumask, mm, start, end) flushes TLBs on other cpus +* - flush_tlb_others(cpumask, info) flushes TLBs on other cpus * * ..but the i386 has somewhat limited tlb flushing capabilities, * and page-granular flushes are available only on i486 and up. */ +struct flush_tlb_info { +struct mm_struct *mm; +unsigned long start; +unsigned long end; +}; +#ifndef CONFIG_SMP /* "_up" is for UniProcessor.
@@ -275,9 +281,7 @@ static inline void flush_tlb_mm_range(st }static inline void native_flush_tlb_others (const struct cpumask *cpumask, -struct mm_struct *mm, -unsigned long start, -unsigned long end) +const struct flush_tlb_info *info) { }
@@ -315,8 +319,7 @@ static inline void flush_tlb_page(struct }void native_flush_tlb_others (const struct cpumask *cpumask, -struct mm_struct *mm, -unsigned long start,unsigned long end); +const struct flush_tlb_info *info);#define TLBSTATE_OK 1#define TLBSTATE_LAZY 2
@@ -338,8 +341,8 @@ extern void arch_tlbbatch_flush(struct a#endif /* SMP */ #ifndef CONFIG_PARAVIRT -#define flush_tlb_others (mask, mm, start, end) \ - native_flush_tlb_others(mask, mm, start, end) +#define flush_tlb_others (mask, info) \ + native_flush_tlb_others(mask, info)#endif #endif /* _ASM_X86_TLBFLUSH_H */
arch/x86/include/asm/uv/uv.h +5 -6
@@ -1,6 +1,8 @@#ifndef _ASM_X86_UV_UV_H#define _ASM_X86_UV_UV_H +#include <asm/tlbflush.h> +enum uv_system_type {UV_NONE ,UV_LEGACY_APIC ,UV_X2APIC ,UV_NON_UNIQUE_APIC };struct cpumask ;
@@ -14,10 +16,7 @@ extern void uv_cpu_init(void);extern void uv_nmi_init (void );extern void uv_system_init (void );extern const struct cpumask *uv_flush_tlb_others (const struct cpumask *cpumask, -struct mm_struct *mm, -unsigned long start, -unsigned long end, -unsigned int cpu); +const struct flush_tlb_info *info);#else /* X86_UV */
@@ -26,8 +25,8 @@ static inline int is_uv_system(void) { rstatic inline void uv_cpu_init (void ) { }static inline void uv_system_init (void ) { }static inline const struct cpumask * -uv_flush_tlb_others (const struct cpumask *cpumask,struct mm_struct *mm, -unsigned long start,unsigned long end,unsigned int cpu) +uv_flush_tlb_others (const struct cpumask *cpumask, +const struct flush_tlb_info *info) {return cpumask; }#endif /* X86_UV */
arch/x86/mm/tlb.c +39 -33
171 lines not on this page · raw message
arch/x86/platform/uv/tlb_uv.c +4 -6
@@ -1110,11 +1110,9 @@ static int set_distrib_bits(struct cpuma* done. The returned pointer is valid till preemption is re-enabled. */ const struct cpumask *uv_flush_tlb_others (const struct cpumask *cpumask, -struct mm_struct *mm, -unsigned long start, -unsigned long end, -unsigned int cpu) +const struct flush_tlb_info *info) { +unsigned int cpu =smp_processor_id ();int locals =0 ;int remotes =0 ;int hubs =0 ;
@@ -1171,8 +1169,8 @@ const struct cpumask *uv_flush_tlb_otherrecord_send_statistics (stat, locals, hubs, remotes, bau_desc); -if (!end || (end - start) <=PAGE_SIZE ) - bau_desc->payload.address = start; +if (!info->end || (info->end - info->start) <=PAGE_SIZE ) + bau_desc->payload.address = info->start;else bau_desc->payload.address =TLB_FLUSH_ALL ; bau_desc->payload.sending_cpu = cpu;
arch/x86/xen/mmu.c +5 -5
@@ -1372,8 +1372,7 @@ static void xen_flush_tlb_single(unsigne }static void xen_flush_tlb_others (const struct cpumask *cpus, -struct mm_struct *mm,unsigned long start, -unsigned long end) +const struct flush_tlb_info *info) {struct {struct mmuext_op op;
@@ -1385,7 +1384,7 @@ static void xen_flush_tlb_others(const s } *args;struct multicall_space mcs; -trace_xen_mmu_flush_tlb_others (cpus, mm, start, end); +trace_xen_mmu_flush_tlb_others (cpus, info->mm, info->start, info->end);if (cpumask_empty (cpus))return ;/* nothing to do */
@@ -1399,9 +1398,10 @@ static void xen_flush_tlb_others(const scpumask_clear_cpu (smp_processor_id (),to_cpumask (args->mask)); args->op.cmd =MMUEXT_TLB_FLUSH_MULTI ; -if (end !=TLB_FLUSH_ALL && (end - start) <=PAGE_SIZE ) { +if (info->end !=TLB_FLUSH_ALL && + (info->end - info->start) <=PAGE_SIZE ) { args->op.cmd =MMUEXT_INVLPG_MULTI ; - args->op.arg1.linear_addr = start; + args->op.arg1.linear_addr = info->start; }MULTI_mmuext_op (mcs.mc, &args->op,1 ,NULL ,DOMID_SELF );
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/x86-mm-refactor-flush_tlb_mm_range-to-merge-local-and-remote-cases.patch queue-4.9/x86-mm-pass-flush_tlb_info-to-flush_tlb_others-etc.patch queue-4.9/x86-mm-rework-lazy-tlb-to-track-the-actual-loaded-mm.patch queue-4.9/x86-mm-kvm-teach-kvm-s-vmx-code-that-cr3-isn-t-a-constant.patch queue-4.9/x86-mm-use-new-merged-flush-logic-in-arch_tlbbatch_flush.patch queue-4.9/x86-kvm-vmx-simplify-segment_base.patch queue-4.9/x86-entry-unwind-create-stack-frames-for-saved-interrupt-registers.patch queue-4.9/x86-mm-reduce-indentation-in-flush_tlb_func.patch queue-4.9/x86-mm-remove-the-up-asm-tlbflush.h-code-always-use-the-formerly-smp-code.patch queue-4.9/x86-mm-reimplement-flush_tlb_page-using-flush_tlb_mm_range.patch queue-4.9/mm-x86-mm-make-the-batched-unmap-tlb-flush-api-more-generic.patch queue-4.9/x86-kvm-vmx-defer-tr-reload-after-vm-exit.patch queue-4.9/x86-mm-change-the-leave_mm-condition-for-local-tlb-flushes.patch queue-4.9/x86-mm-be-more-consistent-wrt-page_shift-vs-page_size-in-tlb-flush-code.patch