kdb
[Top] [All Lists]

[patch] fix 'ps' command in ia64 2.6 kdb

To: xavier.bru@xxxxxxxx, kdb@xxxxxxxxxxx
Subject: [patch] fix 'ps' command in ia64 2.6 kdb
From: Martin Pool <mbp@xxxxxxxxx>
Date: Tue, 12 Aug 2003 15:59:00 +1000
Sender: kdb-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.4i
I've been trying to update kdb for ia64 2.6, based on Xavier Bru's kdb
4.3 patches to 2.5.72 at http://www.bullfreeware.com/linux/kdb/.

One problem I hit was that the 'ps' command would always oops on an
SMP machine, because of trying to read information about nonexistant
processors.  This patch fixes that.  

It may not be an optimal fix; I am going to look a little more at how
NR_CPUS is used here.

I can't believe I'm the only person to hit this, so perhaps I started
from a patch that was too old?


--- linux-2.6.0test2-ia64-kdb-orig/kdb/kdbmain.c        2003-08-12 
15:46:44.000000000 +1000
+++ linux-2.6.0test2-ia64-kdb/kdb/kdbmain.c     2003-08-12 15:30:52.000000000 
+1000
@@ -2959,12 +2959,20 @@ kdb_ps(int argc, const char **argv, cons
        mask = kdb_task_state_string(argc, argv, envp);
        /* Run the active tasks first */
        for (cpu = 0; cpu < NR_CPUS; ++cpu) {
+               if (!cpu_online(cpu)) 
+                       continue;
                p = kdb_active_task[cpu];
+               if (!p) {
+                       kdb_printf("No task active on CPU%d!\n", cpu);
+                       continue;
+               }
                if (!kdb_task_state(p, mask))
                        continue;
                kdb_ps1(p);
        }
        /* Now the real tasks */
+       /* FIXME: Running tasks are printed out twice: once above for
+        * the CPU, and then again here. */
        for_each_process(p) {
                if (!kdb_task_state(p, mask))
                        continue;


-- 
Martin 

<Prev in Thread] Current Thread [Next in Thread>