Re: [PATCH] Runqueue fix for s390

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

 



holzheu wrote:
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.
 

Hi Mike,

I don't think you need to go through all the STRUCT_EXISTS()
and MEMBER_OFFSET() gyrations, do you?

This was addressed a while ago in 4.0-3.1:

4.0-3.1  - Fix to address 2.6.18 and later Fedora 2.6.17-based kernel data
           structure name change from "runqueue" to "rq".  This would cause
           crash to fail during initialization with a "crash: cannot determine
           idle task addresses from init_tasks[] or runqueues[]" message,
           followed by a red herring message: "crash: cannot resolve
           init_task_union".  (haren@xxxxxxxxxx)

In that patch, both "runqueue" and "rq" are recognized as the
data structure name, so you can just use the pre-initialized
member offsets and struct sizes, which still use "runqueue" even
when the "rq" structure is used.

For example:

  crash> struct runqueue
  struct: invalid data structure reference: runqueue

  crash> help -o runqueue
                    offset_table:
                   runqueue_curr: 80
                   runqueue_idle: 88
                 runqueue_active: 104
                runqueue_expired: 112
                 runqueue_arrays: 120
                    runqueue_cpu: -1

                      size_table:
                        runqueue: 4832
  crash>

So you can use "OFFSET(runqueue_xxx)" or SIZE(runqueue)
directly.

Dave
 
 
 
 

 
---

 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

--
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