Re: [PATCH v2 2/5] KVM: add KVM request variants without barrier
From: Peter Xu
Date: Tue Feb 28 2017 - 02:34:37 EST
On Fri, Feb 24, 2017 at 08:49:59PM +0100, Radim KrÄmÃÅ wrote:
> The leading underscores denote that the call is just a bitop wrapper.
>
> Switch all users of open-coded set/check/test to kvm_request ones.
>
> Automated by coccinelle script:
> @@
> expression VCPU, REQ;
> @@
> -set_bit(REQ, &VCPU->requests)
> +__kvm_request_set(REQ, VCPU)
>
> @@
> expression VCPU, REQ;
> @@
> -clear_bit(REQ, &VCPU->requests)
> +__kvm_request_clear(REQ, VCPU)
>
> @@
> expression VCPU, REQ;
> @@
> -test_bit(REQ, &VCPU->requests)
> +__kvm_request_test(REQ, VCPU)
>
> Signed-off-by: Radim KrÄmÃÅ <rkrcmar@xxxxxxxxxx>
> ---
> v2: clear_bit in __kvm_request_clear [Paolo]
> ---
> arch/mips/kvm/emulate.c | 2 +-
> arch/powerpc/kvm/book3s_pr.c | 2 +-
> arch/powerpc/kvm/book3s_pr_papr.c | 2 +-
> arch/powerpc/kvm/booke.c | 4 ++--
> arch/powerpc/kvm/powerpc.c | 2 +-
> arch/s390/kvm/kvm-s390.c | 2 +-
> arch/x86/kvm/vmx.c | 2 +-
> arch/x86/kvm/x86.c | 14 +++++++-------
> include/linux/kvm_host.h | 23 ++++++++++++++++++++---
> 9 files changed, 35 insertions(+), 18 deletions(-)
>
> diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
> index ee4af898bcf6..552ae2b5e911 100644
> --- a/arch/mips/kvm/emulate.c
> +++ b/arch/mips/kvm/emulate.c
> @@ -865,7 +865,7 @@ enum emulation_result kvm_mips_emul_wait(struct kvm_vcpu *vcpu)
> * check if any I/O interrupts are pending.
> */
> if (kvm_request_test_and_clear(KVM_REQ_UNHALT, vcpu)) {
> - clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
> + __kvm_request_clear(KVM_REQ_UNHALT, vcpu);
Shall we just remove above line since we cleared it already?
-- peterx