Re: [RFC PATCH 3/8] kvm: pfncache: enlighten about gmem

From: David Woodhouse
Date: Wed Jul 10 2024 - 06:52:07 EST


On Wed, 2024-07-10 at 11:46 +0100, Patrick Roy wrote:
> On Wed, 2024-07-10 at 11:20 +0100, David Woodhouse wrote:
> > In that case, wouldn't that mean the explicit checks on gpc->is_private
> > matching kvm_mem_is_private() would be redundant and you can remove
> > them because you can trust that gpc->valid would be cleared?
> >
>
> Right, yes, it would indeed mean that. I'll double-check my assumption
> about the whole invalidation thing and adjust the code for the next
> iteration!

I was going to suggest that you take the check you'd added to
kvm_gpc_check() and move it down below the ->valid check, and turn it
into a BUG_ON() to check that assertion.

You *might* get false positives with that though, if the result of
kvm_mem_is_private() becomes true before the flush actually *happens*?

Attachment: smime.p7s
Description: S/MIME cryptographic signature