HZ undefined in libc headers
by Olaf Hering
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.
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.
Ideally, the core file exports HZ in some way. I see cfq_slice_async is
used to get the HZ value in task_init().
---
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;
18 years, 3 months
crash version 4.0-2.33 is available / vacation notice
by Dave Anderson
> Can you be more specific? The code is certainly not supposed to
> be "effectively commented out":
>
>
Mea culpa -- the function returns NULL first thing,
causing some compilers to rightfully barf...
static char *
x86_xen_kdump_load_page_PAE(ulong kvaddr, char *pgbuf)
{
return NULL;
ulonglong *entry;
ulonglong *up;
ulong mfn;
...
The function was originally a stub, but later I added the
(untested) code, and left the return in place. The VAlinux
guys had furnished me with a non-PAE xen kdump vmcore, and
since there aren't any xen kdump *PAE* dumpfiles in existence
on the planet that I'm aware of, it shouldn't hurt, of course
unless your compiler won't accept it...
Anyway, 4.0-2.33 is available if you need it.
Also, I will be going on vacation -- basically starting right
now -- and won't be back until July 31st. I don't plan on
being internet-visible until then, so if anything comes up
between now and then that needs me, it'll have to wait...
Dave
18 years, 3 months
What's your suggestion on how to get crash dumps on a stock Linus/kernel.org kernel?
by Piet Delaney
Hi Castor, Dave:
Long time since we chatted. I was thinking you guys
might be a good source to a good approach to setting
up for crash dumps. My guess is using kexec in a 2.6.13
or later kernel, kdump, and then gdb+ddd and crash.
I noticed Castor is still involved with LKCD so I thought
I check to see if I'm right. I'm using Amit's kgdb and it's
hanging in there, thought only in limited configurations
with a bit of messing around.
Sounds like you guys are doing nice work on
crash for Xen. I was curious what the state
is for kgdb on Xen.
-piet
--
Piet Delaney
BlueLane Teck
W: (408) 200-5256; piet(a)bluelane.com
H: (408) 243-8872; piet(a)piet.net
18 years, 3 months
RE: [Crash-utility] crash version 4.0-2.32 is available
by Castor Fu
I tried compiling this, and got a break in x86_xen_kdump_load_page_PAE.
The way the code was effectively commented out there was incompatible with gcc 3.3.6.
I'm not sure if the code was meant to be elided.
Thanks for the quick turn on my bug ;-)
-----Original Message-----
From: crash-utility-bounces(a)redhat.com [mailto:crash-utility-bounces@redhat.com]On Behalf Of Dave Anderson
Sent: Wednesday, July 12, 2006 12:41 PM
To: crash-utility(a)redhat.com
Subject: [Crash-utility] crash version 4.0-2.32 is available
- Implemented and tested code to create the xen kdump p2m table from
the mfn value found in the "pfn_to_mfn_frame_list_list" member
contained within the shared per-domain "arch_shared_info" structure,
which is contained within the architecture-neutral "shared_info"
structure. However, the use of this capability will require that:
(1) the xen kdump implementation pass this mfn value in the vmcore
ELF header, and
(2) the crash utility will need additional updating to access this
value from the vmcore ELF header.
The current test version of the xen kdump code passes the dom0 cr3
value in the ELF header, but that only works for xen kernels with
writable pagetables. Using the pfn_to_mfn_frame_list_list mfn will
work for both writable- and shared-pagetable xen kernels.
(anderson(a)redhat.com)
- Support for kernels with no vmalloc addresses, i.e., with an empty
"vmlist", fixing an initialization-time session failure indicating:
"crash: invalid kernel virtual address: 0 type: first vmlist addr"
(moriwaka(a)valinux.co.jp)
- Fix that allows the "wr" command to accept a 64-bit value.
(castor.fu(a)3pardata.com)
- Fix for "vtop" on user/kernel virtual addresses that showed the page
offset value on the "PAGE:" output line on x86 PAE kernels.
(anderson(a)redhat.com)
- Added "rd -x" option to avoid the display of the ASCII translation at
the end of each line. (anderson(a)redhat.com)
- Fix for unnecessary double-printing of the "mount" command header
when a directory argument is referenced by two different vfsmounts.
(harihare(a)vnet.ibm.com) and (shenlinf(a)cn.ibm.com)
- Fix to recognize equivalent directory arguments to the "mount"
command, i.e., "/boot" is the same as "/boot/".
(shenlinf(a)cn.ibm.com)
- Fix for "swap" command that dropped "/dev" from swap device pathnames
in 2.6 kernels. (shenlinf(a)cn.ibm.com)
- Fix for potential segmentation violation when running "bt -f" command
on s390 and s390x. (holzheu(a)de.ibm.com)
- Added a "rd -m " option to read xen machine addresses if they are
accessible; also a general cleanup of the m2p functionality.
(anderson(a)redhat.com)
Download from: http://people.redhat.com/anderson
18 years, 4 months
crash version 4.0-2.32 is available
by Dave Anderson
- Implemented and tested code to create the xen kdump p2m table from
the mfn value found in the "pfn_to_mfn_frame_list_list" member
contained within the shared per-domain "arch_shared_info" structure,
which is contained within the architecture-neutral "shared_info"
structure. However, the use of this capability will require that:
(1) the xen kdump implementation pass this mfn value in the vmcore
ELF header, and
(2) the crash utility will need additional updating to access this
value from the vmcore ELF header.
The current test version of the xen kdump code passes the dom0 cr3
value in the ELF header, but that only works for xen kernels with
writable pagetables. Using the pfn_to_mfn_frame_list_list mfn will
work for both writable- and shared-pagetable xen kernels.
(anderson(a)redhat.com)
- Support for kernels with no vmalloc addresses, i.e., with an empty
"vmlist", fixing an initialization-time session failure indicating:
"crash: invalid kernel virtual address: 0 type: first vmlist addr"
(moriwaka(a)valinux.co.jp)
- Fix that allows the "wr" command to accept a 64-bit value.
(castor.fu(a)3pardata.com)
- Fix for "vtop" on user/kernel virtual addresses that showed the page
offset value on the "PAGE:" output line on x86 PAE kernels.
(anderson(a)redhat.com)
- Added "rd -x" option to avoid the display of the ASCII translation at
the end of each line. (anderson(a)redhat.com)
- Fix for unnecessary double-printing of the "mount" command header
when a directory argument is referenced by two different vfsmounts.
(harihare(a)vnet.ibm.com) and (shenlinf(a)cn.ibm.com)
- Fix to recognize equivalent directory arguments to the "mount"
command, i.e., "/boot" is the same as "/boot/".
(shenlinf(a)cn.ibm.com)
- Fix for "swap" command that dropped "/dev" from swap device pathnames
in 2.6 kernels. (shenlinf(a)cn.ibm.com)
- Fix for potential segmentation violation when running "bt -f" command
on s390 and s390x. (holzheu(a)de.ibm.com)
- Added a "rd -m " option to read xen machine addresses if they are
accessible; also a general cleanup of the m2p functionality.
(anderson(a)redhat.com)
Download from: http://people.redhat.com/anderson
18 years, 4 months
vmlist initialize fix
by Kazuo Moriwaka
Hi Dave,
Crash was stopped with following messages when I try to treat very small
dump image.
It was caused in vmalloc_start initialise when vmalloc is not used
(vmlist == 0). This patch return address 0 for this case.
> <readmem: c02a99a8, KVADDR, "vmlist", 4, (FOE), afdae5f4>
> <readmem: 0, KVADDR, "first vmlist addr", 4, (ROE), afdae5f0>
> crash: invalid kernel virtual address: 0 type: "first vmlist addr"
regards,
--
Kazuo Moriwaka <moriwaka(a)valinux.co.jp>
--- crash-4.0-2.31.orig/memory.c 2006-06-27 23:15:32.000000000 +0900
+++ crash-4.0-2.31/memory.c 2006-07-10 18:24:54.000000000 +0900
@@ -11049,10 +11049,13 @@
ulong vmlist, addr;
get_symbol_data("vmlist", sizeof(void *), &vmlist);
-
- if (!readmem(vmlist+OFFSET(vm_struct_addr), KVADDR, &addr,
- sizeof(void *), "first vmlist addr", RETURN_ON_ERROR))
- non_matching_kernel();
+ if (vmlist != 0x0) {
+ if (!readmem(vmlist+OFFSET(vm_struct_addr), KVADDR, &addr,
+ sizeof(void *), "first vmlist addr", RETURN_ON_ERROR))
+ non_matching_kernel();
+ } else {
+ addr = 0;
+ }
return addr;
}
18 years, 4 months
'wr' command doesn't handle big 64-bit values
by Castor Fu
This is a very small change... It looks like the 'wr' command cannot
take a 64-bit argument since it doesn't use stoll:
:simpsons; rcsdiff -c memory.c
===================================================================
RCS file: RCS/memory.c,v
retrieving revision 1.1
diff -c -r1.1 memory.c
*** memory.c 2006/07/11 01:31:37 1.1
--- memory.c 2006/07/11 01:32:39
***************
*** 1280,1286 ****
addr_entered = TRUE;
if (args[++optind]) {
! value = stol(args[optind], FAULT_ON_ERROR, NULL);
value_entered = TRUE;
switch (size)
--- 1280,1286 ----
addr_entered = TRUE;
if (args[++optind]) {
! value = stoll(args[optind], FAULT_ON_ERROR, NULL);
value_entered = TRUE;
switch (size)
18 years, 4 months
Difference in vtop with and without PAE ?
by Olivier Daudel
Hello,
1) I think, there is a difference in vtop when PAE is not configured and
is configured (kernel 2.6.11)
Any reason ?
I use a very simple program
#include <stdio.h>
#include <stdlib.h>
int var12=12;
main()
{
printf("@var12 : %p\n", &var12);
pause();
}
***************PAE not configured**************
[root@fedora4 ~]# ./essai &
[1] 3196
[root@fedora4 ~]# @var12 : 0x80495a8
[root@fedora4 ~]# crash -s
crash> set 3196
[.]
crash> vtop 0x80495a8
VIRTUAL PHYSICAL
80495a8 1e28c5a8
PAGE DIRECTORY: dda2f000
PGD: dda2f080 => 1f0a7067
PMD: dda2f080 => 1f0a7067
PTE: 1f0a7124 => 1e28c067
PAGE: 1e28c000 <----------------------------
[...]
PAGE is the physical address of the page
***************PAE configured ******************
[root@fedora4 ~]# ./essai &
[2] 7268
[root@fedora4 ~]# @var12 : 0x80495a8
[root@fedora4 ~]# crash -s
crash> set 7268
[.]
crash> vtop 0x80495a8
VIRTUAL PHYSICAL
80495a8 6d925a8
PAGE DIRECTORY: dfe08560
PGD: dfe08560 => 1b223001
PMD: 1b223200 => 187bf067
PTE: 187bf248 => 6d92067
PAGE: 6d925a8 <----------------------------------
[...]
PAGE is really the physical adress of var12
2) Also an option should be nice in rd to see hexadecimal without the
ascii part
With PAE on, if i want du see the 4 references in the PGD, i am not
really interested
in the ascii part ?
crash> rd -64 df7e2b60 4
df7e2b60: 000000001b086001 000000001c932001 .`....... ......
df7e2b70: 000000001f991001 0000000000004001 .........@......
crash> rd -32 df7e2b60 8
df7e2b60: 1b086001 00000000 1c932001 00000000 .`....... ......
df7e2b70: 1f991001 00000000 00004001 00000000 .........@......
18 years, 4 months
[patch 1/1] patch to handle path name properly in "mount" command
by Lin Feng Shen
From: Lin Feng Shen <shenlinf(a)cn.ibm.com>
"mount [devname | dirname]" showes mount points according to the device
name or directory name. Generally speaking, two path names shouldn't be
different due to additional "/", e.g. /distros and /distros/, but it
seems that mount command doesn't handle it properly, e.g.
----------
crash> mount
VFSMOUNT SUPERBLK TYPE DEVNAME DIRNAME
...
c00000000224eb80 c000000002589800 ext3 /dev/sda2 /boot
...
crash> mount /boot
VFSMOUNT SUPERBLK TYPE DEVNAME DIRNAME
c00000000224eb80 c000000002589800 ext3 /dev/sda2 /boot
crash> mount /boot/
crash>
----------
The patch provides pathcmp() replacing STREQ to compare two path names.
It's created against crash-4.0-25.4 in SLES10_RC3.
Signed-off-by: Lin Feng Shen <shenlinf(a)cn.ibm.com>
---
diff -upNr crash-4.0-2.18.orig/defs.h crash-4.0-2.18/defs.h
--- crash-4.0-2.18.orig/defs.h 2006-07-05 23:46:10.000000000 -0400
+++ crash-4.0-2.18/defs.h 2006-07-06 06:30:12.000000000 -0400
@@ -91,6 +91,7 @@
#define STREQ(A, B) (A && B && (strcmp((char *)(A), (char *)(B)) ==
0))
#define STRNEQ(A, B) (A && B && \
(strncmp((char *)(A), (char *)(B), strlen((char *)(B))) == 0))
+#define PATHEQ(A, B) (A && B && (pathcmp((char *)(A), (char *)(B)) ==
0))
#define BZERO(S, N) (memset(S, NULLCHAR, N))
#define BCOPY(S, D, C) (memcpy(D, S, C))
#define BNEG(S, N) (memset(S, 0xff, N))
@@ -2876,6 +2877,7 @@ int empty_list(ulong);
int machine_type(char *);
void command_not_supported(void);
void option_not_supported(int);
+int pathcmp(char* p1, char* p2);
/*
diff -upNr crash-4.0-2.18.orig/filesys.c crash-4.0-2.18/filesys.c
--- crash-4.0-2.18.orig/filesys.c 2006-07-05 23:46:09.000000000
-0400
+++ crash-4.0-2.18/filesys.c 2006-07-06 06:30:22.000000000 -0400
@@ -1193,7 +1193,7 @@ cmd_mount(void)
continue;
for (i = 0; i < c; i++) {
- if (STREQ(arglist[i],
spec_string))
+ if (PATHEQ(arglist[i],
spec_string))
found = TRUE;
}
if (found) {
diff -upNr crash-4.0-2.18.orig/tools.c crash-4.0-2.18/tools.c
--- crash-4.0-2.18.orig/tools.c 2006-07-05 23:46:10.000000000 -0400
+++ crash-4.0-2.18/tools.c 2006-07-06 06:28:01.000000000 -0400
@@ -4328,3 +4328,23 @@ option_not_supported(int c)
error(FATAL, "-%c option not supported on this architecture or
kernel\n",
(char)c);
}
+
+/*
+ * The function to compare two device paths
+ */
+int
+pathcmp(char* p1, char* p2)
+{
+ char c1, c2;
+
+ do {
+ if ((c1 = *p1++) == '/')
+ while(*p1 == '/'){ p1++; }
+ if ((c2 = *p2++) == '/')
+ while(*p2 == '/'){ p2++; }
+ if (c1 == '\0')
+ return ((c2 == '/') && (*p2 == '\0')) ? 0 : c1 -
c2;
+ } while (c1 == c2);
+
+ return ( (c2 == '\0') && (c1 == '/') && (*p1 == '\0')) ? 0 : c1 -
c2;
+}
18 years, 4 months