[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e7a0cc72-388a-7fa4-601f-371aea369204@amd.com>
Date: Thu, 1 May 2025 08:29:59 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Ashish Kalra <Ashish.Kalra@....com>, tglx@...utronix.de,
mingo@...hat.com, dave.hansen@...ux.intel.com, x86@...nel.org, bp@...en8.de,
hpa@...or.com
Cc: kees@...nel.org, michael.roth@....com, nikunj@....com, seanjc@...gle.com,
ardb@...nel.org, gustavoars@...nel.org, sgarzare@...hat.com,
stable@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, kexec@...ts.infradead.org,
linux-coco@...ts.linux.dev
Subject: Re: [PATCH v4] x86/sev: Don't touch VMSA pages during kdump of SNP
guest memory
On 4/30/25 16:57, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra@....com>
>
> When kdump is running makedumpfile to generate vmcore and dumping SNP
> guest memory it touches the VMSA page of the vCPU executing kdump which
> then results in unrecoverable #NPF/RMP faults as the VMSA page is
> marked busy/in-use when the vCPU is running and subsequently causes
> guest softlockup/hang.
>
> Additionally other APs may be halted in guest mode and their VMSA pages
> are marked busy and touching these VMSA pages during guest memory dump
> will also cause #NPF.
>
> Issue AP_DESTROY GHCB calls on other APs to ensure they are kicked out
> of guest mode and then clear the VMSA bit on their VMSA pages.
>
> If the vCPU running kdump is an AP, mark it's VMSA page as offline to
> ensure that makedumpfile excludes that page while dumping guest memory.
>
> Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
> Reviewed-by: Pankaj Gupta <pankaj.gupta@....com>
> Cc: stable@...r.kernel.org
> Fixes: 3074152e56c9 ("x86/sev: Convert shared memory back to private on kexec")
> Signed-off-by: Ashish Kalra <ashish.kalra@....com>
> ---
> arch/x86/coco/sev/core.c | 244 +++++++++++++++++++++++++--------------
> 1 file changed, 158 insertions(+), 86 deletions(-)
>
> diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
> index dcfaa698d6cf..d35fec7b164a 100644
> --- a/arch/x86/coco/sev/core.c
> +++ b/arch/x86/coco/sev/core.c
> @@ -877,6 +877,102 @@ void snp_accept_memory(phys_addr_t start, phys_addr_t end)
> set_pages_state(vaddr, npages, SNP_PAGE_STATE_PRIVATE);
> }
>
> +static int vmgexit_ap_control(u64 event, struct sev_es_save_area *vmsa, u32 apic_id)
> +{
> + bool create = event == SVM_VMGEXIT_AP_CREATE;
Just occurred to me that, while we don't use it, there is another create
event, SVM_VMGEXIT_AP_CREATE_ON_INIT. So maybe change this to
bool create = event != SVM_VMGEXIT_AP_DESTROY;
Thanks,
Tom
Powered by blists - more mailing lists