lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Mar 2015 09:58:21 +0100
From:	Paolo Bonzini <pbonzini@...hat.com>
To:	Takuya Yoshikawa <yoshikawa_takuya_b1@....ntt.co.jp>
CC:	kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: Eliminate extra function calls in kvm_get_dirty_log_protect()



On 17/03/2015 08:19, Takuya Yoshikawa wrote:
> When all bits in mask are not set,
> kvm_arch_mmu_enable_log_dirty_pt_masked() has nothing to do.  But since
> it needs to be called from the generic code, it cannot be inlined, and
> a few function calls, two when PML is enabled, are wasted.
> 
> Since it is common to see many pages remain clean, e.g. framebuffers can
> stay calm for a long time, it is worth eliminating this overhead.
> 
> Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@....ntt.co.jp>
> ---
>  virt/kvm/kvm_main.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index a109370..420d8cf 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1061,9 +1061,11 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
>  		mask = xchg(&dirty_bitmap[i], 0);
>  		dirty_bitmap_buffer[i] = mask;
>  
> -		offset = i * BITS_PER_LONG;
> -		kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, offset,
> -								mask);
> +		if (mask) {
> +			offset = i * BITS_PER_LONG;
> +			kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
> +								offset, mask);
> +		}
>  	}
>  
>  	spin_unlock(&kvm->mmu_lock);
> 

Good catch!

Reviewed-by: Paolo Bonzini <pbonzini@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ