[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1491486734-15668-3-git-send-email-amit.pundir@linaro.org>
Date: Thu, 6 Apr 2017 19:22:10 +0530
From: Amit Pundir <amit.pundir@...aro.org>
To: gregkh@...uxfoundation.org
Cc: stable@...r.kernel.org, james.hogan@...tec.com,
Matt Redfearn <matt.redfearn@...tec.com>,
Thomas Gleixner <tglx@...utronix.de>,
Adam Buchbinder <adam.buchbinder@...il.com>,
"Maciej W . Rozycki" <macro@...tec.com>,
Marcin Nowakowski <marcin.nowakowski@...tec.com>,
Chris Metcalf <cmetcalf@...lanox.com>,
Paul Burton <paul.burton@...tec.com>,
Jiri Slaby <jslaby@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org,
Ralf Baechle <ralf@...ux-mips.org>
Subject: [PATCH for-4.10 2/6] MIPS: Stack unwinding while on IRQ stack
From: Matt Redfearn <matt.redfearn@...tec.com>
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@...tec.com>
Acked-by: Jason A. Donenfeld <jason@...c4.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Adam Buchbinder <adam.buchbinder@...il.com>
Cc: Maciej W. Rozycki <macro@...tec.com>
Cc: Marcin Nowakowski <marcin.nowakowski@...tec.com>
Cc: Chris Metcalf <cmetcalf@...lanox.com>
Cc: James Hogan <james.hogan@...tec.com>
Cc: Paul Burton <paul.burton@...tec.com>
Cc: Jiri Slaby <jslaby@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mips@...ux-mips.org
Cc: linux-kernel@...r.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14741/
Signed-off-by: Ralf Baechle <ralf@...ux-mips.org>
(cherry picked from commit d42d8d106b0275b027c1e8992c42aecf933436ea)
Signed-off-by: Amit Pundir <amit.pundir@...aro.org>
---
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 7d80447..efa1df5 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>
@@ -556,7 +557,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
Powered by blists - more mailing lists