lkml.org 
[lkml]   [2017]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4 2/4] KVM: X86: Add paravirt remote TLB flush
2017-11-13 16:04 GMT+08:00 Peter Zijlstra <peterz@infradead.org>:
> On Sun, Nov 12, 2017 at 04:33:24PM -0800, Wanpeng Li wrote:
>> +static void kvm_flush_tlb_others(const struct cpumask *cpumask,
>> + const struct flush_tlb_info *info)
>> +{
>> + u8 state;
>> + int cpu;
>> + struct kvm_steal_time *src;
>> + struct cpumask *flushmask = this_cpu_cpumask_var_ptr(__pv_tlb_mask);
>> +
>> + if (unlikely(!flushmask))
>> + return;
>> +
>> + cpumask_copy(flushmask, cpumask);
>> + /*
>> + * We have to call flush only on online vCPUs. And
>> + * queue flush_on_enter for pre-empted vCPUs
>> + */
>> + for_each_cpu(cpu, cpumask) {
>> + src = &per_cpu(steal_time, cpu);
>> + state = READ_ONCE(src->preempted);
>> + if ((state & KVM_VCPU_PREEMPTED)) {
>> + if (try_cmpxchg(&src->preempted, &state,
>> + state | KVM_VCPU_SHOULD_FLUSH))
>> + __cpumask_clear_cpu(cpu, flushmask);
>> + }
>> + }
>
> So if at this point a vCPU gets preempted we'll still spin-wait for it,
> which is sub-optimal.
>
> I think we can come up with something to get around that 'problem' if
> indeed it is a problem. But we can easily do that as follow up patches.
> Just let me know if you think its worth spending more time on.

You can post your idea, it is always smart. :) Then we can evaluate
the complexity and gains.

Regards,
Wanpeng Li

\
 
 \ /
  Last update: 2017-11-13 09:28    [W:0.066 / U:12.476 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site