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

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

 



The '-n idle' parameter of bt command can help us filter the
stack of the idle process when debugging the dumpfile.

This patch supports this feature on ARM64.

Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
---
 arm64.c  | 19 ++++++++++++++++---
 kernel.c |  3 ++-
 2 files changed, 18 insertions(+), 4 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/kernel.c b/kernel.c
index acfacaf..8b6e598 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;
 			break;
 
-- 
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