Re: [PATCH] kvm: add proper frame pointer logic for vmx
From: Qian Cai
Date: Tue Jan 15 2019 - 13:29:28 EST
On 1/15/19 12:49 PM, Sean Christopherson wrote:
> On Tue, Jan 15, 2019 at 09:48:45AM -0800, Sean Christopherson wrote:
>> On Tue, Jan 15, 2019 at 11:43:20AM -0500, Qian Cai wrote:
>>>
>>>
>>> On 1/15/19 2:13 AM, Paolo Bonzini wrote:
>>>> Hmm, maybe like this:
>>>>
>>>> diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S
>>>> index bcef2c7e9bc4..33122fa9d4bd 100644
>>>> --- a/arch/x86/kvm/vmx/vmenter.S
>>>> +++ b/arch/x86/kvm/vmx/vmenter.S
>>>> @@ -26,19 +26,17 @@ ENTRY(vmx_vmenter)
>>>> ret
>>>>
>>>> 2: vmlaunch
>>>> +3:
>>>> ret
>>>>
>>>> -3: cmpb $0, kvm_rebooting
>>>> - jne 4f
>>>> - call kvm_spurious_fault
>>>> -4: ret
>>>> -
>>>> .pushsection .fixup, "ax"
>>>> -5: jmp 3b
>>>> +4: cmpb $0, kvm_rebooting
>>>> + jne 3b
>>>> + jmp kvm_spurious_fault
>>>> .popsection
>>>>
>>>> - _ASM_EXTABLE(1b, 5b)
>>>> - _ASM_EXTABLE(2b, 5b)
>>>> + _ASM_EXTABLE(1b, 4b)
>>>> + _ASM_EXTABLE(2b, 4b)
>>>>
>>>> ENDPROC(vmx_vmenter)
>>>
>>> No, that will not work. The problem is in vmx.o where I just sent another patch
>>> for it.
>>>
>>> I can see there are five options to solve it.
>>>
>>> 1) always inline vmx_vcpu_run()
>>> 2) always noinline vmx_vcpu_run()
>>> 3) add -fdiable-ipa-fnsplit option to Makefile for vmx.o
>>> 4) let STACK_FRAME_NON_STANDARD support part.* syntax.
>>
>> What is ".part." and where does it come from? Searching for information
>> is futile, the term is too generic.
>
> And never mind, my eyes glazed over -fdiable-ipa-fnsplit.
For example, this works too,
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index 69b3a7c30013..990dfc254e71 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -4,7 +4,7 @@ ccflags-y += -Iarch/x86/kvm
CFLAGS_x86.o := -I.
CFLAGS_svm.o := -I.
-CFLAGS_vmx.o := -I.
+CFLAGS_vmx.o := -I. -fdisable-tree-fnsplit
KVM := ../../../virt/kvm