Re: [RFC PATCH 5/6] x86/mm/tlb: Flush remote and local TLBs concurrently
From: Paolo Bonzini
Date: Mon May 27 2019 - 08:48:36 EST
On 27/05/19 14:32, Peter Zijlstra wrote:
> 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.
Neither here, and it would indeed deserve a comment if you left the if out.
Paolo