Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1534916

[PATCH 2/5] MIPS: Stack unwinding while on IRQ stack

From Matt Redfearn <matt.redfearn@imgtec.com>
Newsgroups linux.kernel
Subject [PATCH 2/5] MIPS: Stack unwinding while on IRQ stack
Date 2016-12-02 14:40 +0100
Message-ID <sJWef-4q8-77@gated-at.bofh.it> (permalink)
References <sJWee-4q8-61@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Within unwind stack, check if the stack pointer being unwound is within
the CPU's irq_stack and if so use that page rather than the task's stack
page.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---

 arch/mips/kernel/process.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 9514e5f2209f..4fdbf7078071 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -33,6 +33,7 @@
 #include <asm/dsemul.h>
 #include <asm/dsp.h>
 #include <asm/fpu.h>
+#include <asm/irq.h>
 #include <asm/msa.h>
 #include <asm/pgtable.h>
 #include <asm/mipsregs.h>
@@ -511,7 +512,19 @@ EXPORT_SYMBOL(unwind_stack_by_address);
 unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
 			   unsigned long pc, unsigned long *ra)
 {
-	unsigned long stack_page = (unsigned long)task_stack_page(task);
+	unsigned long stack_page = 0;
+	int cpu;
+
+	for_each_possible_cpu(cpu) {
+		if (on_irq_stack(cpu, *sp)) {
+			stack_page = (unsigned long)irq_stack[cpu];
+			break;
+		}
+	}
+
+	if (!stack_page)
+		stack_page = (unsigned long)task_stack_page(task);
+
 	return unwind_stack_by_address(stack_page, sp, pc, ra);
 }
 #endif
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] MIPS: Add per-cpu IRQ stack Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-02 14:40 +0100
  [PATCH 2/5] MIPS: Stack unwinding while on IRQ stack Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-02 14:40 +0100
  [PATCH 4/5] MIPS: Switch to the irq_stack in interrupts Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-02 14:40 +0100
  [PATCH 3/5] MIPS: Only change $28 to thread_info if coming from user mode Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-02 14:50 +0100
    Re: [PATCH 3/5] MIPS: Only change $28 to thread_info if coming from  user mode "Maciej W. Rozycki" <macro@imgtec.com> - 2016-12-05 17:30 +0100
      Re: [PATCH 3/5] MIPS: Only change $28 to thread_info if coming from  user mode Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-05 18:00 +0100
        Re: [PATCH 3/5] MIPS: Only change $28 to thread_info if coming from  user mode "Maciej W. Rozycki" <macro@imgtec.com> - 2016-12-05 18:30 +0100
      Re: [PATCH 3/5] MIPS: Only change $28 to thread_info if coming from user mode Paul Burton <paul.burton@imgtec.com> - 2016-12-05 18:30 +0100
        Re: [PATCH 3/5] MIPS: Only change $28 to thread_info if coming from  user mode "Maciej W. Rozycki" <macro@imgtec.com> - 2016-12-05 19:00 +0100
  [PATCH 1/5] MIPS: Introduce irq_stack Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-02 14:50 +0100
    Re: [PATCH 1/5] MIPS: Introduce irq_stack "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-06 23:20 +0100
      Re: [PATCH 1/5] MIPS: Introduce irq_stack Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-07 10:30 +0100
  [PATCH 5/5] MIPS: Select HAVE_IRQ_EXIT_ON_IRQ_STACK Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-02 14:50 +0100
  Re: [PATCH 0/5] MIPS: Add per-cpu IRQ stack "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-06 23:20 +0100
    Re: [PATCH 0/5] MIPS: Add per-cpu IRQ stack Matt Redfearn <matt.redfearn@imgtec.com> - 2016-12-07 10:40 +0100

csiph-web