Skip to contentSkip to conversation

loongarch: irq: Move to generic_handle_arch_irq

PATCH Superseded [email protected] 2 participants 4 messages Aug 13, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 loongarch: irq: Move to generic_handle_arch_irq

From: Guo Ren <[email protected]>

No reason to keep custom handle_loongarch_irq, and move to the generic one. No reason to keep custom handle_loongarch_irq, and move to the generic one. The patch also the fixup HAVE_CONTEXT_TRACKING_USER feature, because handle_loongarch_irq missed ct_irq_enter/exit.

Fixes 0603839b18f4 ("LoongArch: Add exception/interrupt handling")
---
 arch/loongarch/kernel/traps.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
arch/loongarch/kernel/traps.c +2 -13
index aa1c95aaf595..06211640ba1f 100644
@@ -588,17 +588,6 @@ asmlinkage void cache_parity_error(void)
 	panic("Can't handle the cache error!");
 }
 
-asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs)
-{
-	struct pt_regs *old_regs;
-
-	irq_enter_rcu();
-	old_regs = set_irq_regs(regs);
-	handle_arch_irq(regs);
-	set_irq_regs(old_regs);
-	irq_exit_rcu();
-}
-
 asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
 {
 	register int cpu;
@@ -608,7 +597,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
 	cpu = smp_processor_id();
 
 	if (on_irq_stack(cpu, sp))
-		handle_loongarch_irq(regs);
+		generic_handle_arch_irq(regs);
 	else {
 		stack = per_cpu(irq_stack, cpu) + IRQ_STACK_START;
 
@@ -619,7 +608,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
 		"move	$s0, $sp		\n" /* Preserve sp */
 		"move	$sp, %[stk]		\n" /* Switch stack */
 		"move	$a0, %[regs]		\n"
-		"bl	handle_loongarch_irq	\n"
+		"bl	generic_handle_arch_irq	\n"
 		"move	$sp, $s0		\n" /* Restore sp */
 		: /* No outputs */
 		: [stk] "r" (stack), [regs] "r" (regs)
Signature · 1 line
2.36.1
author
#1 lore raw

Abandon this patch because of the wrong commit log. Please see "[RESEND PATCH] loongarch: irq: Move to generic_handle_arch_irq".

Quoted 58 lines · On Sat, Aug 13, 2022 at 4:58 PM <[email protected]> wrote:

From: Guo Ren <[email protected]>

No reason to keep custom handle_loongarch_irq, and move to the generic one. No reason to keep custom handle_loongarch_irq, and move to the generic one. The patch also the fixup HAVE_CONTEXT_TRACKING_USER feature, because handle_loongarch_irq missed ct_irq_enter/exit.

Fixes 0603839b18f4 ("LoongArch: Add exception/interrupt handling")
---
 arch/loongarch/kernel/traps.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
arch/loongarch/kernel/traps.c +2 -14
index aa1c95aaf595..06211640ba1f 100644
@@ -588,17 +588,6 @@ asmlinkage void cache_parity_error(void)
        panic("Can't handle the cache error!");
 }
 
-asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs)
-{
-       struct pt_regs *old_regs;
-
-       irq_enter_rcu();
-       old_regs = set_irq_regs(regs);
-       handle_arch_irq(regs);
-       set_irq_regs(old_regs);
-       irq_exit_rcu();
-}
-
 asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
 {
        register int cpu;
@@ -608,7 +597,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
        cpu = smp_processor_id();
 
        if (on_irq_stack(cpu, sp))
-               handle_loongarch_irq(regs);
+               generic_handle_arch_irq(regs);
        else {
                stack = per_cpu(irq_stack, cpu) + IRQ_STACK_START;
 
@@ -619,7 +608,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
                "move   $s0, $sp                \n" /* Preserve sp */
                "move   $sp, %[stk]             \n" /* Switch stack */
                "move   $a0, %[regs]            \n"
-               "bl     handle_loongarch_irq    \n"
+               "bl     generic_handle_arch_irq \n"
                "move   $sp, $s0                \n" /* Restore sp */
                : /* No outputs */
                : [stk] "r" (stack), [regs] "r" (regs)
--

2.36.1

Signature · 2 lines
Best Regards
 Guo Ren
maintainer
#2 lore raw

Hi, Ren,

Thank you for your patch, but it seems wrong to me.

Please see c9b12b59e2ea4c3c7cedec7efb071b6 ("s390/entry: fix duplicate tracking of irq nesting level"). ct_irq_enter() is named rcu_irq_enter() in older kernels. And irq_enter = rcu_irq_enter + irq_enter_rcu (for the latest kernel, irq_enter = ct_irq_enter + irq_enter_rcu). If we use generic entry, irqentry_enter() has already call rcu_irq_enter (or ct_irq_enter in the latest kernel), so the arch code doesn't need to call it again. This has nothing to do with HAVE_CONTEXT_TRACKING_USER, just avoid duplicated calls to ct_irq_enter.

Huacai

Quoted 69 lines · Guo Ren

Abandon this patch because of the wrong commit log. Please see "[RESEND PATCH] loongarch: irq: Move to generic_handle_arch_irq".

Quoted 56 lines · On Sat, Aug 13, 2022 at 4:58 PM <[email protected]> wrote:

From: Guo Ren <[email protected]>

No reason to keep custom handle_loongarch_irq, and move to the generic one. No reason to keep custom handle_loongarch_irq, and move to the generic one. The patch also the fixup HAVE_CONTEXT_TRACKING_USER feature, because handle_loongarch_irq missed ct_irq_enter/exit.

Fixes 0603839b18f4 ("LoongArch: Add exception/interrupt handling")
---
 arch/loongarch/kernel/traps.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
arch/loongarch/kernel/traps.c +2 -14
index aa1c95aaf595..06211640ba1f 100644
@@ -588,17 +588,6 @@ asmlinkage void cache_parity_error(void)
        panic("Can't handle the cache error!");
 }
 
-asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs)
-{
-       struct pt_regs *old_regs;
-
-       irq_enter_rcu();
-       old_regs = set_irq_regs(regs);
-       handle_arch_irq(regs);
-       set_irq_regs(old_regs);
-       irq_exit_rcu();
-}
-
 asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
 {
        register int cpu;
@@ -608,7 +597,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
        cpu = smp_processor_id();
 
        if (on_irq_stack(cpu, sp))
-               handle_loongarch_irq(regs);
+               generic_handle_arch_irq(regs);
        else {
                stack = per_cpu(irq_stack, cpu) + IRQ_STACK_START;
 
@@ -619,7 +608,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
                "move   $s0, $sp                \n" /* Preserve sp */
                "move   $sp, %[stk]             \n" /* Switch stack */
                "move   $a0, %[regs]            \n"
-               "bl     handle_loongarch_irq    \n"
+               "bl     generic_handle_arch_irq \n"
                "move   $sp, $s0                \n" /* Restore sp */
                : /* No outputs */
                : [stk] "r" (stack), [regs] "r" (regs)
--
Quoted 2 lines

2.36.1

--
Best Regards
Guo Ren

author
#3 lore raw
In reply to Guo Ren

Sorry for the noise, loongarch selects GENERIC_ENTRY, and it has called irqentry_enter(). So calling generic_handle_arch_irq would cause duplicate ct_irq_enter calling.

All abandoned, and I would have a look at generic_handle_arch_irq.

Quoted 68 lines · Guo Ren

Abandon this patch because of the wrong commit log. Please see "[RESEND PATCH] loongarch: irq: Move to generic_handle_arch_irq".

Quoted 56 lines · On Sat, Aug 13, 2022 at 4:58 PM <[email protected]> wrote:

From: Guo Ren <[email protected]>

No reason to keep custom handle_loongarch_irq, and move to the generic one. No reason to keep custom handle_loongarch_irq, and move to the generic one. The patch also the fixup HAVE_CONTEXT_TRACKING_USER feature, because handle_loongarch_irq missed ct_irq_enter/exit.

Fixes 0603839b18f4 ("LoongArch: Add exception/interrupt handling")
---
 arch/loongarch/kernel/traps.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
arch/loongarch/kernel/traps.c +2 -14
index aa1c95aaf595..06211640ba1f 100644
@@ -588,17 +588,6 @@ asmlinkage void cache_parity_error(void)
        panic("Can't handle the cache error!");
 }
 
-asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs)
-{
-       struct pt_regs *old_regs;
-
-       irq_enter_rcu();
-       old_regs = set_irq_regs(regs);
-       handle_arch_irq(regs);
-       set_irq_regs(old_regs);
-       irq_exit_rcu();
-}
-
 asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
 {
        register int cpu;
@@ -608,7 +597,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
        cpu = smp_processor_id();
 
        if (on_irq_stack(cpu, sp))
-               handle_loongarch_irq(regs);
+               generic_handle_arch_irq(regs);
        else {
                stack = per_cpu(irq_stack, cpu) + IRQ_STACK_START;
 
@@ -619,7 +608,7 @@ asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp)
                "move   $s0, $sp                \n" /* Preserve sp */
                "move   $sp, %[stk]             \n" /* Switch stack */
                "move   $a0, %[regs]            \n"
-               "bl     handle_loongarch_irq    \n"
+               "bl     generic_handle_arch_irq \n"
                "move   $sp, $s0                \n" /* Restore sp */
                : /* No outputs */
                : [stk] "r" (stack), [regs] "r" (regs)
--
Quoted 2 lines

2.36.1

--
Best Regards
Guo Ren

Signature · 2 lines
Best Regards
 Guo Ren