Re: [PATCH v1] LoongArch: Handle special PC in unwind_next_frame()
From: Bibo Mao
Date: Wed Nov 26 2025 - 20:55:36 EST
On 2025/11/27 上午9:39, Tiezhu Yang wrote:
On 2025/11/26 下午5:56, Bibo Mao wrote:If so, I can think LoongArch unwind method is nasty. If this method is special for KVM module. KVM prefer to compile the exception function with built-in method, rather than using this nasty method.
...
On 2025/11/26 下午5:09, Tiezhu Yang wrote:
Cc: Bibo Mao <maobibo@xxxxxxxxxxx>
+#if IS_ENABLED(CONFIG_KVM)this method mixes kvm and unwind components and it is obvious hack method. If there are other modules which have the similar problem, how to handle it? Add get_MODULE_1_entry_info/get_MODULE_2_entry_info API :)
+void (*get_kvm_entry_info)(unsigned long *old, unsigned long *new, unsigned long *size);
+EXPORT_SYMBOL_GPL(get_kvm_entry_info);
+#endif
Currently, there is no other similar issue and something that should not
happen in the future, this is "concrete question concrete analysis" and
"handle special cases with special methods".
Just be curious, it is the same orc unwind method. why is clean with file arch/x86/kernel/unwind_orc.c, however there is special handling bt_address() in file arch/loongarch/kernel/unwind_orc.c ?
KVM module copy exception function to allocated memory, it breaks unwind rules. KVM can compile exception function in kernel and do not copy the exception functions or LoongArch kernel provides unwind hint APIs to handle it.
That is better if it is possible for KVM, no general API for kernel IMO.
...static inline unsigned long bt_address(unsigned long ra)
+ get_kvm_entry_info = kvm_entry_info;Is this API get_kvm_entry_info() general for all modules or kernel components?
No, it is just to get the necessary exception info for this special KVM
case, we can use something like EXPORT_SYMBOL_FOR_KVM_INTERNAL to avoid
the potential misuse if possible (not tested yet).
Thanks,
Tiezhu