From: Wang Qing <wangqing@vivo.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, James Morse <james.morse@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Dave Martin <Dave.Martin@arm.com>,
Dmitry Safonov <0x7f454c46@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Wang Qing <wangqing@vivo.com>, jinho lim <jordan.lim@samsung.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Subject: [PATCH] arm64: smp call when task currently running on other cpu
Date: Fri, 12 Jun 2020 15:41:46 +0800 [thread overview]
Message-ID: <1591947707-15140-1-git-send-email-wangqing@vivo.com> (raw)
We cannot get FP and PC when the task is running on another CPU,
task->thread.cpu_context is the last time the task was switched out,
we can use smp call to print backtrace itself.
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
arch/arm64/kernel/traps.c | 11 +++++++++++
1 file changed, 11 insertions(+)
mode change 100644 => 100755 arch/arm64/kernel/traps.c
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 50cc30a..17a07b9
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -83,6 +83,11 @@ static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
printk("%sCode: %s\n", lvl, str);
}
+static void dump_backtrace_smp_fun(struct task_struct *tsk)
+{
+ dump_backtrace(NULL, tsk, KERN_DEFAULT);
+}
+
void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
const char *loglvl)
{
@@ -107,6 +112,12 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
start_backtrace(&frame,
(unsigned long)__builtin_frame_address(0),
(unsigned long)dump_backtrace);
+ } else if (task_curr(tsk)) {
+ /*
+ * The task is currently running on other cpu
+ */
+ smp_call_function_single(tsk->cpu, dump_backtrace_fun, tsk, 0);
+ return;
} else {
/*
* task blocked in __switch_to
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-06-12 7:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-12 7:41 Wang Qing [this message]
2020-06-12 13:29 ` [PATCH] arm64: smp call when task currently running on other cpu Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1591947707-15140-1-git-send-email-wangqing@vivo.com \
--to=wangqing@vivo.com \
--cc=0x7f454c46@gmail.com \
--cc=Dave.Martin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=jordan.lim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=opensource.kernel@vivo.com \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox