KVM: nVMX: kmap() can't fail
cover KVM: nVMX: kmap() can't fail
Not sure if the second one is strictly needed (delta LOC changes is 0).
David Hildenbrand (2):
KVM: nVMX: kmap() can't fail
KVM: nVMX: vmx_complete_nested_posted_interrupt() can't fail
arch/x86/kvm/vmx.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/2 KVM: nVMX: kmap() can't fail
kmap() can't fail, therefore it will always return a valid pointer. Let's just get rid of the unnecessary checks.
--- arch/x86/kvm/vmx.c | 9 --------- 1 file changed, 9 deletions(-)
arch/x86/kvm/vmx.c +0 -9
@@ -4973,10 +4973,6 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)return 0 ; vapic_page =kmap (vmx->nested.virtual_apic_page); -if (!vapic_page) { -WARN_ON (1 ); -return -ENOMEM ; - }__kvm_apic_update_irr (vmx->nested.pi_desc->pir, vapic_page);kunmap (vmx->nested.virtual_apic_page);
@@ -9730,11 +9726,6 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,return false; } msr_bitmap_l1 = (unsigned long *)kmap (page); -if (!msr_bitmap_l1) { -nested_release_page_clean (page); -WARN_ON (1 ); -return false; - }memset (msr_bitmap_l0,0xff ,PAGE_SIZE );
Signature · 1 line
2.9.3
PATCH 2/2 KVM: nVMX: vmx_complete_nested_posted_interrupt() can't fail
In reply to David Hildenbrandvmx_complete_nested_posted_interrupt() can't fail, let's turn it into a void function.
--- arch/x86/kvm/vmx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/kvm/vmx.c +5 -5
@@ -4953,7 +4953,7 @@ static bool vmx_get_enable_apicv(void)return enable_apicv; } -static int vmx_complete_nested_posted_interrupt (struct kvm_vcpu *vcpu) +static void vmx_complete_nested_posted_interrupt (struct kvm_vcpu *vcpu) {struct vcpu_vmx *vmx =to_vmx (vcpu);int max_irr;
@@ -4964,13 +4964,13 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu) vmx->nested.pi_pending) { vmx->nested.pi_pending = false;if (!pi_test_and_clear_on (vmx->nested.pi_desc)) -return 0 ; +return ; max_irr =find_last_bit ( (unsigned long *)vmx->nested.pi_desc->pir,256 );if (max_irr ==256 ) -return 0 ; +return ; vapic_page =kmap (vmx->nested.virtual_apic_page);__kvm_apic_update_irr (vmx->nested.pi_desc->pir, vapic_page);
@@ -4983,7 +4983,6 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)vmcs_write16 (GUEST_INTR_STATUS , status); } } -return 0 ; }static inline bool kvm_vcpu_trigger_posted_interrupt (struct kvm_vcpu *vcpu)
@@ -10687,7 +10686,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr)return 0 ; } -return vmx_complete_nested_posted_interrupt (vcpu); +vmx_complete_nested_posted_interrupt (vcpu); +return 0 ; }static u32 vmx_get_preemption_timer_value (struct kvm_vcpu *vcpu)
Signature · 1 line
2.9.3
Paolo Bonzini
maintainerQuoted 9 lines · David Hildenbrand
Not sure if the second one is strictly needed (delta LOC changes is 0).
David Hildenbrand (2):
KVM: nVMX:kmap()can't fail
KVM: nVMX:vmx_complete_nested_posted_interrupt()can't failarch/x86/kvm/vmx.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
It's okay since you're removing the cases with nonzero return value. Queued, thanks.
Paolo