projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
727ae37
)
KVM: x86/mmu: Replace comment with an actual lockdep assertion on mmu_lock
author
Sean Christopherson
<seanjc@google.com>
Thu, 2 Feb 2023 18:27:50 +0000
(18:27 +0000)
committer
Sean Christopherson
<seanjc@google.com>
Fri, 17 Mar 2023 23:02:07 +0000
(16:02 -0700)
Assert that mmu_lock is held for write in __walk_slot_rmaps() instead of
hoping the function comment will magically prevent introducing bugs.
Signed-off-by: Ben Gardon <bgardon@google.com>
Link:
https://lore.kernel.org/r/20230202182809.1929122-3-bgardon@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c
patch
|
blob
|
history
diff --git
a/arch/x86/kvm/mmu/mmu.c
b/arch/x86/kvm/mmu/mmu.c
index 88aba0d8e9e420b3c882e404e8ce24c1a36b7267..bda2814dd158e7feb6a7fc220cf0d2daa6056a0b 100644
(file)
--- a/
arch/x86/kvm/mmu/mmu.c
+++ b/
arch/x86/kvm/mmu/mmu.c
@@
-5906,7
+5906,6
@@
typedef bool (*slot_rmaps_handler) (struct kvm *kvm,
struct kvm_rmap_head *rmap_head,
const struct kvm_memory_slot *slot);
-/* The caller should hold mmu-lock before calling this function. */
static __always_inline bool __walk_slot_rmaps(struct kvm *kvm,
const struct kvm_memory_slot *slot,
slot_rmaps_handler fn,
@@
-5916,6
+5915,8
@@
static __always_inline bool __walk_slot_rmaps(struct kvm *kvm,
{
struct slot_rmap_walk_iterator iterator;
+ lockdep_assert_held_write(&kvm->mmu_lock);
+
for_each_slot_rmap_range(slot, start_level, end_level, start_gfn,
end_gfn, &iterator) {
if (iterator.rmap)