Re: [PATCH] kvm: x86: move srcu lock out of kvm_vcpu_check_block

From: Paolo Bonzini
Date: Thu May 20 2021 - 08:31:38 EST


On 19/05/21 23:53, Sean Christopherson wrote:
1. Refactor check_nested_events() to split out a has_events() helper.
2. Move the has_events() call from kvm_vcpu_running() into kvm_vcpu_has_events()
3. Drop the explicit hv_timer_pending() in inject_pending_event(). It should
be dead code since it's just a pointer to nested_vmx_preemption_timer_pending(),
which is handled by vmx_check_nested_events() and called earlier.
4. Drop the explicit hv_timer_pending() in kvm_vcpu_has_events() for the same
reasons as (3). This can also drop hv_timer_pending() entirely.

Sounds good except that I would do (3) first, since if I understand correctly it's a valid cleanup in the current code as well, and do (2) and (4) at the same time since you're basically enlarging the scope of the existing hv_timer_pending call to include all nested events.

Paolo