Re: [PATCH v7 2/4] KVM: X86: Add Paravirt TLB Shootdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2017-11-30 23:17 GMT+08:00 Radim Krčmář <rkrcmar@xxxxxxxxxx>:
> 2017-11-29 22:01-0800, Wanpeng Li:
>> From: Wanpeng Li <wanpeng.li@xxxxxxxxxxx>
>> ---
>> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
>> @@ -498,6 +498,34 @@ static void __init kvm_apf_trap_init(void)
>>       update_intr_gate(X86_TRAP_PF, async_page_fault);
>>  }
>>
>> +static DEFINE_PER_CPU(cpumask_var_t, __pv_tlb_mask);
>> +
>> +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);
>> +
>> +     cpumask_copy(flushmask, cpumask);
>
> Is it impossible to call this function before the allocation?
>
> I was guessing that early_initcall might allow us to avoid a (static)
> condition as there is no point in calling when there are no others, but
> expected the worst ...

kernel_init()
  -> kernel_init_freeable()
        -> do_basic_setup()
            -> do_initcalls()
  -> async_synchronize_full()  => finish all async __init code
  -> try_to_run_init_process()

All the async __init codes can guarantee to be completed before init
task is created, so I think arch_initcall() is fine.

Regards,
Wanpeng Li




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux