* FAILED: Patch "LoongArch: Handle percpu handler address for ORC unwinder" failed to apply to 6.6-stable tree
@ 2026-03-01 1:37 Sasha Levin
2026-03-01 6:44 ` Huacai Chen
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-03-01 1:37 UTC (permalink / raw)
To: stable, yangtiezhu; +Cc: Huacai Chen, loongarch, linux-rt-devel
The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 055c7e75190e0be43037bd663a3f6aced194416e Mon Sep 17 00:00:00 2001
From: Tiezhu Yang <yangtiezhu@loongson.cn>
Date: Tue, 10 Feb 2026 19:31:13 +0800
Subject: [PATCH] LoongArch: Handle percpu handler address for ORC unwinder
After commit 4cd641a79e69 ("LoongArch: Remove unnecessary checks for ORC
unwinder"), the system can not boot normally under some configs (such as
enable KASAN), there are many error messages "cannot find unwind pc".
The kernel boots normally with the defconfig, so no problem found out at
the first time. Here is one way to reproduce:
cd linux
make mrproper defconfig -j"$(nproc)"
scripts/config -e KASAN
make olddefconfig all -j"$(nproc)"
sudo make modules_install
sudo make install
sudo reboot
The address that can not unwind is not a valid kernel address which is
between "pcpu_handlers[cpu]" and "pcpu_handlers[cpu] + vec_sz" due to
the code of eentry was copied to the new area of pcpu_handlers[cpu] in
setup_tlb_handler(), handle this special case to get the valid address
to unwind normally.
Cc: stable@vger.kernel.org
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
arch/loongarch/include/asm/setup.h | 3 +++
arch/loongarch/kernel/unwind_orc.c | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/arch/loongarch/include/asm/setup.h b/arch/loongarch/include/asm/setup.h
index 3c2fb16b11b64..f81375e5e89c0 100644
--- a/arch/loongarch/include/asm/setup.h
+++ b/arch/loongarch/include/asm/setup.h
@@ -7,6 +7,7 @@
#define _LOONGARCH_SETUP_H
#include <linux/types.h>
+#include <linux/threads.h>
#include <asm/sections.h>
#include <uapi/asm/setup.h>
@@ -14,6 +15,8 @@
extern unsigned long eentry;
extern unsigned long tlbrentry;
+extern unsigned long pcpu_handlers[NR_CPUS];
+extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
extern char init_command_line[COMMAND_LINE_SIZE];
extern void tlb_init(int cpu);
extern void cpu_cache_init(void);
diff --git a/arch/loongarch/kernel/unwind_orc.c b/arch/loongarch/kernel/unwind_orc.c
index d6b3688a1ce97..11ba3e4ac9eee 100644
--- a/arch/loongarch/kernel/unwind_orc.c
+++ b/arch/loongarch/kernel/unwind_orc.c
@@ -352,6 +352,22 @@ static inline unsigned long bt_address(unsigned long ra)
{
extern unsigned long eentry;
+#if defined(CONFIG_NUMA) && !defined(CONFIG_PREEMPT_RT)
+ int cpu;
+ int vec_sz = sizeof(exception_handlers);
+
+ for_each_possible_cpu(cpu) {
+ if (!pcpu_handlers[cpu])
+ continue;
+
+ if (ra >= pcpu_handlers[cpu] &&
+ ra < pcpu_handlers[cpu] + vec_sz) {
+ ra = ra + eentry - pcpu_handlers[cpu];
+ break;
+ }
+ }
+#endif
+
if (ra >= eentry && ra < eentry + EXCCODE_INT_END * VECSIZE) {
unsigned long func;
unsigned long type = (ra - eentry) / VECSIZE;
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: FAILED: Patch "LoongArch: Handle percpu handler address for ORC unwinder" failed to apply to 6.6-stable tree
2026-03-01 1:37 FAILED: Patch "LoongArch: Handle percpu handler address for ORC unwinder" failed to apply to 6.6-stable tree Sasha Levin
@ 2026-03-01 6:44 ` Huacai Chen
0 siblings, 0 replies; 2+ messages in thread
From: Huacai Chen @ 2026-03-01 6:44 UTC (permalink / raw)
To: Sasha Levin; +Cc: stable, yangtiezhu, Huacai Chen, loongarch, linux-rt-devel
Hi, Sasha,
On Sun, Mar 1, 2026 at 9:37 AM Sasha Levin <sashal@kernel.org> wrote:
>
> The patch below does not apply to the 6.6-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
Please do the same thing here:
https://lore.kernel.org/loongarch/CAAhV-H46pdrJgJ0tg493nK8S8X6NQrXu+jHO-yDpBBdyDpRQKw@mail.gmail.com/T/#t
Huacai
>
> Thanks,
> Sasha
>
> ------------------ original commit in Linus's tree ------------------
>
> From 055c7e75190e0be43037bd663a3f6aced194416e Mon Sep 17 00:00:00 2001
> From: Tiezhu Yang <yangtiezhu@loongson.cn>
> Date: Tue, 10 Feb 2026 19:31:13 +0800
> Subject: [PATCH] LoongArch: Handle percpu handler address for ORC unwinder
>
> After commit 4cd641a79e69 ("LoongArch: Remove unnecessary checks for ORC
> unwinder"), the system can not boot normally under some configs (such as
> enable KASAN), there are many error messages "cannot find unwind pc".
>
> The kernel boots normally with the defconfig, so no problem found out at
> the first time. Here is one way to reproduce:
>
> cd linux
> make mrproper defconfig -j"$(nproc)"
> scripts/config -e KASAN
> make olddefconfig all -j"$(nproc)"
> sudo make modules_install
> sudo make install
> sudo reboot
>
> The address that can not unwind is not a valid kernel address which is
> between "pcpu_handlers[cpu]" and "pcpu_handlers[cpu] + vec_sz" due to
> the code of eentry was copied to the new area of pcpu_handlers[cpu] in
> setup_tlb_handler(), handle this special case to get the valid address
> to unwind normally.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> arch/loongarch/include/asm/setup.h | 3 +++
> arch/loongarch/kernel/unwind_orc.c | 16 ++++++++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/arch/loongarch/include/asm/setup.h b/arch/loongarch/include/asm/setup.h
> index 3c2fb16b11b64..f81375e5e89c0 100644
> --- a/arch/loongarch/include/asm/setup.h
> +++ b/arch/loongarch/include/asm/setup.h
> @@ -7,6 +7,7 @@
> #define _LOONGARCH_SETUP_H
>
> #include <linux/types.h>
> +#include <linux/threads.h>
> #include <asm/sections.h>
> #include <uapi/asm/setup.h>
>
> @@ -14,6 +15,8 @@
>
> extern unsigned long eentry;
> extern unsigned long tlbrentry;
> +extern unsigned long pcpu_handlers[NR_CPUS];
> +extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
> extern char init_command_line[COMMAND_LINE_SIZE];
> extern void tlb_init(int cpu);
> extern void cpu_cache_init(void);
> diff --git a/arch/loongarch/kernel/unwind_orc.c b/arch/loongarch/kernel/unwind_orc.c
> index d6b3688a1ce97..11ba3e4ac9eee 100644
> --- a/arch/loongarch/kernel/unwind_orc.c
> +++ b/arch/loongarch/kernel/unwind_orc.c
> @@ -352,6 +352,22 @@ static inline unsigned long bt_address(unsigned long ra)
> {
> extern unsigned long eentry;
>
> +#if defined(CONFIG_NUMA) && !defined(CONFIG_PREEMPT_RT)
> + int cpu;
> + int vec_sz = sizeof(exception_handlers);
> +
> + for_each_possible_cpu(cpu) {
> + if (!pcpu_handlers[cpu])
> + continue;
> +
> + if (ra >= pcpu_handlers[cpu] &&
> + ra < pcpu_handlers[cpu] + vec_sz) {
> + ra = ra + eentry - pcpu_handlers[cpu];
> + break;
> + }
> + }
> +#endif
> +
> if (ra >= eentry && ra < eentry + EXCCODE_INT_END * VECSIZE) {
> unsigned long func;
> unsigned long type = (ra - eentry) / VECSIZE;
> --
> 2.51.0
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-01 6:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01 1:37 FAILED: Patch "LoongArch: Handle percpu handler address for ORC unwinder" failed to apply to 6.6-stable tree Sasha Levin
2026-03-01 6:44 ` Huacai Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox