[Crash-utility] [PATCH] Fix display processor speed on ppc/ppc64

Dave Anderson anderson at redhat.com
Wed Mar 24 13:31:36 UTC 2010


----- "Pavan Naregundi" <pavan at linux.vnet.ibm.com> wrote:

> Hi Everyone,
> 
> On Power6 crash displays "MACHINE: ppc64 (unknown Mhz)" for processor
> speed upon initialization and by the "sys" sub-command.
> 
> # 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: /boot/vmlinux-2.6.32.9-0.5-ppc64
>     DUMPFILE: /dev/mem
>         CPUS: 5
>         DATE: Thu Mar 18 03:13:59 2010
>       UPTIME: 04:11:31
> LOAD AVERAGE: 0.34, 0.15, 0.05
>        TASKS: 319
>     NODENAME: brucelp3
>      RELEASE: 2.6.32.9-0.5-ppc64
>      VERSION: #1 SMP 2010-03-15 12:22:00 +0100
>      MACHINE: ppc64  (unknown Mhz) ======> display unknown Mhz
>       MEMORY: 1 GB
>          PID: 17788
>      COMMAND: "crash"
>         TASK: c00000003ae58b80  [THREAD_INFO: c00000003df68000]
>          CPU: 6
>        STATE: TASK_RUNNING (ACTIVE)
> =====================
> 
> When investigated this issue was absence of 'have_of' symbol in current
> kernels. Below is the commit which removed the support of 'have_of'.
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6b82b3e4b54b2fce2ca11976c535012b836b2016
> 
> 
> This patch overcomes the use of 'have_of' variable.. Please review this
> patch..
> 
> Regards,
> Pavan
> IBM Linux Technology Center

This patch doesn't seem like it would be backwards-compatible for older
systems which do *not* have the "have_of" symbol.  Can you confirm
that this patch will still work for them?

Thanks,
  Dave

 

> 
> ---
> diff -Naur a/ppc64.c b/ppc64.c
> --- a/ppc64.c	2010-03-24 10:14:33.000000000 +0530
> +++ b/ppc64.c	2010-03-24 10:14:51.000000000 +0530
> @@ -742,7 +742,7 @@
>  ppc64_processor_speed(void)
>  {
>          ulong res, value, ppc_md, md_setup_res;
> -        ulong we_have_of, prep_setup_res;
> +        ulong prep_setup_res;
>          ulong node, type, name, properties;
>  	char str_buf[32];
>  	uint len;
> @@ -751,22 +751,12 @@
>          if (machdep->mhz)
>                  return(machdep->mhz);
>  
> -        /* first, check if the have_of variable a) exists, and b) is TRUE */
> -        if(symbol_exists("have_of")) {
> -                get_symbol_data("have_of", sizeof(void *), &we_have_of);
> -        } else {
> -                we_have_of = 0;
> -        }
> -
> -        if(we_have_of) {
> +        if(symbol_exists("allnodes")) {
>                  /* we have a machine with open firmware, so search the OF nodes
>                   * for cpu nodes.
>                   * Too bad we can't call kernel helper functions here :)
>                   */
>  
> -                if(!symbol_exists("allnodes"))
> -                        return (machdep->mhz = 0);
> -
>                  get_symbol_data("allnodes", sizeof(void *), &node);
>                  while(node) {
>                          readmem(node+OFFSET(device_node_type),
> diff -Naur a/ppc.c b/ppc.c
> --- a/ppc.c	2010-03-24 10:14:33.000000000 +0530
> +++ b/ppc.c	2010-03-24 10:14:51.000000000 +0530
> @@ -461,7 +461,7 @@
>  ppc_processor_speed(void)
>  {
>  	ulong res, value, ppc_md, md_setup_res;
> -	ulong we_have_of, prep_setup_res;
> +	ulong prep_setup_res;
>  	ulong node, type, name, properties;
>  	char str_buf[16];
>  	ulong len, mhz = 0;
> @@ -469,22 +469,12 @@
>  	if (machdep->mhz)
>  		return(machdep->mhz);
>  
> -	/* first, check if the have_of variable a) exists, and b) is TRUE */
> -	if(symbol_exists("have_of")) {
> -		get_symbol_data("have_of", sizeof(void *), &we_have_of);
> -	} else {
> -		we_have_of = 0;
> -	}
> -
> -	if(we_have_of) {
> +	if(symbol_exists("allnodes")) {
>  		/* we have a machine with open firmware, so search the OF nodes 
>  		 * for cpu nodes.
>  		 * Too bad we can't call kernel helper functions here :)
>  		 */
>  		
> -		if(!symbol_exists("allnodes"))
> -			return (machdep->mhz = 0);
> -		
>  		get_symbol_data("allnodes", sizeof(void *), &node);
>  		while(node) {
>  			readmem(node+OFFSET(device_node_type),
> 
> 




More information about the Crash-utility mailing list