Re: [PATCH v3 5/6] KVM: SEV: Perform RMP optimizations on SNP guest shutdown
From: Dave Hansen
Date: Mon Mar 30 2026 - 19:47:41 EST
On 3/30/26 15:27, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@xxxxxxx>
>
> As SNP guests are launched, pages converted to private cause RMPUPDATE
> to disable the corresponding RMPOPT optimizations.
>
> Conversely, during SNP guest termination, when guest pages are
> converted back to shared and are not assigned, RMPOPT will be used
> to re-enable RMP optimizations.
This is all super passive. It makes it impossible to tell what is
background versus imperative voice on what the patch is doing.
== Background / Problem ==
Pages are converted from shared to private as SNP guests are
launched. This destroys existing RMPOPT optimizations in the
regions where pages are converted.
Conversely, guest pages are converted back to shared during SNP
guest termination and their region may become eligible for
RMPOPT optimization.
== Solution ==
To take advantage of this, perform RMPOPT after guest
termination. Do it after a delay so that a single RMPOPT pass
can be done if multiple guests terminate in a short period of
time.
With a fixed changelog:
Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
I'm just saying "ack" on this one because it's a pretty KVM-specific
thing about when the guest is destroyed to the point of being good for
RMPOPT. This needs many more eyeballs from the KVM folks than me.