Re: [RFC PATCH 5/6] x86/mm/tlb: Flush remote and local TLBs concurrently
From: Peter Zijlstra
Date: Mon May 27 2019 - 08:36:12 EST
On Mon, May 27, 2019 at 12:21:59PM +0200, Paolo Bonzini wrote:
> On 27/05/19 11:47, Peter Zijlstra wrote:
> > --- a/arch/x86/kernel/kvm.c
> > +++ b/arch/x86/kernel/kvm.c
> > @@ -580,7 +580,7 @@ static void __init kvm_apf_trap_init(voi
> >
> > static DEFINE_PER_CPU(cpumask_var_t, __pv_tlb_mask);
> >
> > -static void kvm_flush_tlb_others(const struct cpumask *cpumask,
> > +static void kvm_flush_tlb_multi(const struct cpumask *cpumask,
> > const struct flush_tlb_info *info)
> > {
> > u8 state;
> > @@ -594,6 +594,9 @@ static void kvm_flush_tlb_others(const s
> > * queue flush_on_enter for pre-empted vCPUs
> > */
> > for_each_cpu(cpu, flushmask) {
> > + if (cpu == smp_processor_id())
> > + continue;
> > +
>
> Even this would be just an optimization; the vCPU you're running on
> cannot be preempted. You can just change others to multi.
Yeah, I know, but it felt weird so I added the explicit skip. No strong
feelings though.