KVM: x86: remove duplicated KVM_REQ_EVENT request
Hi:
Quoted 12 lines · Vitaly Kuznetsov
Review
Quoted 7 lines · linmiaohe
From: Miaohe Lin <[email protected]>
The
KVM_REQ_EVENTrequest is already made inkvm_set_rflags(). We should not make it again.(quoted diff) +0
-1kvm_rip_write(vcpu, ctxt->eip); kvm_set_rflags(vcpu, ctxt->eflags); - kvm_make_request(KVM_REQ_EVENT, vcpu);I would've actually done it the other way around and removed
kvm_make_request()fromkvm_set_rflags()as it is not an obvious behavior (e.g. whykvm_rip_write()doens't do that andkvm_set_rflags()does ?) addingkvm_make_request()to all call sites.
Quoted 3 lines
In case this looks like too big of a change with no particular gain I'd suggest you at least leave a comment above
kvm_set_rflags(), something like"
kvm_make_request()also requestsKVM_REQ_EVENT"
I think adding kvm_make_request() to all call sites is too big without particular gain. And also leave a comment above kvm_set_rflags() maybe isn't needed as rflags updates is an site that can trigger event injection. Please see commit (3842d135ff24 KVM: Check for pending events before attempting injection) for detail.
What do you think? Thanks for your review anyway. :)
Vitaly Kuznetsov
Reviewed-byQuoted 16 lines · linmiaohe
Hi:
Quoted 14 lines · Vitaly Kuznetsov
Review
Quoted 7 lines · linmiaohe
From: Miaohe Lin <[email protected]>
The
KVM_REQ_EVENTrequest is already made inkvm_set_rflags(). We should not make it again.(quoted diff) +0
-1kvm_rip_write(vcpu, ctxt->eip); kvm_set_rflags(vcpu, ctxt->eflags); - kvm_make_request(KVM_REQ_EVENT, vcpu);I would've actually done it the other way around and removed
kvm_make_request()fromkvm_set_rflags()as it is not an obvious behavior (e.g. whykvm_rip_write()doens't do that andkvm_set_rflags()does ?) addingkvm_make_request()to all call sites.In case this looks like too big of a change with no particular gain I'd suggest you at least leave a comment above
kvm_set_rflags(), something like
Quoted 7 lines
Quoted 1 line
"
kvm_make_request()also requestsKVM_REQ_EVENT"I think adding
kvm_make_request()to all call sites is too big without particular gain. And also leave a comment abovekvm_set_rflags()maybe isn't needed as rflags updates is an site that can trigger event injection. Please see commit (3842d135ff24KVM: Check for pending events before attempting injection) for detail.What do you think?
I don't have a strong opinion on this and your change is correct so feel free to throw my
Signature · 1 line
Vitaly
Paolo Bonzini
maintainerQuoted 3 lines · Vitaly Kuznetsov
kvm_make_request()fromkvm_set_rflags()as it is not an obvious behavior (e.g. whykvm_rip_write()doens't do that andkvm_set_rflags()does ?)
Because writing RFLAGS can change IF and therefore cause an interrupt to be injected.
Paolo