Re: [PATCH v9 04/15] KVM: pfncache: add a mark-dirty helper

From: Paul Durrant
Date: Wed Nov 22 2023 - 08:04:26 EST


On 22/11/2023 12:24, David Woodhouse wrote:
On Wed, 2023-11-22 at 12:18 +0000, Paul Durrant wrote:

--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1367,6 +1367,16 @@ int kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, unsigned long len);
  */
 void kvm_gpc_deactivate(struct gfn_to_pfn_cache *gpc);
+/**
+ * kvm_gpc_mark_dirty - mark a cached page as dirty.
+ *
+ * @gpc:          struct gfn_to_pfn_cache object.
+ */
+static inline void kvm_gpc_mark_dirty(struct gfn_to_pfn_cache *gpc)
+{
+       mark_page_dirty_in_slot(gpc->kvm, gpc->memslot, gpc->gpa >> PAGE_SHIFT);
+}

This doesn't rescind my existing ack, but it's probably worth asserting
that gpc->lock is held here?

Yes, a good idea. If a v10 is needed, I'll add it. Otherwise I can do it as an incremental patch.

Paul