On Fri, Aug 04, 2023 at 06:19:54PM -0500, Josh Poimboeuf wrote: > Looks mostly right, except this now creates an unnecessary gap in > unwinding coverage for the ORC unwinder. So it's better to put the > FP-specific changes behind CONFIG_FRAME_POINTER: Fair enough. > diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile > index 80e3fe184d17..0c5c2f090e93 100644 > --- a/arch/x86/kvm/Makefile > +++ b/arch/x86/kvm/Makefile > @@ -3,10 +3,6 @@ > ccflags-y += -I $(srctree)/arch/x86/kvm > ccflags-$(CONFIG_KVM_WERROR) += -Werror > > -ifeq ($(CONFIG_FRAME_POINTER),y) > -OBJECT_FILES_NON_STANDARD_vmenter.o := y > -endif > - > include $(srctree)/virt/kvm/Makefile.kvm > > kvm-y += x86.o emulate.o i8259.o irq.o lapic.o \ > diff --git a/arch/x86/kvm/svm/vmenter.S b/arch/x86/kvm/svm/vmenter.S > index 8e8295e774f0..51f6851b1ae5 100644 > --- a/arch/x86/kvm/svm/vmenter.S > +++ b/arch/x86/kvm/svm/vmenter.S > @@ -99,6 +99,9 @@ > */ > SYM_FUNC_START(__svm_vcpu_run) > push %_ASM_BP > +#ifdef CONFIG_FRAME_POINTER > + mov %_ASM_SP, %_ASM_BP > +#endif > #ifdef CONFIG_X86_64 > push %r15 > push %r14 > @@ -121,7 +124,20 @@ SYM_FUNC_START(__svm_vcpu_run) > /* Needed to restore access to percpu variables. */ > __ASM_SIZE(push) PER_CPU_VAR(svm_data + SD_save_area_pa) > > - /* Finally save @svm. */ > + /* > + * Finally save frame pointer and @svm. > + * > + * Clobbering BP here is mostly ok since GIF will block NMIs and with > + * the exception of #MC and the kvm_rebooting _ASM_EXTABLE()s below > + * nothing untoward will happen until BP is restored. > + * > + * The kvm_rebooting exceptions should not want to unwind stack, and > + * while #MV might want to unwind stack, it is ultimately fatal. > + */ Aside from me not being able to type #MC, I did realize that the kvm_reboot exception will go outside noinstr code and can hit tracing/instrumentation and do unwinds from there.