[Crash-utility] [PATCH] Display online cpus value in preference to kt->cpus

Luciano Chavez lnx1138 at linux.vnet.ibm.com
Mon Mar 8 23:38:54 UTC 2010


On Mon, 2010-03-08 at 21:23 +0000, Luciano Chavez wrote:
> On Mon, 2010-03-08 at 20:30 +0000, Luciano Chavez wrote:
> > On Mon, 2010-03-08 at 14:52 -0500, Dave Anderson wrote:
> > > 
> > > For now, all I was thinking would be to simply change display_sys_stats()
> > > to something like:
> > > 
> > >         if (machine_type("PPC64"))
> > >                 your_function();       
> > >         else
> > >                 fprintf(fp, "        CPUS: %d\n", kt->cpus);
> > > 
> > > and since your_function() does not need to be in a machine-specific
> > > file, just put in kernel.c.  And you can also call it from the
> > > ppc64_display_machine_stats() function.
> > 
> > Hi Dave,
> > 
> > I like this particular solution best! Simple and straightforward. I'll
> > work on a patch that does exactly as suggested. I'll post it for review
> > once I have it done this afternoon. Thanks for the help!
> 
> Below is the simpler revised patch. It applies and compiles to the
> latest crash 5.0.1 source cleanly. 
> 
> I still need to verify it still fixes the original problem. I am
> confident it will but just wanted to post the patch up first.
> 
> BTW, I was able to briefly access a POWER7 box this morning and
> confirmed that at least the CPU count displayed would be worse on one of
> those systems if indeed SMT was disabled and when using the current code
> minus the patch.
> 
> ~ # cat /sys/devices/system/cpu/online
> 0-23
> ~ # ppc64_cpu --smt=off
> ~ # cat /sys/devices/system/cpu/online
> 0,4,8,12,16,20
> 
> The current 5.0.1 code would display CPUS: 21 rather than CPUS: 6
> 
> Once I confirm the patch fixes this problem, I will post a followup.
> 

I tested the patch and confirmed it displayed the expected results after
disabling smt on a ppc64 test system. Previously, CPUS
count would have been displayed incorrectly as 15 on this test system.

[root at elm3b130 crash-5.0.1]#  ppc64_cpu --smt=on
[root at elm3b130 crash-5.0.1]# cat /sys/devices/system/cpu/cpu*/online | grep -c 1
16
[root at elm3b130 crash-5.0.1]#  ppc64_cpu --smt=off
[root at elm3b130 crash-5.0.1]# cat /sys/devices/system/cpu/cpu*/online | grep -c 1
8
[root at elm3b130 crash-5.0.1]# ./crash 

crash 5.0.1
Copyright (C) 2002-2010  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.
 
GNU gdb (GDB) 7.0
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc64-unknown-linux-gnu"...

      KERNEL: /usr/lib/debug/lib/modules/2.6.18-190.el5/vmlinux
    DUMPFILE: /dev/mem
        CPUS: 8
        DATE: Mon Mar  8 18:36:44 2010
      UPTIME: 01:49:41
LOAD AVERAGE: 0.54, 0.54, 0.36
       TASKS: 176
    NODENAME: elm3b130
     RELEASE: 2.6.18-190.el5
     VERSION: #1 SMP Mon Feb 22 19:18:34 EST 2010
     MACHINE: ppc64  (1654 Mhz)
      MEMORY: 4 GB
         PID: 20625
     COMMAND: "crash"
        TASK: c000000090456c00  [THREAD_INFO: c0000000ceb84000]
         CPU: 14
       STATE: TASK_RUNNING (ACTIVE)

crash> sys
      KERNEL: /usr/lib/debug/lib/modules/2.6.18-190.el5/vmlinux
    DUMPFILE: /dev/mem
        CPUS: 8
        DATE: Mon Mar  8 18:36:49 2010
      UPTIME: 01:49:45
LOAD AVERAGE: 0.50, 0.53, 0.36
       TASKS: 177
    NODENAME: elm3b130
     RELEASE: 2.6.18-190.el5
     VERSION: #1 SMP Mon Feb 22 19:18:34 EST 2010
     MACHINE: ppc64  (1654 Mhz)
      MEMORY: 4 GB
crash> 


-- 
Luciano Chavez <lnx1138 at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Crash-utility mailing list