Olaf Hering wrote:
Upcoming glibc header files have no visible definition of HZ anymore.
A
glibc macro exist to query the current tick rate. This macro will likely
work for all other apps, Unfortunately crash wants to know the HZ value
of the crashed kernel.
Right...
My patch makes the assumption that the dump file is analyzed on a system
similar to the crashed one. I dont know how accurate that is.
If I read the source right, HZ is currently forced to be 1000 which is
not true either. Newer kernels can be configured for 100, 250 and 1000.
Right... (for the most part)
Ideally, the core file exports HZ in some way. I see cfq_slice_async is
used to get the HZ value in task_init().
That's right -- if it exists, it ends up over-writing whatever earlier
(potentially bogus) machdep->hz setting was put in place during
an earlier call to machdep_init().
So that being the case, I don't see using sysconf() as any more
useful than the hardcoded HZ on systems that have it available
when crash is built. I think it might be simpler to keep the current
code in place, except that everywhere "HZ" is used, it should
be surrounded by "#ifdef HZ". That keeps backwards-compatibility
in place, while in newer environments/kernels the cfq_slice_async
check determines the correct value anyway. Also, for example,
I often use 2.4-based machines to look at 2.6 dumpfiles that are
"pre-cfq_slice_async", and using sysconf() would break something
that works now.
As another alternative, perhaps Troy's new IKCONFIG parser could
also be used to read CONFIG_HZ?
Dave
---
alpha.c | 2 +-
ia64.c | 2 +-
ppc.c | 4 +---
ppc64.c | 4 +---
s390.c | 2 +-
s390x.c | 2 +-
x86.c | 4 +---
x86_64.c | 4 +---
8 files changed, 8 insertions(+), 16 deletions(-)
Index: crash-4.0-2.33/alpha.c
===================================================================
--- crash-4.0-2.33.orig/alpha.c
+++ crash-4.0-2.33/alpha.c
@@ -186,7 +186,7 @@ alpha_init(int when)
"irq_desc", NULL, 0);
else
machdep->nr_irqs = 0;
- machdep->hz = HZ;
+ machdep->hz = sysconf(_SC_CLK_TCK);
break;
case POST_INIT:
Index: crash-4.0-2.33/ppc.c
===================================================================
--- crash-4.0-2.33.orig/ppc.c
+++ crash-4.0-2.33/ppc.c
@@ -135,9 +135,7 @@ ppc_init(int when)
"irq_desc", NULL, 0);
else
machdep->nr_irqs = 0;
- machdep->hz = HZ;
- if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
- machdep->hz = 1000;
+ machdep->hz = sysconf(_SC_CLK_TCK);
machdep->section_size_bits = _SECTION_SIZE_BITS;
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
break;
Index: crash-4.0-2.33/ppc64.c
===================================================================
--- crash-4.0-2.33.orig/ppc64.c
+++ crash-4.0-2.33/ppc64.c
@@ -237,9 +237,7 @@ ppc64_init(int when)
*/
BZERO(&machdep->machspec->hwintrstack,
NR_CPUS*sizeof(ulong));
- machdep->hz = HZ;
- if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
- machdep->hz = 1000;
+ machdep->hz = sysconf(_SC_CLK_TCK);
/*
* IRQ stacks are introduced in 2.6 and also configurable.
*/
Index: crash-4.0-2.33/s390.c
===================================================================
--- crash-4.0-2.33.orig/s390.c
+++ crash-4.0-2.33/s390.c
@@ -158,7 +158,7 @@ s390_init(int when)
machdep->nr_irqs = 0; /* TBD */
machdep->vmalloc_start = s390_vmalloc_start;
machdep->dump_irq = s390_dump_irq;
- machdep->hz = HZ;
+ machdep->hz = sysconf(_SC_CLK_TCK);
break;
case POST_INIT:
Index: crash-4.0-2.33/s390x.c
===================================================================
--- crash-4.0-2.33.orig/s390x.c
+++ crash-4.0-2.33/s390x.c
@@ -173,7 +173,7 @@ s390x_init(int when)
machdep->nr_irqs = 0; /* TBD */
machdep->vmalloc_start = s390x_vmalloc_start;
machdep->dump_irq = s390x_dump_irq;
- machdep->hz = HZ;
+ machdep->hz = sysconf(_SC_CLK_TCK);
break;
case POST_INIT:
Index: crash-4.0-2.33/x86.c
===================================================================
--- crash-4.0-2.33.orig/x86.c
+++ crash-4.0-2.33/x86.c
@@ -1775,9 +1775,7 @@ x86_init(int when)
"irq_desc", NULL, 0);
else
machdep->nr_irqs = 224; /* NR_IRQS */
- machdep->hz = HZ;
- if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
- machdep->hz = 1000;
+ machdep->hz = sysconf(_SC_CLK_TCK);
if (machdep->flags & PAE){
machdep->section_size_bits = _SECTION_SIZE_BITS_PAE;
Index: crash-4.0-2.33/x86_64.c
===================================================================
--- crash-4.0-2.33.orig/x86_64.c
+++ crash-4.0-2.33/x86_64.c
@@ -238,9 +238,7 @@ x86_64_init(int when)
machdep->nr_irqs = 224; /* NR_IRQS (at least) */
machdep->vmalloc_start = x86_64_vmalloc_start;
machdep->dump_irq = x86_64_dump_irq;
- machdep->hz = HZ;
- if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
- machdep->hz = 1000;
+ machdep->hz = sysconf(_SC_CLK_TCK);
machdep->section_size_bits = _SECTION_SIZE_BITS;
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
if (XEN()) {
Index: crash-4.0-2.33/ia64.c
===================================================================
--- crash-4.0-2.33.orig/ia64.c
+++ crash-4.0-2.33/ia64.c
@@ -205,7 +205,7 @@ ia64_init(int when)
else if (symbol_exists("_irq_desc"))
ARRAY_LENGTH_INIT(machdep->nr_irqs, irq_desc,
"_irq_desc", NULL, 0);
- machdep->hz = 1024;
+ machdep->hz = sysconf(_SC_CLK_TCK);
ia64_create_memmap();
break;
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility