<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:΢ÈíÑźÚ
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><br> <BR><div id="SkyDrivePlaceholder"></div><div>> Date: Fri, 18 Jan 2013 12:41:38 -0500<br>> From: anderson@redhat.com<br>> To: crash-utility@redhat.com<br>> Subject: Re: [Crash-utility] questions about crash utility<br>> <br>> <br>> <br>> ----- Original Message -----<br>> > <br>> > <br>> > <br>> > <br>> > <br>> > <br>> > > Date: Fri, 18 Jan 2013 10:23:00 -0500<br>> > > From: anderson@redhat.com<br>> > > To: crash-utility@redhat.com<br>> > > Subject: Re: [Crash-utility] questions about crash utility<br>> > > <br>> > > <br>> > > <br>> > > ----- Original Message -----<br>> > > > <br>> > > > <br>> > > > <br>> > > > Hi Dave:<br>> > > > <br>> > > > thank you very much for your detail answer, this really helpful.<br>> > > > please see my inline words. thanks.<br>> > > > <br>> > > > <br>> > > > > Date: Thu, 17 Jan 2013 14:17:36 -0500<br>> > > > > From: anderson@redhat.com<br>> > > > > To: crash-utility@redhat.com<br>> > > > > Subject: Re: [Crash-utility] questions about crash utility<br>> > > > <br>> > > > > The fact that crash gets as far as it does at least means that<br>> > > > > the<br>> > > > > ELF header you've created was deemed acceptable as an ARM<br>> > > > > vmcore.<br>> > > > > However, the error messages re: "cpu_present_mask indicates..."<br>> > > > > and<br>> > > > > "cannot determine base kernel version" indicate that the data<br>> > > > > that was read from the vmcore was clearly not the correct data.<br>> > > > > <br>> > > > > The "cpu_present_mask" value that it read contained too<br>> > > > > many bits -- presuming that the 32-bit ARM processor is<br>> > > > > still limited to only 4 cpus. (looks like upstream that<br>> > > > > CONFIG_NR_CPUS is still 2 in the arch/arm/configs files.)<br>> > > > > <br>> > > > > But more indicative of the wrong data being read is the second<br>> > > > > "cannot determine base kernel version" message, which was<br>> > > > > generated<br>> > > > > after it read the kernel's "init_uts_ns" uts_namespace<br>> > > > > structure.<br>> > > > > After reading it, it sees that the "release" string contains<br>> > > > > non-ASCII data, whereas it should contain the kernel version:<br>> > > > > <br>> > > > > crash> p init_uts_ns<br>> > > > > init_uts_ns = $3 = {<br>> > > > > kref = {<br>> > > > > refcount = {<br>> > > > > counter = 2<br>> > > > > }<br>> > > > > },<br>> > > > > name = {<br>> > > > > sysname =<br>> > > > > "Linux\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",<br>> > > > > nodename =<br>> > > > > "phenom-01.lab.bos.redhat.com\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",<br>> > > > > release =<br>> > > > > "2.6.32-313.el6.x86_64\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",<br>> > > > > version = "#1 SMP Thu Sep 27 16:25:19 EDT<br>> > > > > 2012\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",<br>> > > > > machine =<br>> > > > > "x86_64\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",<br>> > > > > domainname =<br>> > > > > "(none)\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"<br>> > > > > }<br>> > > > > }<br>> > > > > crash><br>> > > > > <br>> > > > > So it appears that you're reading data from the wrong<br>> > > > > locations in the dumpfile. You should be able to verify<br>> > > > > that by bringing up the crash session with the --minimal<br>> > > > > flag like this:<br>> > > > > <br>> > > > > $ crash --minimal vmlinux vmcore<br>> > > > > <br>> > > > > That will bypass most of the initialization, including all<br>> > > > > readmem() calls of the vmcore. Then do this:<br>> > > > > <br>> > > > > crash> rd linux_banner 20<br>> > > > > ffffffff818000a0: 65762078756e694c 2e33206e6f697372 Linux<br>> > > > > version<br>> > > > > 3.<br>> > > > > ffffffff818000b0: 63662e312d312e35 365f3638782e3731<br>> > > > > 5.1-1.fc17.x86_6<br>> > > > > ffffffff818000c0: 626b636f6d282034 69756240646c6975<br>> > > > > 4(mockbuild@bui<br>> > > > > ffffffff818000d0: 2e33322d6d76646c 6465662e32786870<br>> > > > > ldvm-23.phx2.fed<br>> > > > > ffffffff818000e0: 656a6f727061726f 202967726f2e7463<br>> > > > > oraproject.org)<br>> > > > > ffffffff818000f0: 7265762063636728 372e34206e6f6973 (gcc<br>> > > > > version 4.7<br>> > > > > ffffffff81800100: 303231303220302e 6465522820373035 .0 20120507<br>> > > > > (Red<br>> > > > > ffffffff81800110: 372e342074614820 47282029352d302e Hat<br>> > > > > 4.7.0-5) (G<br>> > > > > ffffffff81800120: 3123202920294343 75685420504d5320 CC) ) #1<br>> > > > > SMP Thu<br>> > > > > ffffffff81800130: 3120392067754120 2033343a30353a37 Aug 9<br>> > > > > 17:50:43<br>> > > > > crash> rd -a linux_banner<br>> > > > > ffffffff818000a0: Linux version 3.5.1-1.fc17.x86_64<br>> > > > > (mockbuild@buildvm-23.phx2<br>> > > > > ffffffff818000dc: .fedoraproject.org) (gcc version 4.7.0<br>> > > > > 20120507 (Red Hat 4.7<br>> > > > > ffffffff81800118: .0-5) (GCC) ) #1 SMP Thu Aug 9 17:50:43 UTC<br>> > > > > 2012<br>> > > > > crash><br>> > > > > <br>> > > > > I'm guessing that you will not see a string starting with<br>> > > > > "Linux version"<br>> > > > > with your dumpfile as shown above.<br>> > > > > <br>> > > > > If that's the case, then it's clear that the readmem() function<br>> > > > > is ultimately<br>> > > > > reading from the wrong vmcore file offset.<br>> > > > > <br>> > > > > Here's what you can try doing. Taking the linux_banner example<br>> > > > > above,<br>> > > > > you can check where in the dumpfile it's reading from by<br>> > > > > setting the debug<br>> > > > > flag, before doing a simple read -- like this example on an ARM<br>> > > > > dumpfile:<br>> > > > > <br>> > > > > crash> set debug 8<br>> > > > > debug: 8<br>> > > > > crash> rd linux_banner<br>> > > > > <addr: c033ea10 count: 1 flag: 488 (KVADDR)><br>> > > > > <readmem: c033ea10, KVADDR, "32-bit KVADDR", 4, (FOE),<br>> > > > > ff94f048><br>> > > > > <read_kdump: addr: c033ea10 paddr: 33ea10 cnt: 4><br>> > > > > read_netdump: addr: c033ea10 paddr: 33ea10 cnt: 4 offset:<br>> > > > > 33f088<br>> > > > > c033ea10: 756e694c Linu<br>> > > > > crash><br>> > > > > <br>> > > > > The linux_banner is at virtual address c033ea10 (addr). First<br>> > > > > it gets translated<br>> > > > > into physical address 33ea10 (paddr). Then that paddr is<br>> > > > > translated into the<br>> > > > > vmcore file offset of 33f088. It lseeks to vmcore file offset<br>> > > > > 33f088 and<br>> > > > > reads 4 bytes, which contain "756e694c", or the first 4 bytes<br>> > > > > of the<br>> > > > > "Linux version ..." string.<br>> > > > > <br>> > > > > Note that if I subtract the physical address from vmcore file<br>> > > > > offset<br>> > > > > I get this:<br>> > > > > <br>> > > > > crash> eval 33f088 - 33ea10<br>> > > > > hexadecimal: 678<br>> > > > > decimal: 1656<br>> > > > > octal: 3170<br>> > > > > binary: 00000000000000000000011001111000<br>> > > > > crash><br>> > > > > <br>> > > > > which would put physical address 0 at a vmcore file offset of<br>> > > > > 0x678, and<br>> > > > > therefore implying that that the ELF header comprises the first<br>> > > > > 0x678 bytes.<br>> > > > > And looking at the vmcore, that can be verified:<br>> > > > > <br>> > > > <br>> > > > yes you are right, here i get the result as below:<br>> > > > crash> set debug 8<br>> > > > debug: 8<br>> > > > crash> rd linux_banner<br>> > > > <addr: c065a071 count: 1 flag: 488 (KVADDR)><br>> > > > <readmem: c065a071, KVADDR, "32-bit KVADDR", 4, (FOE), ffdf297c><br>> > > > <read_kdump: addr: c065a071 paddr: 85a071 cnt: 4><br>> > > > read_netdump: addr: c065a071 paddr: 85a071 cnt: 4 offset: 65a0e5<br>> > > > c065a071: 03e59130 0...<br>> > > > <br>> > > > the virtual address is 0xc065a071 , and the physical address is<br>> > > > 0x85a071 , and the offset is 0x65a0e5.<br>> > > > my elf header is 116 bytes long, 0x65a0e5 - 116=0x65A071, which<br>> > > > has a<br>> > > > gap 0x00200000 with the physical address 0x85a071.<br>> > > > <br>> > > > <br>> > > > > $ readelf -a vmcore<br>> > > > > ELF Header:<br>> > > > > Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00<br>> > > > > Class: ELF32<br>> > > > > Data: 2's complement, little endian<br>> > > > > Version: 1 (current)<br>> > > > > OS/ABI: UNIX - System V<br>> > > > > ABI Version: 0<br>> > > > > Type: CORE (Core file)<br>> > > > > Machine: ARM<br>> > > > > Version: 0x1<br>> > > > > Entry point address: 0x0<br>> > > > > Start of program headers: 52 (bytes into file)<br>> > > > > Start of section headers: 0 (bytes into file)<br>> > > > > Flags: 0x0<br>> > > > > Size of this header: 52 (bytes)<br>> > > > > Size of program headers: 32 (bytes)<br>> > > > > Number of program headers: 3<br>> > > > > Size of section headers: 0 (bytes)<br>> > > > > Number of section headers: 0<br>> > > > > Section header string table index: 0<br>> > > > > <br>> > > > > There are no sections in this file.<br>> > > > > <br>> > > > > There are no sections to group in this file.<br>> > > > > <br>> > > > > Program Headers:<br>> > > > > Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align<br>> > > > > NOTE 0x000094 0x00000000 0x004e345c 0x005e4 0x005e4 0<br>> > > > > LOAD 0x000678 0xc0000000 0x00000000 0x5600000 0x5600000 RWE 0<br>> > > > > LOAD 0x5600678 0xc5700000 0x05700000 0x100000 0x100000 RWE 0<br>> > > > > ...<br>> > > > > <br>> > > > > Note that the "Offset" value of the first PT_LOAD segment has a<br>> > > > > file offset<br>> > > > > value of 0x678.<br>> > > > > <br>> > > > <br>> > > > here i got the result as below:<br>> > > > Program Headers:<br>> > > > Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align<br>> > > > NOTE 0x000000 0x00000000 0x00000000 0x00000 0x00000 0<br>> > > > LOAD 0x000074 0xc0000000 0x00200000 0x2fe00000 0x2fe00000 RWE 0<br>> > > > <br>> > > > so the problem is i don't understand the elf header meaning<br>> > > > accurately. if i modify code as below, everything is ok for me:<br>> > > > <br>> > > > offset += sizeof(struct elf_phdr);<br>> > > > phdr->p_offset = offset+0x00200000;<br>> > > > phdr->p_vaddr = 0xc0000000;<br>> > > > phdr->p_paddr = 0x00200000;<br>> > > > phdr->p_filesz = phdr->p_memsz = = MEMSIZE-0x00200000;<br>> > > > <br>> > > > <br>> > > > although my modification can make crash utility work well, i want<br>> > > > to<br>> > > > know exactly whether i am doing the right thing.<br>> > > > 1. our platform has the ddr address from physical address 0x0.<br>> > > > 2. when compiling Linux kernel, our platform set in .config file:<br>> > > > CONFIG_PHYS_OFFSET=0x00200000<br>> > > > 3. when Kernel crash, all ddr content will be dumped, from<br>> > > > address<br>> > > > 0x0~768MB. but kernel data starts from 0x00200000 actually.<br>> > > > <br>> > > > my questions are:<br>> > > > 1. whether my setting of ELF header is correct this time? the<br>> > > > offset,<br>> > > > paddr, and p_memsz?<br>> > > <br>> > > I'm not really sure. Even though you've got it to work OK, I don't<br>> > > understand your new phdr->p_offset and phdr->p_filesz/phdr->p_memsz<br>> > > settings. The phdr->p_offset value typically points to the beginning<br>> > > of the physical memory segment, which in your case, would be at physical<br>> > > address 0x0 at file offset 0x74. And the phdr->p_filesz/phdr->p_memsz<br>> > > values are typically equal to the full size of the physical memory<br>> > > segment (MEMSIZE).<br>> > > <br>> > <br>> > if i set p_offset to 0, the file offset seems not correct. for example, when i try to read<br>> > linux_banner, i got below result:<br>> > crash> set debug 8<br>> > debug: 8<br>> > crash> rd linux_banner<br>> > <addr: c065a071 count: 1 flag: 488 (KVADDR)><br>> > <readmem: c065a071, KVADDR, "32-bit KVADDR", 4, (FOE), ffdf297c><br>> > <read_kdump: addr: c065a071 paddr: 85a071 cnt: 4><br>> > read_netdump: addr: c065a071 paddr: 85a071 cnt: 4 offset: 65a0e5<br>> > c065a071: 03e59130 0...<br>> <br>> No, the phdr->p_offset should *not* be 0 -- it is a file pointer value that<br>> should point to the beginning of the physical memory dump in the vmcore.<br>> So it should be equal to the header size, or 0x74 in your case.  <br>> <br>> I think maybe your vmcore is being recognized as a NETDUMP_ELF32 instead<br>> of a KDUMP_ELF32?  What does "help -n" show on your system?  On my ELF ARM <br>> vmcore, it starts like this:<br>> <br>>  crash> help -n<br>>  vmcore_data: <br>>                   flags: a0 (KDUMP_LOCAL|KDUMP_ELF32) <br>>                    ndfd: 6<br>>                     ofp: a7599e8<br>>             header_size: 1656<br>>    num_pt_load_segments: 2<br>>      pt_load_segment[0]:<br>>             file_offset: 678<br>>              phys_start: 0<br>>                phys_end: 5600000<br>>               zero_fill: 0<br>>      pt_load_segment[1]:<br>>             file_offset: 5600678<br>>              phys_start: 5700000<br>>                phys_end: 5800000<br>>               zero_fill: 0<br>>   ...<br>> <br>> where the pt_load_segment's data shown above come from its 2 PT_LOAD segments:<br>> <br>>  $ readelf -a vmcore<br>>  ...<br>>  Program Headers:<br>>    Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align<br>>    NOTE           0x000094 0x00000000 0x004e345c 0x005e4 0x005e4     0<br>>    LOAD           0x000678 0xc0000000 0x00000000 0x5600000 0x5600000 RWE 0<br>>    LOAD           0x5600678 0xc5700000 0x05700000 0x100000 0x100000 RWE 0<br>>  ...<br>> <br>> But if your vmcore is being recognized as a NETUMP_ELF32, it will<br>> ignore the phdr->p_offset value, and simply do this in read_netdump():<br>> <br>> read_netdump(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)<br>> {<br>>         off_t offset;<br>>         struct pt_load_segment *pls;<br>>         int i;<br>> <br>>         offset = 0;<br>> <br>>         /*<br>>          *  The Elf32_Phdr has 32-bit fields for p_paddr, p_filesz and<br>>          *  p_memsz, so for now, multiple PT_LOAD segment support is<br>>          *  restricted to 64-bit machines for netdump/diskdump vmcores.<br>>          *  However, kexec/kdump has introduced the optional use of a<br>>          *  64-bit ELF header for 32-bit processors.<br>>          */<br>>         switch (DUMPFILE_FORMAT(nd->flags))<br>>         {<br>>         case NETDUMP_ELF32:<br>>                 offset = (off_t)paddr + (off_t)nd->header_size;<br>>                 break;<br>> <br>> But it should be a KDUMP_ELF32 format, which uses the pt_load_segment<br>> data:<br>> <br>>         case NETDUMP_ELF64:<br>>         case KDUMP_ELF32:<br>>         case KDUMP_ELF64:<br>>                 if (nd->num_pt_load_segments == 1) {<br>>                         offset = (off_t)paddr + (off_t)nd->header_size -<br>>                                 (off_t)nd->pt_load_segments[0].phys_start;<br>>                         break;<br>>                 }<br>> <br>>                 for (i = offset = 0; i < nd->num_pt_load_segments; i++) {<br>>                         pls = &nd->pt_load_segments[i];<br>>                         if ((paddr >= pls->phys_start) &&<br>>                             (paddr < pls->phys_end)) {<br>>                                 offset = (off_t)(paddr - pls->phys_start) +<br>>                                         pls->file_offset;<br>>                                 break;<br>>                         }<br>>                         if (pls->zero_fill && (paddr >= pls->phys_end) &&<br>>                             (paddr < pls->zero_fill)) {<br>>                                 memset(bufptr, 0, cnt);<br>>                                 if (CRASHDEBUG(8))<br>>                                         fprintf(fp, "read_netdump: zero-fill: "<br>>                                             "addr: %lx paddr: %llx cnt: %d\n",<br>>                                                 addr, (ulonglong)paddr, cnt);<br>>                                 return cnt;<br>>                         }<br>>                 }<br>> <br>> If your vmcore is being seen as a NETDUMP_ELF32, then perhaps that's why<br>> your strange ELF header settings are "working".  But it should be created<br>> such that it's recognized as a KDUMP_ELF32.<br>> <br>> If your vmcore is being seen as a KDUMP_ELF32, then it's not entirely clear<br>> to me why your ELF header settings work OK.  But I suppose if everything is <br>> working OK, just leave it as is, and go about your business...<br>> </div><div>my information is as below, it is KDUMP_ELF32:</div><div> </div><div>vmcore_data: <br>  flags: a0 (KDUMP_LOCAL|KDUMP_ELF32) <br>  ndfd: 3<br>  ofp: 98442d0<br>   header_size: 2097268<br>   num_pt_load_segments: 1<br>   pt_load_segment[0]:<br>   file_offset: 200074<br>   phys_start: 200000<br>   phys_end: 30000000<br>   zero_fill: 0<br>   elf_header: b7656008<br>   elf32: b7656008<br>   notes32: b765603c<br>   load32: b765605c<br></div><div>anyway, i can just ignore this issue right now.</div><div>the remaining issue is how to make my procedures automatically.</div><div>my purpose is to get trace ring buffer from kernel dump file and create a new</div><div>file which name is like trace_$date.txt. the $date should be the time this text file</div><div>is generated.</div><div>     what i am doing now is to create a .crashrc file in the ./ directory, and try to </div><div>use file to make everything automatically. i need to make below procedures</div><div>automatically:</div><div>    1. load trace.so automatically. it is ok now.</div><div>    2. read current date. it is ok now.</div><div>    3. dump the kernel trace ring buffer into new text file the name of which contains current date.  cannot do this now.</div><div>    4. exit crash utility automatically. it is ok now.</div><div> </div><div>my .crashrc is as below, i don't know how to do the step 3 above:</div><div> </div><div>----------------------  script start -------------------------------------------------------</div><div> </div><div>echo $(date '+%Y%m%d_%H%M%S')   <------ it is ok</div><div><br>#cur=$(date '+%Y%m%d_%H%M%S')  <----- it failed to use variable to store date<br>#echo $cur                                             <------it failed</div><div><br>extend trace.so                                       <------ it is ok</div><div><br>trace report >./report_test.txt           <------- to dump to a file which uses fixed file</div><div>                                                                                      name, it is ok.</div><div><br>trace report >./trace_$(date '+%Y%m%d_%H%M%S').txt  <--- it failed when </div><div><br>exit<br>---------------------- script end -----------------------------------------------</div><div> </div><div>please help, thanks.</div><div> </div><div><br>> > virtual address is c065a071, physical address is 85a071, this is ok.<br>> > but the tool said the file offset is 65a0e5, which is not correct.  because my dump binary<br>> > contains ddr content from 0x0, the data of physical address 85a071 should be at dump file<br>> > offset 85a071+74= 85a0e5, rather than 65a0e5.<br>> > <br>> > so i guess the elf header should be modified to set phdr->p_offset =header size + 0x00200000.<br>> > i don't know how to tell crash utility it should add value 0x00200000 when read dump file.<br>> > <br>> > > I only have one ELF ARM dumpfile sample, but it does not have any<br>> > > physical offset:<br>> > > <br>> > > crash> vtop c0000000<br>> > > VIRTUAL PHYSICAL<br>> > > c0000000 0<br>> > > <br>> > > PAGE DIRECTORY: c0004000<br>> > > PGD: c0007000 => 1140e<br>> > > PMD: c0007000 => 1140e<br>> > > PAGE: 0 (1MB)<br>> > > <br>> > > <br>> > > PAGE PHYSICAL MAPPING INDEX CNT FLAGS<br>> > > c042d000 0 0 0 0 80000<br>> > > crash><br>> > > <br>> > > Does "vtop c0000000" work as expected on your vmcore?<br>> > <br>> > yes i think the vtop command works well on my side:<br>> > <br>> > crash> vtop c0000000<br>> > VIRTUAL PHYSICAL<br>> > c0000000 200000<br>> > PAGE DIRECTORY: c0004000<br>> > PGD: c0007000 => 21140e<br>> > PMD: c0007000 => 21140e<br>> > PAGE: 200000 (1MB)<br>> > <br>> > PAGE PHYSICAL MAPPING INDEX CNT FLAGS<br>> > c1370800 200000 e5d43061 42 1 80068<br>> > <br>> > <br>> > > <br>> > > Also, can you read the last physical page of memory? For example,<br>> > > on<br>> > > my ARM dump, I can check that by doing this:<br>> > > <br>> > > crash> kmem -p | tail -5<br>> > > c04dcf60 57fb000 0 0 1 400<br>> > > c04dcf80 57fc000 0 0 1 400<br>> > > c04dcfa0 57fd000 0 0 1 400<br>> > > c04dcfc0 57fe000 0 0 1 400<br>> > > c04dcfe0 57ff000 0 0 1 400<br>> > > crash> rd -p 57ff000<br>> > > 57ff000: ef9f0000 ....<br>> > > crash><br>> > > <br>> > <br>> > result is as below:<br>> > <br>> > crash> kmem -p |tail -5<br>> > c19b934c 2ccfb000 0 0 1 400<br>> > c19b9370 2ccfc000 0 0 1 400<br>> > c19b9394 2ccfd000 0 0 1 400<br>> > c19b93b8 2ccfe000 0 0 1 400<br>> > c19b93dc 2ccff000 0 0 1 400<br>> > <br>> > crash> rd -p 2ccff000<br>> > 2ccff000: fffdffff ....<br>> > <br>> > <br>> > > Also, can you confirm that your kernel's symbol list starts<br>> > > at c0000000, i.e., something like this:<br>> > > <br>> > > crash> sym -l<br>> > > c0004000 (A) swapper_pg_dir<br>> > > c0008000 (t) .init<br>> > > c0008000 (T) __init_begin<br>> > > c0008000 (T) _sinittext<br>> > > c0008000 (T) _stext<br>> > > c0008000 (T) stext<br>> > > c0008040 (t) __create_page_tables<br>> > > c00080e4 (t) __enable_mmu_loc<br>> > > c00080f0 (t) __error_a<br>> > > c00080f4 (t) __lookup_machine_type<br>> > > c0008128 (t) __lookup_machine_type_data<br>> > > ...<br>> > > <br>> > > I just want to make sure that the kernel symbols actually start<br>> > > at c000000, and not c2000000.<br>> > > <br>> > <br>> > yes, the symbols actually start from c0000000:<br>> > <br>> > crash> sym -l<br>> > c0004000 (A) swapper_pg_dir<br>> > c0005fb8 (A) __crc_scsi_host_get<br>> > c0008000 (t) .head.text<br>> > c0008000 (T) _text<br>> > c0008000 (T) stext<br>> > c0008050 (t) __create_page_tables<br>> > c0008104 (t) __turn_mmu_on_loc<br>> > c0008110 (T) secondary_startup<br>> > <br>> > <br>> > > > 2. i am wondering how does crash utility translate virtual<br>> > > > address to<br>> > > > physical address before and after it get the kernel page table?<br>> > > > before get kernel page table, does it calculate as :<br>> > > > (virtual_addr -<br>> > > > p_vaddr + p_paddr) ? after get kernel page table, does it walk<br>> > > > through the page table and find out the real physical address<br>> > > > accordingly?<br>> > > <br>> > > For kernel unity-mapped kernel virtual addresses, it's not<br>> > > necessary<br>> > > to walk the page tables. It simply does this:<br>> > > <br>> > > #define VTOP(X) \<br>> > > ((unsigned<br>> > > long)(X)-(machdep->kvbase)+(machdep->machspec->phys_base))<br>> > > <br>> > > You can check your machdep->kvbase and machdep->machspec->phys_base<br>> > > values by entering "help -m", for example:<br>> > > <br>> > > crash> help -m | grep -e kvbase -e phys_base<br>> > > kvbase: c0000000<br>> > > phys_base: 0<br>> > > crash><br>> > > <br>> > <br>> > my result is as below, should be ok:<br>> > <br>> > crash> help -m | grep -e kvbase -e phys_base<br>> > kvbase: c0000000<br>> > phys_base: 200000<br>> > <br>> > <br>> > > Certainly vmalloc (and user-space) virtual addresses require a page<br>> > > table walkthough, but the arm_kvtop() function does this:<br>> > > <br>> > > static int<br>> > > arm_kvtop(struct task_context *tc, ulong kvaddr, physaddr_t *paddr,<br>> > > int verbose)<br>> > > {<br>> > > if (!IS_KVADDR(kvaddr))<br>> > > return FALSE;<br>> > > <br>> > > if (!vt->vmalloc_start) {<br>> > > *paddr = VTOP(kvaddr);<br>> > > return TRUE;<br>> > > }<br>> > > <br>> > > if (!IS_VMALLOC_ADDR(kvaddr)) {<br>> > > *paddr = VTOP(kvaddr); <=== unity-mapped kernel virtual addresses<br>> > > if (!verbose)<br>> > > return TRUE;<br>> > > }<br>> > > <br>> > > return arm_vtop(kvaddr, (ulong *)vt->kernel_pgd[0], paddr,<br>> > > verbose);<br>> > > }<br>> > > <br>> > > and where vmalloc addresses fall through and arm_vtop() is called<br>> > > to walk<br>> > > the page tables.<br>> > > <br>> > > However, you can translate unity-mapped addresses using the kernel<br>> > > page tables<br>> > > with the "vtop" command, as shown in the "vtop c000000" example<br>> > > above.<br>> > > <br>> > > > 3. my real purpose is to get the ftrace content from dump file by<br>> > > > crash utility , but seem the command trace is not for this case,<br>> > > > do<br>> > > > i need to compile the extension "trace" of crash utility? is<br>> > > > there<br>> > > > any guide to follow?<br>> > > <br>> > > That's correct. You can do this:<br>> > > <br>> > > $ wget http://people.redhat.com/anderson/crash-6.1.2.tar.gz<br>> > > ...<br>> > > $ tar xvzmf crash-6.1.2.tar.gz<br>> > > ...<br>> > > $ cd crash-6.1.2<br>> > > $ make<br>> > > ...<br>> > > $ make extensions<br>> > > ...<br>> > > $ ./crash vmlinux vmcore<br>> > > ...<br>> > > crash> extend trace.so<br>> > > ./extensions/trace.so: shared object loaded<br>> > > crash> help trace<br>> > > ...<br>> > <br>> > i have made the trace extension work, however, trace show need trace-cmd,<br>> > but in my ubuntu PC, run "sudo apt-get install trace-cmd", i get below error:<br>> > E: Couldn't find package trace-cmd<br>> > <br>> > by Google, i found that there is a project<br>> > git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git.<br>> > maybe i can only compile this tool and use it ?<br>> > <br>> <br>> That should work:<br>> <br>>  $ rpm -qi trace-cmd<br>>  Name        : trace-cmd<br>>  Version     : 1.2<br>>  Release     : 4.20120606git8266dff.fc17<br>>  Architecture: x86_64<br>>  Install Date: Mon 26 Nov 2012 03:22:24 PM EST<br>>  Group       : Development/Tools<br>>  Size        : 298546<br>>  License     : GPLv2 and LGPLv2<br>>  Signature   : RSA/SHA256, Sun 16 Sep 2012 01:37:17 PM EDT, Key ID 50e94c991aca3465<br>>  Source RPM  : trace-cmd-1.2-4.20120606git8266dff.fc17.src.rpm<br>>  Build Date  : Thu 13 Sep 2012 05:34:55 PM EDT<br>>  Build Host  : buildvm-04.phx2.fedoraproject.org<br>>  Relocations : (not relocatable)<br>>  Packager    : Fedora Project<br>>  Vendor      : Fedora Project<br>>  URL         : http://git.kernel.org/?p=linux/kernel/git/rostedt/trace-cmd.git;a=summary<br>>  Summary     : A user interface to Ftrace<br>>  Description :<br>>  trace-cmd is a user interface to Ftrace. Instead of needing to use the<br>>  debugfs directly, trace-cmd will handle of setting of options and<br>>  tracers and will record into a data file.<br>>  $ <br>> <br>> Dave<br>>  <br>> <br>> --<br>> Crash-utility mailing list<br>> Crash-utility@redhat.com<br>> https://www.redhat.com/mailman/listinfo/crash-utility<br></div>                                      </div></body>
</html>