Re: [PATCH v2 3/7] x86/sev: add support for RMPOPT instruction
From: Dave Hansen
Date: Wed Mar 18 2026 - 10:15:20 EST
Thanks for the additional performance numbers!
On 3/16/26 12:03, Kalra, Ashish wrote:
> Again, looking at the numbers above, what are your suggestions for
>
> 1). using the kthread approach OR
I don't like the kthread approach. The kernel has a billion features. If
each one gets a kthread or kthread-per-$SOMETHING, we'll spend all of
our RAM on kthread task_structs and stacks.
> 2). probably scheduling it for later execution after SNP guest termination via a workqueue OR
I think there are two different issues:
1. What asynchronous kernel mechanism is used to execute the RMPOPT?
2. How does that mechanism get triggered?
For #1, I think schedule_work() is the place to start. You need more
justification on why it needs a dedicated kthread.
For #2, I say just schedule some delayed work on every SEV-SNP
private=>shared conversion to do RMPOPT. Schedule it out 1 second or 10
seconds or _something_. If work is scheduled and you convert another
page, cancel it and push it out another 1 or 10 seconds.
> 3). use some additional data structure like a bitmap to track 1G pages in guest_memfd
> to do the RMP re-optimizations.
That's an optimization that can be added later.
Whatever you do, it's going to need trigger points and asynchronous
work. There will always be ways to get the work amount down, but the
worst case will always be there.