On Tue, 2024-02-06 at 20:03 -0800, Sean Christopherson wrote:
+s390 folks (question on kvm_is_error_gpa() for ya)
On Mon, Jan 15, 2024, Paul Durrant wrote:
@@ -1398,7 +1414,9 @@ void kvm_gpc_deactivate(struct gfn_to_pfn_cache *gpc); static inline void kvm_gpc_mark_dirty(struct gfn_to_pfn_cache *gpc) { lockdep_assert_held(&gpc->lock); - mark_page_dirty_in_slot(gpc->kvm, gpc->memslot, gpc->gpa >> PAGE_SHIFT);
+ if (gpc->gpa != KVM_XEN_INVALID_GPA)
KVM_XEN_INVALID_GPA absolutely doesn't belong in common code. Not to mention that it will break when Paolo (rightly) moves it to an x86 header.
https://lore.kernel.org/all/20240131233056.10845-3-pbonzini@redhat.com
We can use plain INVALID_GPA for that, I think. ISTR the reason we have a separate KVM_XEN_INVALID_GPA is because that's a userspace API.
...
But! kvm_is_error_gpa() already exists, and it very, very sneakily does a memslot lookup and checks for a valid HVA.
Hm, that doesn't sound as fast as simple comparison. We also can't do it from kvm_gpc_check(), can we?