Re: [PATCH] KVM: arm: fix missing free_percpu_irq in kvm_timer_hyp_init()

From: linmiaohe
Date: Sat Dec 07 2019 - 02:14:15 EST


Marc Zyngier <maz@xxxxxxxxxx> wrote:
>On 2019-11-23 02:30, linmiaohe wrote:
>> From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>>
>> When host_ptimer_irq request irq resource failed, we forget to release
>> the host_vtimer_irq resource already requested.
>> Fix this missing irq release and other similar scenario.
>
>That's really not a big deal, as nothing but KVM can use the timers anyway, but I guess it doesn't hurt to be correct.

I think It's a good practice to release the never used resources though it may be harmless.

>>
>> -out_free_irq:
>> +
>> +out_free_ptimer_irq:
>> + free_percpu_irq(host_ptimer_irq, kvm_get_running_vcpus());
>> +out_disable_gic_state:
>> + if (has_gic)
>> + static_branch_disable(&has_gic_active_state);
>
>Given that we're failing the init of KVM, this is totally superfluous. Also, this state is still valid, no matter what happens (the GIC is not going away from under our feet).
>

Would you like a v2 patch without out_disable_gic_state cleanup ? If so, I would send a new one. But if you
think this patch isn't worth to pick up, I would drop it.

Many thanks for your review.

>> +out_free_vtimer_irq:
>> free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus());
>> +