Re: [PATCHv6 10/16] x86/tdx: Convert shared memory back to private on kexec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Kirill,

On 1/29/2024 4:36 AM, Kirill A. Shutemov wrote:
On Mon, Jan 29, 2024 at 04:24:09AM -0600, Kalra, Ashish wrote:
In case of SNP and crash/kdump case, we need to prevent the boot_ghcb being
converted to shared (in snp_kexec_unshare_mem()) as the boot_ghcb is
required to handle all I/O for disabling IO-APIC/lapic, hpet, etc., as the
enc_kexec_unshare_mem() callback is invoked before the apics, hpet, etc. are
disabled.

Is there any reason why enc_kexec_unshare_mem() callback is invoked in crash
case before the IO-APIC/lapic, hpet, etc. are shutdown/disabled ?
Not really. Either way works for TDX. I've tested the patch below. Is it
what you want?

diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 6585a5f2c2ba..3001f4857ed7 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -107,11 +107,6 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
crash_smp_send_stop(); - if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
-		x86_platform.guest.enc_kexec_stop_conversion(true);
-		x86_platform.guest.enc_kexec_unshare_mem();
-	}
-
  	cpu_emergency_disable_virtualization();
/*
@@ -129,6 +124,12 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
  #ifdef CONFIG_HPET_TIMER
  	hpet_disable();
  #endif
+
+	if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
+		x86_platform.guest.enc_kexec_stop_conversion(true);
+		x86_platform.guest.enc_kexec_unshare_mem();
+	}
+
  	crash_save_cpu(regs, safe_smp_processor_id());
  }

Yes, this will work for SNP.

Thanks, Ashish


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux