[PATCH] s390x: fix interrupt stack address calculation

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

 



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@xxxxxxxxxxxxxxxxxx>
---
 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);
s390x: fix interrupt stack address calculation

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@xxxxxxxxxxxxxxxxxx>
---
 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);
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

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

 

Powered by Linux