Thread (207 messages) 207 messages, 13 authors, 4d ago

Re: [PATCH v8 08/46] KVM: Provide generic interface for checking memory private/shared status

From: sashiko-bot@kernel.org
Date: 2026-06-19 00:51:16

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incomplete API renaming leaves `kvm_mem_range_is_private` checking VM attributes instead of using the generic runtime implementation.
--

commit 0ddb6a37467eac449d5a6333904fa11b3d52cad0
Author: Sean Christopherson [off-list ref]

KVM: Provide generic interface for checking memory private/shared status

Introduce a generic kvm_mem_is_private() interface using a static call to
determine if a GFN is private, allowing the implementation to be set at
runtime. The existing VM-attribute-based check is renamed to
kvm_vm_mem_is_private.
quoted hunk ↗ jump to hunk
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index eb26d4ea8945a..3915da2a61778 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
[ ... ]
quoted hunk ↗ jump to hunk
@@ -2546,7 +2546,7 @@ bool kvm_arch_pre_set_memory_attributes(struct kvm *kvm,
 bool kvm_arch_post_set_memory_attributes(struct kvm *kvm,
 					 struct kvm_gfn_range *range);
 
-static inline bool kvm_mem_is_private(struct kvm *kvm, gfn_t gfn)
+static inline bool kvm_vm_mem_is_private(struct kvm *kvm, gfn_t gfn)
 {
 	return kvm_get_vm_memory_attributes(kvm, gfn) & KVM_MEMORY_ATTRIBUTE_PRIVATE;
 }
@@ -2557,6 +2557,16 @@ static inline bool kvm_mem_range_is_private(struct kvm *kvm, gfn_t start,
 						  KVM_MEMORY_ATTRIBUTE_PRIVATE,
 						  KVM_MEMORY_ATTRIBUTE_PRIVATE);
 }
[Severity: Low]
Should kvm_mem_range_is_private() also be renamed to
kvm_vm_mem_range_is_private() for consistency?

Since kvm_mem_is_private() was renamed to explicitly reflect its dependence
on VM memory attributes, leaving this helper with a generic name might
mislead future callers.

If a future caller attempts to use kvm_mem_range_is_private(), it would
bypass the new generic runtime mechanism entirely and incorrectly test VM
attributes instead of using the runtime-dispatched implementation.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260618-gmem-inplace-conversion-v8-0-9d2959357853@google.com?part=8
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help