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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fa567ab7-bf5d-3c95-aea8-2dcba00d50cd@redhat.com>
Date:   Tue, 3 May 2022 11:32:30 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Vipin Sharma <vipinsh@...gle.com>
Cc:     seanjc@...gle.com, vkuznets@...hat.com, wanpengli@...cent.com,
        jmattson@...gle.com, joro@...tes.org, dmatlack@...gle.com,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] KVM: x86/mmu: Speed up slot_rmap_walk_next for
 sparsely populated rmaps

On 5/3/22 00:03, Vipin Sharma wrote:
> Avoid calling handlers on empty rmap entries and skip to the next non
> empty rmap entry.
> 
> Empty rmap entries are noop in handlers.
> 
> Signed-off-by: Vipin Sharma <vipinsh@...gle.com>
> Suggested-by: Sean Christopherson <seanjc@...gle.com>
> ---
> 
> v2:
> - Removed noinline from slot_rmap_walk_next signature
> 
> v1:
> - https://lore.kernel.org/lkml/20220325233125.413634-1-vipinsh@google.com
> 
>   arch/x86/kvm/mmu/mmu.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 77785587332e..4e8d546431eb 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -1501,9 +1501,11 @@ static bool slot_rmap_walk_okay(struct slot_rmap_walk_iterator *iterator)
>   
>   static void slot_rmap_walk_next(struct slot_rmap_walk_iterator *iterator)
>   {
> -	if (++iterator->rmap <= iterator->end_rmap) {
> +	while (++iterator->rmap <= iterator->end_rmap) {
>   		iterator->gfn += (1UL << KVM_HPAGE_GFN_SHIFT(iterator->level));
> -		return;
> +
> +		if (iterator->rmap->val)
> +			return;
>   	}
>   
>   	if (++iterator->level > iterator->end_level) {
> 
> base-commit: 71d7c575a673d42ad7175ad5fc27c85c80330311

Queued, thanks.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ