From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932949AbcLSOVd (ORCPT ); Mon, 19 Dec 2016 09:21:33 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:3282 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758619AbcLSOVI (ORCPT ); Mon, 19 Dec 2016 09:21:08 -0500 From: Matt Redfearn To: Ralf Baechle CC: , "Jason A . Donenfeld" , Thomas Gleixner , Matt Redfearn , Adam Buchbinder , "Maciej W. Rozycki" , Marcin Nowakowski , Chris Metcalf , , James Hogan , Paul Burton , Jiri Slaby , Andrew Morton Subject: [PATCH v3 2/5] MIPS: Stack unwinding while on IRQ stack Date: Mon, 19 Dec 2016 14:20:57 +0000 Message-ID: <1482157260-18730-3-git-send-email-matt.redfearn@imgtec.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482157260-18730-1-git-send-email-matt.redfearn@imgtec.com> References: <1482157260-18730-1-git-send-email-matt.redfearn@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.150.130.83] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v3: None Changes in v2: None 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 #include #include +#include #include #include #include @@ -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