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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZB25pR7cv3mjnn4s@google.com>
Date:   Fri, 24 Mar 2023 07:54:29 -0700
From:   Sean Christopherson <seanjc@...gle.com>
To:     Jun Miao <jun.miao@...el.com>
Cc:     pbonzini@...hat.com, kvm@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] KVM: Fix comments that refer to the non-existent install_new_memslots()

On Thu, Feb 23, 2023, Jun Miao wrote:
> The function of install_new_memslots() was replaced by kvm_swap_active_memslots().
> In order to avoid confusion, fix the comments that refer the non-existent name of
> install_new_memslots which always be ignored.
> 
> Fixes: a54d806688fe ("KVM: Keep memslots in tree-based structures instead of array-based ones")
> Signed-off-by: Jun Miao <jun.miao@...el.com>

Two nits, but I'll fix them up when applying.  Thanks!

> ---
>  Documentation/virt/kvm/locking.rst |  2 +-
>  include/linux/kvm_host.h           |  4 ++--
>  virt/kvm/kvm_main.c                | 10 +++++-----
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/virt/kvm/locking.rst b/Documentation/virt/kvm/locking.rst
> index 14c4e9fa501d..6e03ad853c27 100644
> --- a/Documentation/virt/kvm/locking.rst
> +++ b/Documentation/virt/kvm/locking.rst
> @@ -21,7 +21,7 @@ The acquisition orders for mutexes are as follows:
>  - kvm->mn_active_invalidate_count ensures that pairs of
>    invalidate_range_start() and invalidate_range_end() callbacks
>    use the same memslots array.  kvm->slots_lock and kvm->slots_arch_lock
> -  are taken on the waiting side in install_new_memslots, so MMU notifiers
> +  are taken on the waiting side in kvm_swap_active_memslots(), so MMU notifiers

This isn't accurate, kvm_swap_active_memslots() isn't what actually acquires
those locks.  I don't see any reason to be super precise, the key takeaway is
that modifying memslots takes the locks _and_ is the waiter.  I'll tweak this to:

  are taken on the waiting side when modifying memslots, so MMU notifiers

> @@ -1810,11 +1810,11 @@ static int kvm_set_memslot(struct kvm *kvm,
>  	int r;
>  
>  	/*
> -	 * Released in kvm_swap_active_memslots.
> +	 * Released in kvm_swap_active_memslots().
>  	 *
>  	 * Must be held from before the current memslots are copied until
>  	 * after the new memslots are installed with rcu_assign_pointer,
> -	 * then released before the synchronize srcu in kvm_swap_active_memslots.
> +	 * then released before the synchronize srcu in kvm_swap_active_memslots().

This block can be massaged slightly to avoid running past 80 chars:

	 * Must be held from before the current memslots are copied until after
	 * the new memslots are installed with rcu_assign_pointer, then
	 * released before the synchronize srcu in kvm_swap_active_memslots().

>  	 *
>  	 * When modifying memslots outside of the slots_lock, must be held
>  	 * before reading the pointer to the current memslots until after all
> -- 
> 2.32.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ