[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7b8799d1-a4b2-58dc-187a-19c772612351@loongson.cn>
Date: Tue, 23 Dec 2025 11:16:49 +0800
From: Bibo Mao <maobibo@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: Xianglai Li <lixianglai@...ngson.cn>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org, stable@...r.kernel.org,
WANG Xuerui <kernel@...0n.name>, Tianrui Zhao <zhaotianrui@...ngson.cn>,
Charlie Jenkins <charlie@...osinc.com>, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH V2 2/2] LoongArch: KVM: fix "unreliable stack" issue
On 2025/12/23 上午10:46, Huacai Chen wrote:
> On Tue, Dec 23, 2025 at 9:27 AM Bibo Mao <maobibo@...ngson.cn> wrote:
>>
>>
>>
>> On 2025/12/22 下午7:34, Xianglai Li wrote:
>>> Insert the appropriate UNWIND macro definition into the kvm_exc_entry in
>>> the assembly function to guide the generation of correct ORC table entries,
>>> thereby solving the timeout problem of loading the livepatch-sample module
>>> on a physical machine running multiple vcpus virtual machines.
>>>
>>> While solving the above problems, we have gained an additional benefit,
>>> that is, we can obtain more call stack information
>>>
>>> Stack information that can be obtained before the problem is fixed:
>>> [<0>] kvm_vcpu_block+0x88/0x120 [kvm]
>>> [<0>] kvm_vcpu_halt+0x68/0x580 [kvm]
>>> [<0>] kvm_emu_idle+0xd4/0xf0 [kvm]
>>> [<0>] kvm_handle_gspr+0x7c/0x700 [kvm]
>>> [<0>] kvm_handle_exit+0x160/0x270 [kvm]
>>> [<0>] kvm_exc_entry+0x100/0x1e0
>>>
>>> Stack information that can be obtained after the problem is fixed:
>>> [<0>] kvm_vcpu_block+0x88/0x120 [kvm]
>>> [<0>] kvm_vcpu_halt+0x68/0x580 [kvm]
>>> [<0>] kvm_emu_idle+0xd4/0xf0 [kvm]
>>> [<0>] kvm_handle_gspr+0x7c/0x700 [kvm]
>>> [<0>] kvm_handle_exit+0x160/0x270 [kvm]
>>> [<0>] kvm_exc_entry+0x100/0x1e0
>>> [<0>] kvm_arch_vcpu_ioctl_run+0x260/0x488 [kvm]
>>> [<0>] kvm_vcpu_ioctl+0x200/0xcd8 [kvm]
>>> [<0>] sys_ioctl+0x498/0xf00
>>> [<0>] do_syscall+0x94/0x190
>>> [<0>] handle_syscall+0xb8/0x158
>>>
>>> Cc: stable@...r.kernel.org
>>> Signed-off-by: Xianglai Li <lixianglai@...ngson.cn>
>>> ---
>>> Cc: Huacai Chen <chenhuacai@...nel.org>
>>> Cc: WANG Xuerui <kernel@...0n.name>
>>> Cc: Tianrui Zhao <zhaotianrui@...ngson.cn>
>>> Cc: Bibo Mao <maobibo@...ngson.cn>
>>> Cc: Charlie Jenkins <charlie@...osinc.com>
>>> Cc: Xianglai Li <lixianglai@...ngson.cn>
>>> Cc: Thomas Gleixner <tglx@...utronix.de>
>>>
>>> arch/loongarch/kvm/switch.S | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/arch/loongarch/kvm/switch.S b/arch/loongarch/kvm/switch.S
>>> index 93845ce53651..e3ecb24a3bc5 100644
>>> --- a/arch/loongarch/kvm/switch.S
>>> +++ b/arch/loongarch/kvm/switch.S
>>> @@ -170,6 +170,7 @@ SYM_CODE_START(kvm_exc_entry)
>>> /* restore per cpu register */
>>> ld.d u0, a2, KVM_ARCH_HPERCPU
>>> addi.d sp, sp, -PT_SIZE
>>> + UNWIND_HINT_REGS
>>>
>>> /* Prepare handle exception */
>>> or a0, s0, zero
>>> @@ -214,6 +215,7 @@ SYM_FUNC_START(kvm_enter_guest)
>>> addi.d a2, sp, -PT_SIZE
>>> /* Save host GPRs */
>>> kvm_save_host_gpr a2
>>> + st.d ra, a2, PT_ERA
>> Had better add some comments here to show that it is special for unwind
>> usage since there is "st.d ra, a2, PT_R1" already in macro
>> kvm_save_host_gpr().
> Then there is a new problem, why can unwinder not recognize the
> instruction in kvm_save_host_gpr()?
maybe it need unwinder owner to answer this question.
>
> Huacai
>>
>> Regards
>> Bibo Mao
>>>
>>> addi.d a2, a1, KVM_VCPU_ARCH
>>> st.d sp, a2, KVM_ARCH_HSP
>>>
>>
Powered by blists - more mailing lists