[PATCH v3 2/2] bt: arm64: add support for bt -n idle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The '-n idle' option of bt command can help us filter the
stack of the idle process when debugging the dumpfiles
captured by kdump.

This patch supports this feature on ARM64.

Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
---
 arm64.c  | 19 ++++++++++++++++---
 help.c   |  2 +-
 kernel.c |  3 ++-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/arm64.c b/arm64.c
index 65f6cdf..0f615cf 100644
--- a/arm64.c
+++ b/arm64.c
@@ -3681,6 +3681,12 @@ arm64_get_dumpfile_stackframe(struct bt_info *bt, struct arm64_stackframe *frame
 {
 	struct machine_specific *ms = machdep->machspec;
 	struct arm64_pt_regs *ptregs;
+	bool skip = false;
+
+	if (bt->flags & BT_SKIP_IDLE) {
+		skip = true;
+		bt->flags &= ~BT_SKIP_IDLE;
+	}
 
 	if (!ms->panic_task_regs ||
 	    (!ms->panic_task_regs[bt->tc->processor].sp && 
@@ -3713,8 +3719,11 @@ try_kernel:
 	}
 
 	if (arm64_in_kdump_text(bt, frame) || 
-	    arm64_in_kdump_text_on_irq_stack(bt))
+	    arm64_in_kdump_text_on_irq_stack(bt)) {
 		bt->flags |= BT_KDUMP_ADJUST;
+		if (skip && is_idle_thread(bt->task))
+			bt->flags |= BT_SKIP_IDLE;
+	}
 
 	return TRUE;
 }
@@ -3738,10 +3747,14 @@ arm64_get_stack_frame(struct bt_info *bt, ulong *pcp, ulong *spp)
 	int ret;
 	struct arm64_stackframe stackframe = { 0 };
 
-	if (DUMPFILE() && is_task_active(bt->task))
+	if (DUMPFILE() && is_task_active(bt->task)) {
 		ret = arm64_get_dumpfile_stackframe(bt, &stackframe);
-	else
+	} else {
+		if (bt->flags & BT_SKIP_IDLE)
+			bt->flags &= ~BT_SKIP_IDLE;
+
 		ret = arm64_get_stackframe(bt, &stackframe);
+	}
 
 	if (!ret)
 		error(WARNING, 
diff --git a/help.c b/help.c
index 0e5b6fc..a93b3e2 100644
--- a/help.c
+++ b/help.c
@@ -1915,7 +1915,7 @@ char *help_bt[] = {
 "       -a  displays the stack traces of the active task on each CPU.",
 "           (only applicable to crash dumps)",
 "       -A  same as -a, but also displays vector registers (S390X only).",
-"  -n idle  filter the stack of idle tasks (x86_64).",
+"  -n idle  filter the stack of idle tasks (x86_64, arm64).",
 "           (only applicable to crash dumps)",
 "       -p  display the stack trace of the panic task only.",
 "           (only applicable to crash dumps)",
diff --git a/kernel.c b/kernel.c
index 411e9da..a521ef3 100644
--- a/kernel.c
+++ b/kernel.c
@@ -2673,7 +2673,8 @@ cmd_bt(void)
 			break;
 
 		case 'n':
-			if (machine_type("X86_64") && STREQ(optarg, "idle"))
+			if ((machine_type("X86_64") || machine_type("ARM64")) &&
+			    STREQ(optarg, "idle"))
 				bt->flags |= BT_SKIP_IDLE;
 			else
 				option_not_supported(c);
-- 
2.20.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux