Subject: [PATCH] Fix nested stack like task => softirq => hardirq
To: [email protected]
From: OGAWA Hirofumi <[email protected]>
Date: Fri, 17 Feb 2017 22:49:45 +0900
Message-ID: <[email protected]>
Recent i386 kernel has separated stack for task, softirq, and hardirq.
Now crash try to determine between task and stack. But current code
doesn't handle if nested like task => softirq => hardirq.
This patch try to handle the nested case.
---
task.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff -puN task.c~fix-x86-nest-stack task.c
--- crash-32/task.c~fix-x86-nest-stack 2017-02-17 22:40:40.430200158 +0900
+++ crash-32-hirofumi/task.c 2017-02-17 22:47:22.304439206 +0900
@@ -555,7 +555,7 @@ irqstacks_init(void)
int i;
char *thread_info_buf;
struct syment *hard_sp, *soft_sp;
- ulong ptr;
+ ulong ptr, hardirq_next_sp = 0;
if (!(tt->hardirq_ctx = (ulong *)calloc(NR_CPUS, sizeof(ulong))))
error(FATAL, "cannot malloc hardirq_ctx space.");
@@ -610,8 +610,10 @@ irqstacks_init(void)
if (MEMBER_EXISTS("irq_ctx", "tinfo"))
tt->hardirq_tasks[i] =
ULONG(thread_info_buf+OFFSET(thread_info_task));
- else
- tt->hardirq_tasks[i] = stkptr_to_task(ULONG(thread_info_buf));
+ else {
+ hardirq_next_sp = ULONG(thread_info_buf);
+ tt->hardirq_tasks[i] = stkptr_to_task(hardirq_next_sp);
+ }
}
if ((soft_sp = per_cpu_symbol_search("per_cpu__softirq_ctx")) ||
@@ -656,8 +658,15 @@ irqstacks_init(void)
if (MEMBER_EXISTS("irq_ctx", "tinfo"))
tt->softirq_tasks[i] =
ULONG(thread_info_buf+OFFSET(thread_info_task));
- else
+ else {
tt->softirq_tasks[i] = stkptr_to_task(ULONG(thread_info_buf));
+ /* Checking if softirq => hardirq nested stack */
+ if (tt->softirq_tasks[i] != NO_TASK && hardirq_next_sp) {
+ if (tt->softirq_ctx[i] <= hardirq_next_sp &&
+ hardirq_next_sp < tt->softirq_ctx[i] + STACKSIZE())
+ tt->hardirq_tasks[i] = tt->softirq_tasks[i];
+ }
+ }
}
tt->flags |= IRQSTACKS;
_
--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility