FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 03-24-2010, 04:07 AM
Pavan Naregundi
 
Default Fix display processor speed on ppc/ppc64

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=6b82b3e4b54b2fce2ca11976c535012 b836b2016


This patch overcomes the use of 'have_of' variable.. Please review this
patch..

Regards,
Pavan
IBM Linux Technology Center

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


--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-24-2010, 12:31 PM
Dave Anderson
 
Default Fix display processor speed on ppc/ppc64

----- "Pavan Naregundi" <pavan@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=6b82b3e4b54b2fce2ca11976c535012 b836b2016
>
>
> 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),
>
>

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-25-2010, 04:40 AM
Pavan Naregundi
 
Default Fix display processor speed on ppc/ppc64

On Wed, 2010-03-24 at 09:31 -0400, Dave Anderson wrote:

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

Hi Dave,

I think systems you are referring are, systems which do not have OF. I
don't have a system of that type here to test.. Just to be safe I have
prepared a new patch..

Changes are, patch assumes that system is having the OF and tries to
find the processor speed.. If the speed was not found, then if would go
will the code of finding the processor speed in system without OF. I
think this will makes sure of backwards-compatibility in older system.

Thanks
Pavan

---
diff -Naur a/ppc64.c b/ppc64.c
--- a/ppc64.c 2010-03-25 10:47:54.000000000 +0530
+++ b/ppc64.c 2010-03-25 10:48:15.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,7 @@
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) {
- /* 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);
-
+ if(symbol_exists("allnodes")) {
get_symbol_data("allnodes", sizeof(void *), &node);
while(node) {
readmem(node+OFFSET(device_node_type),
@@ -842,54 +827,54 @@
}
if(!properties) {
/* didn't find the cpu speed for some
reason */
- mhz = 0;
+ return (machdep->mhz = 0);
}
}
- } else {
- /* for machines w/o OF */
- /* untested, but in theory this should work on prep
machines */
+ }

- if (symbol_exists("res")) {
- get_symbol_data("res", sizeof(void *), &res);
+ /* for machines w/o OF */
+ /* untested, but in theory this should work on prep machines */

- if (symbol_exists("prep_setup_residual")) {
- get_symbol_data("prep_setup_residual",
- sizeof(void *),
&prep_setup_res);
- get_symbol_data("ppc_md", sizeof(void
*),
- &ppc_md);
- readmem(ppc_md +
-
OFFSET(machdep_calls_setup_residual),
- KVADDR, &md_setup_res,
- sizeof(ulong), "ppc_md
setup_residual",
- FAULT_ON_ERROR);
-
- if(prep_setup_res == md_setup_res) {
- /* PREP machine */
- readmem(res+
-
OFFSET(RESIDUAL_VitalProductData)+
- OFFSET(VPD_ProcessorHz),
- KVADDR, &mhz,
sizeof(ulong),
- "res VitalProductData",
- FAULT_ON_ERROR);
+ if (symbol_exists("res") && !mhz) {
+ get_symbol_data("res", sizeof(void *), &res);

- mhz = (mhz > 1024) ? mhz >>
20 : mhz;
- }
- }
+ if (symbol_exists("prep_setup_residual")) {
+ get_symbol_data("prep_setup_residual",
+ sizeof(void *), &prep_setup_res);
+ get_symbol_data("ppc_md", sizeof(void *),
+ &ppc_md);
+ readmem(ppc_md +
+ OFFSET(machdep_calls_setup_residual),
+ KVADDR, &md_setup_res,
+ sizeof(ulong), "ppc_md setup_residual",
+ FAULT_ON_ERROR);

- if(!mhz) {
- /* everything else seems to do this the same
way... */
- readmem(res +
- OFFSET(bd_info_bi_intfreq),
- KVADDR, &mhz, sizeof(ulong),
- "bd_info bi_intfreq",
FAULT_ON_ERROR);
+ if(prep_setup_res == md_setup_res) {
+ /* PREP machine */
+ readmem(res+
+ OFFSET(RESIDUAL_VitalProductData)+
+ OFFSET(VPD_ProcessorHz),
+ KVADDR, &mhz, sizeof(ulong),
+ "res VitalProductData",
+ FAULT_ON_ERROR);

- mhz /= 1000000;
- }
- }
- /* else...well, we don't have OF, or a residual
structure, so
- * just print unknown MHz
- */
- }
+ mhz = (mhz > 1024) ? mhz >> 20 : mhz;
+ }
+ }
+
+ if(!mhz) {
+ /* everything else seems to do this the same
way... */
+ readmem(res +
+ OFFSET(bd_info_bi_intfreq),
+ KVADDR, &mhz, sizeof(ulong),
+ "bd_info bi_intfreq", FAULT_ON_ERROR);
+
+ mhz /= 1000000;
+ }
+ }
+ /* else...well, we don't have OF, or a residual structure, so
+ * just print unknown MHz
+ */

return (machdep->mhz = (ulong)mhz);
}
diff -Naur a/ppc.c b/ppc.c
--- a/ppc.c 2010-03-25 10:47:54.000000000 +0530
+++ b/ppc.c 2010-03-25 10:48:15.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,7 @@
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) {
- /* 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);
-
+ if(symbol_exists("allnodes")) {
get_symbol_data("allnodes", sizeof(void *), &node);
while(node) {
readmem(node+OFFSET(device_node_type),
@@ -545,54 +530,53 @@
}
if(!properties) {
/* didn't find the cpu speed for some reason */
- mhz = 0;
+ return (machdep->mhz = 0);
}
}
- } else {
- /* for machines w/o OF */
- /* untested, but in theory this should work on prep machines */
+ }
+ /* for machines w/o OF */
+ /* untested, but in theory this should work on prep machines */

- if (symbol_exists("res")) {
- get_symbol_data("res", sizeof(void *), &res);
+ if (symbol_exists("res") && !mhz) {
+ get_symbol_data("res", sizeof(void *), &res);

- if (symbol_exists("prep_setup_residual")) {
- get_symbol_data("prep_setup_residual",
- sizeof(void *), &prep_setup_res);
- get_symbol_data("ppc_md", sizeof(void *),
- &ppc_md);
- readmem(ppc_md +
- OFFSET(machdep_calls_setup_residual),
- KVADDR, &md_setup_res,
- sizeof(ulong), "ppc_md setup_residual",
- FAULT_ON_ERROR);
+ if (symbol_exists("prep_setup_residual")) {
+ get_symbol_data("prep_setup_residual",
+ sizeof(void *), &prep_setup_res);
+ get_symbol_data("ppc_md", sizeof(void *),
+ &ppc_md);
+ readmem(ppc_md +
+ OFFSET(machdep_calls_setup_residual),
+ KVADDR, &md_setup_res,
+ sizeof(ulong), "ppc_md setup_residual",
+ FAULT_ON_ERROR);

- if(prep_setup_res == md_setup_res) {
- /* PREP machine */
- readmem(res+
- OFFSET(RESIDUAL_VitalProductData)+
- OFFSET(VPD_ProcessorHz),
- KVADDR, &mhz, sizeof(ulong),
- "res VitalProductData",
- FAULT_ON_ERROR);
+ if(prep_setup_res == md_setup_res) {
+ /* PREP machine */
+ readmem(res+
+ OFFSET(RESIDUAL_VitalProductData)+
+ OFFSET(VPD_ProcessorHz),
+ KVADDR, &mhz, sizeof(ulong),
+ "res VitalProductData",
+ FAULT_ON_ERROR);

- mhz = (mhz > 1024) ? mhz >> 20 : mhz;
- }
+ mhz = (mhz > 1024) ? mhz >> 20 : mhz;
}
+ }

- if(!mhz) {
- /* everything else seems to do this the same way... */
- readmem(res +
- OFFSET(bd_info_bi_intfreq),
- KVADDR, &mhz, sizeof(ulong),
- "bd_info bi_intfreq", FAULT_ON_ERROR);
+ if(!mhz) {
+ /* everything else seems to do this the same way... */
+ readmem(res +
+ OFFSET(bd_info_bi_intfreq),
+ KVADDR, &mhz, sizeof(ulong),
+ "bd_info bi_intfreq", FAULT_ON_ERROR);

- mhz /= 1000000;
- }
+ mhz /= 1000000;
}
- /* else...well, we don't have OF, or a residual structure, so
- * just print unknown MHz
- */
}
+ /* else...well, we don't have OF, or a residual structure, so
+ * just print unknown MHz
+ */

return (machdep->mhz = mhz);
}



--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-25-2010, 11:53 AM
Dave Anderson
 
Default Fix display processor speed on ppc/ppc64

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

> On Wed, 2010-03-24 at 09:31 -0400, Dave Anderson wrote:
>
> >
> > 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
>
> Hi Dave,
>
> I think systems you are referring are, systems which do not have OF. I
> don't have a system of that type here to test.. Just to be safe I have
> prepared a new patch..
>
> Changes are, patch assumes that system is having the OF and tries to
> find the processor speed.. If the speed was not found, then if would go
> will the code of finding the processor speed in system without OF. I
> think this will makes sure of backwards-compatibility in older
> system.
>
> Thanks
> Pavan

Thanks for checking that.

Can you resend this patch as an attachment instead of inlining it?
You can see below that it has wrapped in several locations, but even
if I try to resurrect it, I'm still having trouble getting it to apply.

Thanks again,
Dave

>
> ---
> diff -Naur a/ppc64.c b/ppc64.c
> --- a/ppc64.c 2010-03-25 10:47:54.000000000 +0530
> +++ b/ppc64.c 2010-03-25 10:48:15.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,7 @@
> 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) {
> - /* 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);
> -
> + if(symbol_exists("allnodes")) {
> get_symbol_data("allnodes", sizeof(void *), &node);
> while(node) {
> readmem(node+OFFSET(device_node_type),
> @@ -842,54 +827,54 @@
> }
> if(!properties) {
> /* didn't find the cpu speed for
> some
> reason */
> - mhz = 0;
> + return (machdep->mhz = 0);
> }
> }
> - } else {
> - /* for machines w/o OF */
> - /* untested, but in theory this should work on prep
> machines */
> + }
>
> - if (symbol_exists("res")) {
> - get_symbol_data("res", sizeof(void *),
> &res);
> + /* for machines w/o OF */
> + /* untested, but in theory this should work on prep machines
> */
>
> - if (symbol_exists("prep_setup_residual")) {
> -
> get_symbol_data("prep_setup_residual",
> - sizeof(void *),
> &prep_setup_res);
> - get_symbol_data("ppc_md",
> sizeof(void
> *),
> - &ppc_md);
> - readmem(ppc_md +
> -
> OFFSET(machdep_calls_setup_residual),
> - KVADDR, &md_setup_res,
> - sizeof(ulong), "ppc_md
> setup_residual",
> - FAULT_ON_ERROR);
> -
> - if(prep_setup_res == md_setup_res) {
> - /* PREP machine */
> - readmem(res+
> -
> OFFSET(RESIDUAL_VitalProductData)+
> - OFFSET(VPD_ProcessorHz),
> - KVADDR, &mhz,
> sizeof(ulong),
> - "res VitalProductData",
> - FAULT_ON_ERROR);
> + if (symbol_exists("res") && !mhz) {
> + get_symbol_data("res", sizeof(void *), &res);
>
> - mhz = (mhz > 1024) ? mhz >>
> 20 : mhz;
> - }
> - }
> + if (symbol_exists("prep_setup_residual")) {
> + get_symbol_data("prep_setup_residual",
> + sizeof(void *), &prep_setup_res);
> + get_symbol_data("ppc_md", sizeof(void *),
> + &ppc_md);
> + readmem(ppc_md +
> + OFFSET(machdep_calls_setup_residual),
> + KVADDR, &md_setup_res,
> + sizeof(ulong), "ppc_md
> setup_residual",
> + FAULT_ON_ERROR);
>
> - if(!mhz) {
> - /* everything else seems to do this the
> same
> way... */
> - readmem(res +
> - OFFSET(bd_info_bi_intfreq),
> - KVADDR, &mhz, sizeof(ulong),
> - "bd_info bi_intfreq",
> FAULT_ON_ERROR);
> + if(prep_setup_res == md_setup_res) {
> + /* PREP machine */
> + readmem(res+
> + OFFSET(RESIDUAL_VitalProductData)+
> + OFFSET(VPD_ProcessorHz),
> + KVADDR, &mhz, sizeof(ulong),
> + "res VitalProductData",
> + FAULT_ON_ERROR);
>
> - mhz /= 1000000;
> - }
> - }
> - /* else...well, we don't have OF, or a residual
> structure, so
> - * just print unknown MHz
> - */
> - }
> + mhz = (mhz > 1024) ? mhz >> 20 : mhz;
> + }
> + }
> +
> + if(!mhz) {
> + /* everything else seems to do this the same
> way... */
> + readmem(res +
> + OFFSET(bd_info_bi_intfreq),
> + KVADDR, &mhz, sizeof(ulong),
> + "bd_info bi_intfreq",
> FAULT_ON_ERROR);
> +
> + mhz /= 1000000;
> + }
> + }
> + /* else...well, we don't have OF, or a residual structure,
> so
> + * just print unknown MHz
> + */
>
> return (machdep->mhz = (ulong)mhz);
> }
> diff -Naur a/ppc.c b/ppc.c
> --- a/ppc.c 2010-03-25 10:47:54.000000000 +0530
> +++ b/ppc.c 2010-03-25 10:48:15.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,7 @@
> 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) {
> - /* 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);
> -
> + if(symbol_exists("allnodes")) {
> get_symbol_data("allnodes", sizeof(void *), &node);
> while(node) {
> readmem(node+OFFSET(device_node_type),
> @@ -545,54 +530,53 @@
> }
> if(!properties) {
> /* didn't find the cpu speed for some reason */
> - mhz = 0;
> + return (machdep->mhz = 0);
> }
> }
> - } else {
> - /* for machines w/o OF */
> - /* untested, but in theory this should work on prep machines */
> + }
> + /* for machines w/o OF */
> + /* untested, but in theory this should work on prep machines */
>
> - if (symbol_exists("res")) {
> - get_symbol_data("res", sizeof(void *), &res);
> + if (symbol_exists("res") && !mhz) {
> + get_symbol_data("res", sizeof(void *), &res);
>
> - if (symbol_exists("prep_setup_residual")) {
> - get_symbol_data("prep_setup_residual",
> - sizeof(void *), &prep_setup_res);
> - get_symbol_data("ppc_md", sizeof(void *),
> - &ppc_md);
> - readmem(ppc_md +
> - OFFSET(machdep_calls_setup_residual),
> - KVADDR, &md_setup_res,
> - sizeof(ulong), "ppc_md setup_residual",
> - FAULT_ON_ERROR);
> + if (symbol_exists("prep_setup_residual")) {
> + get_symbol_data("prep_setup_residual",
> + sizeof(void *), &prep_setup_res);
> + get_symbol_data("ppc_md", sizeof(void *),
> + &ppc_md);
> + readmem(ppc_md +
> + OFFSET(machdep_calls_setup_residual),
> + KVADDR, &md_setup_res,
> + sizeof(ulong), "ppc_md setup_residual",
> + FAULT_ON_ERROR);
>
> - if(prep_setup_res == md_setup_res) {
> - /* PREP machine */
> - readmem(res+
> - OFFSET(RESIDUAL_VitalProductData)+
> - OFFSET(VPD_ProcessorHz),
> - KVADDR, &mhz, sizeof(ulong),
> - "res VitalProductData",
> - FAULT_ON_ERROR);
> + if(prep_setup_res == md_setup_res) {
> + /* PREP machine */
> + readmem(res+
> + OFFSET(RESIDUAL_VitalProductData)+
> + OFFSET(VPD_ProcessorHz),
> + KVADDR, &mhz, sizeof(ulong),
> + "res VitalProductData",
> + FAULT_ON_ERROR);
>
> - mhz = (mhz > 1024) ? mhz >> 20 : mhz;
> - }
> + mhz = (mhz > 1024) ? mhz >> 20 : mhz;
> }
> + }
>
> - if(!mhz) {
> - /* everything else seems to do this the same way... */
> - readmem(res +
> - OFFSET(bd_info_bi_intfreq),
> - KVADDR, &mhz, sizeof(ulong),
> - "bd_info bi_intfreq", FAULT_ON_ERROR);
> + if(!mhz) {
> + /* everything else seems to do this the same way... */
> + readmem(res +
> + OFFSET(bd_info_bi_intfreq),
> + KVADDR, &mhz, sizeof(ulong),
> + "bd_info bi_intfreq", FAULT_ON_ERROR);
>
> - mhz /= 1000000;
> - }
> + mhz /= 1000000;
> }
> - /* else...well, we don't have OF, or a residual structure, so
> - * just print unknown MHz
> - */
> }
> + /* else...well, we don't have OF, or a residual structure, so
> + * just print unknown MHz
> + */
>
> return (machdep->mhz = mhz);
> }

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-25-2010, 12:03 PM
Dave Anderson
 
Default Fix display processor speed on ppc/ppc64

----- "Dave Anderson" <anderson@redhat.com> wrote:

>
> Thanks for checking that.
>
> Can you resend this patch as an attachment instead of inlining it?
> You can see below that it has wrapped in several locations, but even
> if I try to resurrect it, I'm still having trouble getting it to
> apply.
>
> Thanks again,
> Dave

In other words, if I fix the 18 line wraps in the ppc64.c section,
I still end up with this on the last chunk:

# patch -p1 --dry-run < /home/boston/anderson/Desktop/processor.patch
patching file ppc64.c
Hunk #3 FAILED at 827.
1 out of 3 hunks FAILED -- saving rejects to file ppc64.c.rej
patching file ppc.c
#

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-25-2010, 03:23 PM
Pavan Naregundi
 
Default Fix display processor speed on ppc/ppc64

On Thu, 2010-03-25 at 09:03 -0400, Dave Anderson wrote:
> ----- "Dave Anderson" <anderson@redhat.com> wrote:
>
> >
> > Thanks for checking that.
> >
> > Can you resend this patch as an attachment instead of inlining it?
> > You can see below that it has wrapped in several locations, but even
> > if I try to resurrect it, I'm still having trouble getting it to
> > apply.
> >
> > Thanks again,
> > Dave
>
> In other words, if I fix the 18 line wraps in the ppc64.c section,
> I still end up with this on the last chunk:
>
> # patch -p1 --dry-run < /home/boston/anderson/Desktop/processor.patch
> patching file ppc64.c
> Hunk #3 FAILED at 827.
> 1 out of 3 hunks FAILED -- saving rejects to file ppc64.c.rej
> patching file ppc.c
> #
>

Attaching the patch.. Patch is generated against crash-5.0.1..

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-25-2010, 04:57 PM
Dave Anderson
 
Default Fix display processor speed on ppc/ppc64

----- "Pavan Naregundi" <pavan@linux.vnet.ibm.com> wrote:
>
> On Thu, 2010-03-25 at 09:03 -0400, Dave Anderson wrote:
>
> >
> > Thanks for checking that.
> >
> > Can you resend this patch as an attachment instead of inlining it?
> > You can see below that it has wrapped in several locations, but even
> > if I try to resurrect it, I'm still having trouble getting it to
> > apply.
>
> Attaching the patch.. Patch is generated against crash-5.0.1..

Got it -- looks good. Queued for the next release.

Thanks,
Dave

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 04:10 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org