aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Redfearn <[email protected]>2016-12-19 14:20:57 +0000
committerRalf Baechle <[email protected]>2017-01-03 16:34:34 +0100
commitd42d8d106b0275b027c1e8992c42aecf933436ea (patch)
treecf5b3f4a09288a5d2a941a19458bb159cbada948
parentfe8bd18ffea5327344d4ec2bf11f47951212abd0 (diff)
MIPS: Stack unwinding while on IRQ stack
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 <[email protected]> Acked-by: Jason A. Donenfeld <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Adam Buchbinder <[email protected]> Cc: Maciej W. Rozycki <[email protected]> Cc: Marcin Nowakowski <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: James Hogan <[email protected]> Cc: Paul Burton <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Andrew Morton <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/14741/ Signed-off-by: Ralf Baechle <[email protected]>
-rw-r--r--arch/mips/kernel/process.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 5142b1dfe8a7..48e30e0469ef 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