Message ID | 1438792381-19453-2-git-send-email-rkrcmar@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Am 05.08.2015 um 18:32 schrieb Radim Kr?má?: > We want to have requests abstracted from bit operations. > > Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com> > --- kvm_check_request is now somewhat a misnomer (what is the difference between test and check?) but still Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> for the new interface. maybe we can rename kvm_check_request in a separate patch somewhen. > arch/x86/kvm/vmx.c | 2 +- > include/linux/kvm_host.h | 7 ++++++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 217f66343dc8..17514fe7d2cb 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -5879,7 +5879,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) > if (intr_window_requested && vmx_interrupt_allowed(vcpu)) > return handle_interrupt_window(&vmx->vcpu); > > - if (test_bit(KVM_REQ_EVENT, &vcpu->requests)) > + if (kvm_has_request(KVM_REQ_EVENT, vcpu)) > return 1; > > err = emulate_instruction(vcpu, EMULTYPE_NO_REEXECUTE); > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 27ccdf91a465..52e388367a26 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -1089,9 +1089,14 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) > set_bit(req, &vcpu->requests); > } > > +static inline bool kvm_has_request(int req, struct kvm_vcpu *vcpu) > +{ > + return test_bit(req, &vcpu->requests); > +} > + > static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) > { > - if (test_bit(req, &vcpu->requests)) { > + if (kvm_has_request(req, vcpu)) { > clear_bit(req, &vcpu->requests); > return true; > } else { > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2015-08-12 21:57+0200, Christian Borntraeger: > kvm_check_request is now somewhat a misnomer (what is the difference between test and check?) kvm_check_request has always been poetic; it uses two meanings of check, "examine" and "tick off", at the same time. We also want something that clears the request, so kvm_drop_request was my best candidate so far. > for the new interface. maybe we can rename kvm_check_request in a separate patch somewhen. I wonder why haven't we copied the naming convention from bit operations (or if programming would be better if German was its language), kvm_test_request kvm_set_request kvm_clear_request kvm_test_and_clear_request The only disadvantage is that kvm_test_and_clear_request is longer than kvm_check_request 123456789 by whooping 9 characters. I could live with that. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 13/08/2015 11:11, Radim Kr?má? wrote: >> > for the new interface. maybe we can rename kvm_check_request in a separate patch somewhen. > I wonder why haven't we copied the naming convention from bit operations > (or if programming would be better if German was its language), > > kvm_test_request > kvm_set_request > kvm_clear_request > kvm_test_and_clear_request > > The only disadvantage is that > kvm_test_and_clear_request > is longer than > kvm_check_request > 123456789 > by whooping 9 characters. > > I could live with that. Yes, that would be much better. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Am 13.08.2015 um 11:29 schrieb Paolo Bonzini: > > > On 13/08/2015 11:11, Radim Kr?má? wrote: >>>> for the new interface. maybe we can rename kvm_check_request in a separate patch somewhen. >> I wonder why haven't we copied the naming convention from bit operations >> (or if programming would be better if German was its language), >> >> kvm_test_request >> kvm_set_request >> kvm_clear_request >> kvm_test_and_clear_request >> >> The only disadvantage is that >> kvm_test_and_clear_request >> is longer than >> kvm_check_request >> 123456789 >> by whooping 9 characters. >> >> I could live with that. > > Yes, that would be much better. +1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2015-08-13 12:03+0200, Christian Borntraeger: > Am 13.08.2015 um 11:29 schrieb Paolo Bonzini: >> On 13/08/2015 11:11, Radim Kr?má? wrote: >>>>> for the new interface. maybe we can rename kvm_check_request in a separate patch somewhen. >>> I wonder why haven't we copied the naming convention from bit operations | [...] >> >> Yes, that would be much better. > > +1 I'll send patches later. Hope you won't mind keeping the doomed kvm_has_request() in v3. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 217f66343dc8..17514fe7d2cb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -5879,7 +5879,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) if (intr_window_requested && vmx_interrupt_allowed(vcpu)) return handle_interrupt_window(&vmx->vcpu); - if (test_bit(KVM_REQ_EVENT, &vcpu->requests)) + if (kvm_has_request(KVM_REQ_EVENT, vcpu)) return 1; err = emulate_instruction(vcpu, EMULTYPE_NO_REEXECUTE); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 27ccdf91a465..52e388367a26 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1089,9 +1089,14 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) set_bit(req, &vcpu->requests); } +static inline bool kvm_has_request(int req, struct kvm_vcpu *vcpu) +{ + return test_bit(req, &vcpu->requests); +} + static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) { - if (test_bit(req, &vcpu->requests)) { + if (kvm_has_request(req, vcpu)) { clear_bit(req, &vcpu->requests); return true; } else {
We want to have requests abstracted from bit operations. Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com> --- arch/x86/kvm/vmx.c | 2 +- include/linux/kvm_host.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)