Skip to content

Commit b0d2370

Browse files
jmiao2018sean-jc
authored andcommitted
KVM: Fix comments that refer to the non-existent install_new_memslots()
Fix stale comments that were left behind when install_new_memslots() was replaced by kvm_swap_active_memslots() as part of the scalable memslots rework. Fixes: a54d806 ("KVM: Keep memslots in tree-based structures instead of array-based ones") Signed-off-by: Jun Miao <jun.miao@intel.com> Link: https://lore.kernel.org/r/20230223052851.1054799-1-jun.miao@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 7ffc2e8 commit b0d2370

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Documentation/virt/kvm/locking.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The acquisition orders for mutexes are as follows:
2121
- kvm->mn_active_invalidate_count ensures that pairs of
2222
invalidate_range_start() and invalidate_range_end() callbacks
2323
use the same memslots array. kvm->slots_lock and kvm->slots_arch_lock
24-
are taken on the waiting side in install_new_memslots, so MMU notifiers
24+
are taken on the waiting side when modifying memslots, so MMU notifiers
2525
must not take either kvm->slots_lock or kvm->slots_arch_lock.
2626

2727
For SRCU:

include/linux/kvm_host.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
/*
6060
* Bit 63 of the memslot generation number is an "update in-progress flag",
61-
* e.g. is temporarily set for the duration of install_new_memslots().
61+
* e.g. is temporarily set for the duration of kvm_swap_active_memslots().
6262
* This flag effectively creates a unique generation number that is used to
6363
* mark cached memslot data, e.g. MMIO accesses, as potentially being stale,
6464
* i.e. may (or may not) have come from the previous memslots generation.
@@ -713,7 +713,7 @@ struct kvm {
713713
* use by the VM. To be used under the slots_lock (above) or in a
714714
* kvm->srcu critical section where acquiring the slots_lock would
715715
* lead to deadlock with the synchronize_srcu in
716-
* install_new_memslots.
716+
* kvm_swap_active_memslots().
717717
*/
718718
struct mutex slots_arch_lock;
719719
struct mm_struct *mm; /* userspace tied to this vm */

virt/kvm/kvm_main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ static void kvm_destroy_vm(struct kvm *kvm)
12981298
* At this point, pending calls to invalidate_range_start()
12991299
* have completed but no more MMU notifiers will run, so
13001300
* mn_active_invalidate_count may remain unbalanced.
1301-
* No threads can be waiting in install_new_memslots as the
1301+
* No threads can be waiting in kvm_swap_active_memslots() as the
13021302
* last reference on KVM has been dropped, but freeing
13031303
* memslots would deadlock without this manual intervention.
13041304
*/
@@ -1742,13 +1742,13 @@ static void kvm_invalidate_memslot(struct kvm *kvm,
17421742
kvm_arch_flush_shadow_memslot(kvm, old);
17431743
kvm_arch_guest_memory_reclaimed(kvm);
17441744

1745-
/* Was released by kvm_swap_active_memslots, reacquire. */
1745+
/* Was released by kvm_swap_active_memslots(), reacquire. */
17461746
mutex_lock(&kvm->slots_arch_lock);
17471747

17481748
/*
17491749
* Copy the arch-specific field of the newly-installed slot back to the
17501750
* old slot as the arch data could have changed between releasing
1751-
* slots_arch_lock in install_new_memslots() and re-acquiring the lock
1751+
* slots_arch_lock in kvm_swap_active_memslots() and re-acquiring the lock
17521752
* above. Writers are required to retrieve memslots *after* acquiring
17531753
* slots_arch_lock, thus the active slot's data is guaranteed to be fresh.
17541754
*/
@@ -1810,11 +1810,11 @@ static int kvm_set_memslot(struct kvm *kvm,
18101810
int r;
18111811

18121812
/*
1813-
* Released in kvm_swap_active_memslots.
1813+
* Released in kvm_swap_active_memslots().
18141814
*
1815-
* Must be held from before the current memslots are copied until
1816-
* after the new memslots are installed with rcu_assign_pointer,
1817-
* then released before the synchronize srcu in kvm_swap_active_memslots.
1815+
* Must be held from before the current memslots are copied until after
1816+
* the new memslots are installed with rcu_assign_pointer, then
1817+
* released before the synchronize srcu in kvm_swap_active_memslots().
18181818
*
18191819
* When modifying memslots outside of the slots_lock, must be held
18201820
* before reading the pointer to the current memslots until after all

0 commit comments

Comments
 (0)