[Crash-utility] Problem in runq command

Dave Anderson anderson at redhat.com
Thu Jul 12 14:55:42 UTC 2012



----- Original Message -----
> 
> 
> ----- Original Message -----
> > 
> > Hi Dave
> > 
> > I found a problem with the runq command in the function
> > dump_CFS_runqueues in task.c. The problem is in:
> > 
> > if (!(rq_sp = per_cpu_symbol_search("per_cpu__runqueues")))
> > 
> >     error(FATAL, "per-cpu runqueues does not exist\n");
> > 
> > as that code does not support single core systems. However the rest
> > of the function seems to handle single core correctly, so by just
> > adding one line:
> > 
> > if (!(rq_sp = per_cpu_symbol_search("per_cpu__runqueues")))
> >     if (!(rq_sp = symbol_search("runqueues")))
> >         error(FATAL, "per-cpu runqueues does not exist\n");
> >
> > the runq command works as it should. Of course the text in the error
> > message should also be updated to something more proper.
> >
> 
> Interesting -- as it turns out, I've only got one sample x86_64 UP
> kernel vmcore, and even though it's non-smp, a "per_cpu__runqueues"
> symbol exists that points to the single runqueue.  But it's a 2.6.31
> UP kernel, and per-cpu handling has changed since then.
> 
> Anyway I see see the problem with the sample UP 2.6.38 ARM vmcore you
> guys sent me, and note that it also breaks the "runq -t" option as well.
> But that is also fixable by applying the same patch.

I take that back -- the per_cpu_symbol_search() function should find
the non-percpu symbol and return its syment pointer.  And because that
function fails, other command(s) that call per_cpu_symbol_search() will
fail with your vmcore as well.  For example, the "timer" command:.

  crash> runq
  runq: per-cpu runqueues does not exist
  crash> timer
  timer: zero-size memory allocation! (called from 811c199)
  crash>

This doesn't appear to be ARM-specific, but to be safe, the fix I'm 
going with is this:

--- ARM_crash-6.0.8/symbols.c.orig
+++ ARM_crash-6.0.8/symbols.c
@@ -4789,6 +4789,9 @@ per_cpu_symbol_search(char *symbol)
                if ((sp = symbol_search(new))) {
                        if ((sp->type == 'V') || (is_percpu_symbol(sp)))
                                return sp;
+                       if ((sp->type == 'd') &&
+                           (st->__per_cpu_start == st->__per_cpu_end))
+                               return sp;
                }
        } else {
                if ((sp = symbol_search(symbol))) {

Dave




More information about the Crash-utility mailing list