Re: [PATCH v5 8/8] KVM: Make kvm_make_vcpus_request_mask() use pre-allocated cpu_kick_mask
From: Vitaly Kuznetsov
Date: Mon Sep 06 2021 - 03:24:02 EST
Sean Christopherson <seanjc@xxxxxxxxxx> writes:
> On Fri, Sep 03, 2021, Vitaly Kuznetsov wrote:
>> kvm_make_vcpus_request_mask() already disables preemption so just like
>> kvm_make_all_cpus_request_except() it can be switched to using
>> pre-allocated per-cpu cpumasks. This allows for improvements for both
>> users of the function: in Hyper-V emulation code 'tlb_flush' can now be
>> dropped from 'struct kvm_vcpu_hv' and kvm_make_scan_ioapic_request_mask()
>> gets rid of dynamic allocation.
>>
>> cpumask_available() checks in kvm_make_vcpu_request() and
>> kvm_kick_many_cpus() can now be dropped as they checks for an impossible
>> condition: kvm_init() makes sure per-cpu masks are allocated.
>>
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
>> ---
>
> Reviewed-by: Sean Christopherson <seanjc@xxxxxxxxxx>
>
Thanks!
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index a4752dcc2a75..91c1e6c98b0f 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -9224,14 +9224,8 @@ static void process_smi(struct kvm_vcpu *vcpu)
>> void kvm_make_scan_ioapic_request_mask(struct kvm *kvm,
>> unsigned long *vcpu_bitmap)
>> {
>> - cpumask_var_t cpus;
>> -
>> - zalloc_cpumask_var(&cpus, GFP_ATOMIC);
>> -
>> kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
>> - vcpu_bitmap, cpus);
>> -
>> - free_cpumask_var(cpus);
>> + vcpu_bitmap);
>
> Nit, this can all go on a single line.
>
Sorry, you've mentioned this on v4 but I forgot. Hope this can be fixed
upon commit...
>> }
>>
>> void kvm_make_scan_ioapic_request(struct kvm *kvm)
>
--
Vitaly