linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()"
@ 2019-02-02  9:20 lantianyu1986
  2019-02-14 16:42 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: lantianyu1986 @ 2019-02-02  9:20 UTC (permalink / raw)
  Cc: Lan Tianyu, pbonzini, rkrcmar, kvm, linux-kernel, sean.j.christopherson

From: Lan Tianyu <Tianyu.Lan@microsoft.com>

The value of "dirty_bitmap[i]" is already check before setting its value
to mask. The following check of "mask" is redundant. The check of "mask" was
introduced by commit 58d2930f4ee3(("KVM: Eliminate extra function calls in
kvm_get_dirty_log_protect()"). This patch is to revert the patch.

Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
---
 virt/kvm/kvm_main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2bdc827b9ee9..ef06cfb9b52b 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1200,11 +1200,9 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
 			mask = xchg(&dirty_bitmap[i], 0);
 			dirty_bitmap_buffer[i] = mask;
 
-			if (mask) {
-				offset = i * BITS_PER_LONG;
-				kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
-									offset, mask);
-			}
+			offset = i * BITS_PER_LONG;
+			kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
+								offset, mask);
 		}
 		spin_unlock(&kvm->mmu_lock);
 	}
-- 
2.14.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Revert "KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()"
  2019-02-02  9:20 [PATCH] Revert "KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()" lantianyu1986
@ 2019-02-14 16:42 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-02-14 16:42 UTC (permalink / raw)
  To: lantianyu1986
  Cc: Lan Tianyu, rkrcmar, kvm, linux-kernel, sean.j.christopherson

On 02/02/19 10:20, lantianyu1986@gmail.com wrote:
> From: Lan Tianyu <Tianyu.Lan@microsoft.com>
> 
> The value of "dirty_bitmap[i]" is already check before setting its value
> to mask. The following check of "mask" is redundant. The check of "mask" was
> introduced by commit 58d2930f4ee3(("KVM: Eliminate extra function calls in
> kvm_get_dirty_log_protect()"). This patch is to revert the patch.
> 
> Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
> ---
>  virt/kvm/kvm_main.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 2bdc827b9ee9..ef06cfb9b52b 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1200,11 +1200,9 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
>  			mask = xchg(&dirty_bitmap[i], 0);
>  			dirty_bitmap_buffer[i] = mask;
>  
> -			if (mask) {
> -				offset = i * BITS_PER_LONG;
> -				kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
> -									offset, mask);
> -			}
> +			offset = i * BITS_PER_LONG;
> +			kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
> +								offset, mask);
>  		}
>  		spin_unlock(&kvm->mmu_lock);
>  	}
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-14 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-02  9:20 [PATCH] Revert "KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()" lantianyu1986
2019-02-14 16:42 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).