From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [RFC PATCH v2 04/12] x86/mm/tlb: Flush remote and local TLBs concurrently Date: Fri, 31 May 2019 13:48:50 +0200 Message-ID: References: <20190531063645.4697-1-namit@vmware.com> <20190531063645.4697-5-namit@vmware.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190531063645.4697-5-namit@vmware.com> Content-Language: de-DE List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Nadav Amit , Peter Zijlstra , Andy Lutomirski Cc: Sasha Levin , linux-hyperv@vger.kernel.org, Dave Hansen , Stephen Hemminger , kvm@vger.kernel.org, Haiyang Zhang , x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Dave Hansen , Ingo Molnar , Borislav Petkov , xen-devel@lists.xenproject.org, Paolo Bonzini , Thomas Gleixner , Boris Ostrovsky List-Id: virtualization@lists.linuxfoundation.org On 31/05/2019 08:36, Nadav Amit wrote: > To improve TLB shootdown performance, flush the remote and local TLBs > concurrently. Introduce flush_tlb_multi() that does so. The current > flush_tlb_others() interface is kept, since paravirtual interfaces need > to be adapted first before it can be removed. This is left for future > work. In such PV environments, TLB flushes are not performed, at this > time, concurrently. > > Add a static key to tell whether this new interface is supported. > > Cc: "K. Y. Srinivasan" > Cc: Haiyang Zhang > Cc: Stephen Hemminger > Cc: Sasha Levin > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: x86@kernel.org > Cc: Juergen Gross > Cc: Paolo Bonzini > Cc: Dave Hansen > Cc: Andy Lutomirski > Cc: Peter Zijlstra > Cc: Boris Ostrovsky > Cc: linux-hyperv@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: virtualization@lists.linux-foundation.org > Cc: kvm@vger.kernel.org > Cc: xen-devel@lists.xenproject.org > Signed-off-by: Nadav Amit > --- > arch/x86/hyperv/mmu.c | 2 + > arch/x86/include/asm/paravirt.h | 8 +++ > arch/x86/include/asm/paravirt_types.h | 6 ++ > arch/x86/include/asm/tlbflush.h | 6 ++ > arch/x86/kernel/kvm.c | 1 + > arch/x86/kernel/paravirt.c | 3 + > arch/x86/mm/tlb.c | 80 +++++++++++++++++++++++---- > arch/x86/xen/mmu_pv.c | 2 + > 8 files changed, 96 insertions(+), 12 deletions(-) > > diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c > index e65d7fe6489f..ca28b400c87c 100644 > --- a/arch/x86/hyperv/mmu.c > +++ b/arch/x86/hyperv/mmu.c > @@ -233,4 +233,6 @@ void hyperv_setup_mmu_ops(void) > pr_info("Using hypercall for remote TLB flush\n"); > pv_ops.mmu.flush_tlb_others = hyperv_flush_tlb_others; > pv_ops.mmu.tlb_remove_table = tlb_remove_table; > + > + static_key_disable(&flush_tlb_multi_enabled.key); > } > diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h > index c25c38a05c1c..192be7254457 100644 > --- a/arch/x86/include/asm/paravirt.h > +++ b/arch/x86/include/asm/paravirt.h > @@ -47,6 +47,8 @@ static inline void slow_down_io(void) > #endif > } > > +DECLARE_STATIC_KEY_TRUE(flush_tlb_multi_enabled); > + > static inline void __flush_tlb(void) > { > PVOP_VCALL0(mmu.flush_tlb_user); > @@ -62,6 +64,12 @@ static inline void __flush_tlb_one_user(unsigned long addr) > PVOP_VCALL1(mmu.flush_tlb_one_user, addr); > } > > +static inline void flush_tlb_multi(const struct cpumask *cpumask, > + const struct flush_tlb_info *info) > +{ > + PVOP_VCALL2(mmu.flush_tlb_multi, cpumask, info); > +} > + > static inline void flush_tlb_others(const struct cpumask *cpumask, > const struct flush_tlb_info *info) > { > diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h > index 946f8f1f1efc..3a156e63c57d 100644 > --- a/arch/x86/include/asm/paravirt_types.h > +++ b/arch/x86/include/asm/paravirt_types.h > @@ -211,6 +211,12 @@ struct pv_mmu_ops { > void (*flush_tlb_user)(void); > void (*flush_tlb_kernel)(void); > void (*flush_tlb_one_user)(unsigned long addr); > + /* > + * flush_tlb_multi() is the preferred interface. When it is used, > + * flush_tlb_others() should return false. Didn't you want to remove/change this comment? Juergen