Hi Dave,
For s390(x) we check the runqueues to find out, which task is currently
running on a cpu.
In 2.6.19 "struct runqueue" was renamed to "struct rq". This patch
uses
"struct rq" in case "struct runqueue" is not available in the vmlinux
debug info.
---
s390.c | 16 ++++++++++++----
s390x.c | 16 ++++++++++++----
2 files changed, 24 insertions(+), 8 deletions(-)
diff -Naurp crash-4.0-3.22/s390.c crash-4.0-3.22-s390-rq-fix/s390.c
--- crash-4.0-3.22/s390.c 2007-04-10 16:27:20.000000000 +0200
+++ crash-4.0-3.22-s390-rq-fix/s390.c 2007-04-24 17:01:20.000000000 +0200
@@ -538,7 +538,7 @@ s390_has_cpu(unsigned long task)
/* Linux 2.6 */
unsigned long runqueue_addr, runqueue_offset;
unsigned long cpu_offset, per_cpu_offset_addr, running_task;
- char runqueue[4096];
+ char rq[4096];
int cpu;
cpu = s390_cpu_of_task(task);
@@ -549,10 +549,18 @@ s390_has_cpu(unsigned long task)
&cpu_offset, sizeof(long),"per_cpu_offset",
FAULT_ON_ERROR);
runqueue_addr=runqueue_offset + cpu_offset;
- readmem(runqueue_addr,KVADDR,&runqueue,sizeof(runqueue),
- "runqueue", FAULT_ON_ERROR);
- running_task = *((unsigned long*)&runqueue[MEMBER_OFFSET(
+ readmem(runqueue_addr,KVADDR,&rq, sizeof(rq), "rq",
+ FAULT_ON_ERROR);
+
+ if (STRUCT_EXISTS("runqueue"))
+ running_task = *((unsigned long*)&rq[MEMBER_OFFSET(
"runqueue", "curr")]);
+ else if (STRUCT_EXISTS("rq"))
+ running_task = *((unsigned long*)&rq[MEMBER_OFFSET(
+ "rq", "curr")]);
+ else
+ error(WARNING, "Unable to determine running task!\n");
+
if(running_task == task)
return TRUE;
else
diff -Naurp crash-4.0-3.22/s390x.c crash-4.0-3.22-s390-rq-fix/s390x.c
--- crash-4.0-3.22/s390x.c 2007-04-10 16:27:20.000000000 +0200
+++ crash-4.0-3.22-s390-rq-fix/s390x.c 2007-04-24 17:02:56.000000000 +0200
@@ -572,7 +572,7 @@ s390x_has_cpu(unsigned long task)
/* Linux 2.6 */
unsigned long runqueue_addr, runqueue_offset;
unsigned long cpu_offset, per_cpu_offset_addr, running_task;
- char runqueue[4096];
+ char rq[4096];
int cpu;
cpu = s390x_cpu_of_task(task);
@@ -583,10 +583,18 @@ s390x_has_cpu(unsigned long task)
&cpu_offset, sizeof(long),"per_cpu_offset",
FAULT_ON_ERROR);
runqueue_addr=runqueue_offset + cpu_offset;
- readmem(runqueue_addr,KVADDR,&runqueue,sizeof(runqueue),
- "runqueue", FAULT_ON_ERROR);
- running_task = *((unsigned long*)&runqueue[MEMBER_OFFSET(
+ readmem(runqueue_addr,KVADDR,&rq,sizeof(rq), "rq",
+ FAULT_ON_ERROR);
+
+ if (STRUCT_EXISTS("runqueue"))
+ running_task = *((unsigned long*)&rq[MEMBER_OFFSET(
"runqueue", "curr")]);
+ else if (STRUCT_EXISTS("rq"))
+ running_task = *((unsigned long*)&rq[MEMBER_OFFSET(
+ "rq", "curr")]);
+ else
+ error(WARNING, "Unable to determine running task!\n");
+
if(running_task == task)
return TRUE;
else