[Crash-utility] [PATCH] s390x: fix interrupt stack address calculation

Michael Holzheu holzheu at linux.vnet.ibm.com
Mon Jun 8 17:24:20 UTC 2015


The kernel commit 2f859d0dad8 ("s390/smp: reduce size of struct pcpu")
for linux-4.0 removed the "async_stack" and "panic_stack" members from
"struct pcpu".

So now the only option to find out the stack address is using "struct
lowcore" (again). Unfortunately we don't get the exact address because
since commit dc7ee00d477 ("s390: lowcore stack pointer offsets") the stack
frame overhead is already subtracted from the addresses. Therefore we
have to roundup the stack address to PAGE_SIZE.

Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
---
 s390x.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- a/s390x.c
+++ b/s390x.c
@@ -1027,8 +1027,6 @@ static unsigned long get_int_stack_pcpu(
 {
 	unsigned long addr;
 
-	if (!MEMBER_EXISTS("pcpu", stack_name))
-		return 0;
 	addr = symbol_value("pcpu_devices") +
 		cpu * STRUCT_SIZE("pcpu") + MEMBER_OFFSET("pcpu", stack_name);
 	return readmem_ul(addr) + INT_STACK_SIZE;
@@ -1041,7 +1039,8 @@ static unsigned long get_int_stack_lc(ch
 {
 	if (!MEMBER_EXISTS(lc_struct, stack_name))
 		return 0;
-	return ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name));
+	return roundup(ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name)),
+			     PAGESIZE());
 }
 
 /*
@@ -1057,7 +1056,7 @@ static void get_int_stack(char *stack_na
 		stack_addr = symbol_value("restart_stack");
 		stack_addr = readmem_ul(stack_addr);
 	} else {
-		if (symbol_exists("pcpu_devices"))
+		if (symbol_exists("pcpu_devices") && MEMBER_EXISTS("pcpu", stack_name))
 			stack_addr = get_int_stack_pcpu(stack_name, cpu);
 		else
 			stack_addr = get_int_stack_lc(stack_name, lc);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash-7.1.1-s390-fix-interrupt-stacks.patch
Type: text/x-patch
Size: 1670 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20150608/a73fef46/attachment.bin>


More information about the Crash-utility mailing list