summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin/stackcollapse-report
diff options
context:
space:
mode:
authorAshish Kalra <ashish.kalra@amd.com>2026-09-16 22:15:37 +0000
committerBorislav Petkov (AMD) <bp@alien8.de>2026-09-18 16:58:20 -0700
commitedb1b49e724ea102b3eaeb0b57f8ca33cd445887 (patch)
tree6a394ce770cdcf6202c7b51fb7fa53acfe2f64ce /tools/perf/scripts/python/bin/stackcollapse-report
parentc6c6f156d192bf905eb6e46d8ad6229fa9bbe036 (diff)
x86/sev: Do RMP optimizations on SNP guest shutdown
The RMPOPT table is a per-CPU table which indicates whether 1GB regions of physical memory are entirely hypervisor-owned. When performing host memory accesses in hypervisor mode as well as non-SNP guest mode, the processor may consult the RMPOPT table to potentially skip an RMP access and improve performance. Normal guest events disable RMP optimizations: pages are converted from shared to private as SNP guests are launched, and large pages are split and collapsed during guest operation -- both disable the RMPOPT optimizations for the affected 1GB regions. When guests are torn down, their pages are converted back to shared, so those regions may become eligible for RMP optimizations again. Without some intervention, all those optimizations would eventually be lost, so optimize all of physical memory on SNP guest teardown. snp_enable_rmpopt() performs the re-optimization after a delay, which gets reset on each call. This way multiple guest terminations are batched into a single pass: the re-optimization runs 10 seconds after the *last* termination rather than after the first. mod_delayed_work() also re-queues work that is already in-flight, so a re-scan request during an active scan is not silently dropped. Guest teardown is currently the only event that returns guest memory to hypervisor ownership: SNP guests do not support ballooning or memory hotplug, so pages freed during a guest's lifetime remain guest-owned. It is therefore the only point at which memory becomes eligible for RMP re-optimization, which is why re-optimization is driven by guest teardown rather than by a periodic scan. [ bp: Massage commit message. ] Signed-off-by: Ashish Kalra <ashish.kalra@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Ackerley Tng <ackerleytng@google.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://patch.msgid.link/7a15a880ea6b6d53b3702def3b3434307656afd7.1789594774.git.ashish.kalra@amd.com
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions