Karlsson, Jan | 21 Oct 12:46 2014

Crash in crash

Hi Dave

 

I have a vmcore file for ARM64 that crashes Crash during startup. The core file is created at a hardware watchdog (I believe) so there is no panic message or something similar in the log.

 

This is the printout from Crash running under gdb, after the copyrights and config information:

 

please wait... (determining panic task)        

Program received signal SIGSEGV, Segmentation fault.

0x000000000047ed40 in tgid_quick_search (tgid=5040) at memory.c:4114

4114                                              if (tgid == last->tgid) {

 

(gdb) bt

#0  0x000000000047ed40 in tgid_quick_search (tgid=5040) at memory.c:4114

#1  0x000000000047f046 in get_task_mem_usage (task=18446743799318107136, tm=0x7fffffff6f40)

    at memory.c:4186

#2  0x000000000047c679 in vm_area_dump (task=18446743799318107136, flag=10, vaddr=0, ref=0x0)

    at memory.c:3671

#3  0x000000000047ec08 in in_user_stack (task=18446743799318107136, vaddr=0) at memory.c:4063

#4  0x00000000004fd9fe in arm64_get_dumpfile_stackframe (frame=<synthetic pointer>,

    bt=<optimized out>) at arm64.c:1077

#5  arm64_get_stack_frame (bt=0x7fffffffc690, pcp=0x7fffffff9560, spp=0x7fffffff9568)

    at arm64.c:1103

#6  0x00000000004de409 in back_trace (bt=0x7fffffffc690) at kernel.c:2533

#7  0x00000000004d1563 in foreach (fd=0x7fffffffc7c0) at task.c:6161

#8  0x00000000004d2bbd in panic_search () at task.c:6425

#9  0x00000000004d4454 in get_panic_context () at task.c:5364

#10 task_init () at task.c:491

#11 0x000000000046146e in main_loop () at main.c:801

#12 0x00000000006467a3 in captured_command_loop (data=<optimized out>) at main.c:258

#13 0x000000000064535b in catch_errors (func=0x646790 <captured_command_loop>, func_args=0x0,

    errstring=0x873235 "", mask=6) at exceptions.c:557

#14 0x0000000000647726 in captured_main (data=<optimized out>) at main.c:1064

#15 0x000000000064535b in catch_errors (func=0x646aa0 <captured_main>, func_args=0x7fffffffe030,

    errstring=0x873235 "", mask=6) at exceptions.c:557

#16 0x0000000000647a84 in gdb_main (args=<optimized out>) at main.c:1079

#17 0x0000000000647abe in gdb_main_entry (argc=<optimized out>, argv=<optimized out>)

    at main.c:1099

#18 0x000000000045f61f in main (argc=3, argv=0x7fffffffe188) at main.c:758

 

(gdb) p tt->last_tgid

$1 = (struct tgid_context *) 0x0

 

Source code for tgid_quick_search:

static struct tgid_context *

tgid_quick_search(ulong tgid)

{

                           struct tgid_context *last, *next;

 

                           tt->tgid_searches++;

 

                           last = tt->last_tgid;

                           if (tgid == last->tgid) {

                                                       tt->tgid_cache_hits++;

                                                       return last;

                           }

  ....

}

 

So 'last' becomes 0 which causes the crash.

 

After some more investigation I have seen that "tt->last_tgid" is initialized in function sort_tgid_array in task.c, but that function seems to be called at a later stage.

 

By adding a line in tgid_quick_search:

 

static struct tgid_context *

tgid_quick_search(ulong tgid)

{

                           struct tgid_context *last, *next;

 

                           tt->tgid_searches++;

 

                           if (tt->last_tgid == 0) sort_tgid_array(); // added line

                           last = tt->last_tgid;

                           if (tgid == last->tgid) {

                                                       tt->tgid_cache_hits++;

                                                       return last;

                           }

  ...

 

I can run Crash on this core file. However I do not know if this is the best way to fix the problem.

 

Jan

 

Jan Karlsson

Senior Software Engineer

System Assurance

 

Sony Mobile Communications

Tel: +46 703 062 174

jan.karlsson <at> sonymobile.com

 

sonymobile.com

 

 

<div><div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi Dave<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have a vmcore file for ARM64 that crashes Crash during startup. The core file is created at a hardware watchdog (I believe) so there is no panic message or something similar in the log.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">This is the printout from Crash running under gdb, after the copyrights and config information:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">please wait... (determining panic task)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Program received signal SIGSEGV, Segmentation fault.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">0x000000000047ed40 in tgid_quick_search (tgid=5040) at memory.c:4114<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">4114&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (tgid == last-&gt;tgid) {<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">(gdb) bt<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#0&nbsp; 0x000000000047ed40 in tgid_quick_search (tgid=5040) at memory.c:4114<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#1&nbsp; 0x000000000047f046 in get_task_mem_usage (task=18446743799318107136, tm=0x7fffffff6f40)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp; at memory.c:4186<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#2&nbsp; 0x000000000047c679 in vm_area_dump (task=18446743799318107136, flag=10, vaddr=0, ref=0x0)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp; at memory.c:3671<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#3&nbsp; 0x000000000047ec08 in in_user_stack (task=18446743799318107136, vaddr=0) at memory.c:4063<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#4&nbsp; 0x00000000004fd9fe in arm64_get_dumpfile_stackframe (frame=&lt;synthetic pointer&gt;, <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;bt=&lt;optimized out&gt;) at arm64.c:1077<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#5&nbsp; arm64_get_stack_frame (bt=0x7fffffffc690, pcp=0x7fffffff9560, spp=0x7fffffff9568)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp; at arm64.c:1103<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#6&nbsp; 0x00000000004de409 in back_trace (bt=0x7fffffffc690) at kernel.c:2533<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#7&nbsp; 0x00000000004d1563 in foreach (fd=0x7fffffffc7c0) at task.c:6161<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#8&nbsp; 0x00000000004d2bbd in panic_search () at task.c:6425<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#9&nbsp; 0x00000000004d4454 in get_panic_context () at task.c:5364<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#10 task_init () at task.c:491<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#11 0x000000000046146e in main_loop () at main.c:801<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#12 0x00000000006467a3 in captured_command_loop (data=&lt;optimized out&gt;) at main.c:258<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#13 0x000000000064535b in catch_errors (func=0x646790 &lt;captured_command_loop&gt;, func_args=0x0, <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;errstring=0x873235 "", mask=6) at exceptions.c:557<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#14 0x0000000000647726 in captured_main (data=&lt;optimized out&gt;) at main.c:1064<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#15 0x000000000064535b in catch_errors (func=0x646aa0 &lt;captured_main&gt;, func_args=0x7fffffffe030, <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;errstring=0x873235 "", mask=6) at exceptions.c:557<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#16 0x0000000000647a84 in gdb_main (args=&lt;optimized out&gt;) at main.c:1079<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#17 0x0000000000647abe in gdb_main_entry (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp; at main.c:1099<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">#18 0x000000000045f61f in main (argc=3, argv=0x7fffffffe188) at main.c:758<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">(gdb) p tt-&gt;last_tgid<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">$1 = (struct tgid_context *) 0x0<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Source code for tgid_quick_search:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">static struct tgid_context *<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">tgid_quick_search(ulong tgid)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct tgid_context *last, *next;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tt-&gt;tgid_searches++;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last = tt-&gt;last_tgid;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (tgid == last-&gt;tgid) {<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tt-&gt;tgid_cache_hits++;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return last;<p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></p>
<p class="MsoNormal">&nbsp; ....<p></p></p>
<p class="MsoNormal"><span lang="EN-US">}<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">So 'last' becomes 0 which causes the crash.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">After some more investigation I have seen that "tt-&gt;last_tgid" is initialized in function sort_tgid_array in task.c, but that function seems to be called at a later stage.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">By adding a line in tgid_quick_search:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">static struct tgid_context *<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">tgid_quick_search(ulong tgid)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct tgid_context *last, *next;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tt-&gt;tgid_searches++;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (tt-&gt;last_tgid == 0) sort_tgid_array(); // added line<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last = tt-&gt;last_tgid;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (tgid == last-&gt;tgid) {<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tt-&gt;tgid_cache_hits++;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return last;<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp; ...<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I can run Crash on this core file. However I do not know if this is the best way to fix the problem.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jan<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jan Karlsson</span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Senior Software Engineer<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">System Assurance<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Sony Mobile Communications<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Tel: +46 703 062 174<p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><a href="mailto:Firstname.Lastname <at> sonymobile.com"><span>jan.karlsson <at> sonymobile.com</span></a><p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><a href="http://sonymobile.com/"><span lang="EN-US">sonymobile.com</span></a></span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span></span><span><p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div></div>
Dave Anderson | 17 Oct 17:12 2014
Picon

[PATCH] crash-gcore-command extension module: PPC64 support


Hello Daisuke,

Attached is a patch that introduces support for the PPC64 architecture.
The patch was written by Michal Toman (mtoman <at> redhat.com).  It is based
upon crash-gcore-command-1.3.0-rc.

The patch supports both big-endian and little-endian formats.  However,
it does require the ELF_DATA fix to elf64_fill_elf_header() that I reported
yesterday.  I have attached a separate patch to fix elf64_fill_elf_header
and elf32_fill_elf_header().

Please include these two patches in crash-gcore-command-1.3.0.

Thanks,
  Dave
Attachment (ELF_DATA.patch): text/x-patch, 1300 bytes
Attachment (add-ppc64-v5.patch): text/x-patch, 8 KiB

Hello Daisuke,

Attached is a patch that introduces support for the PPC64 architecture.
The patch was written by Michal Toman (mtoman <at> redhat.com).  It is based
upon crash-gcore-command-1.3.0-rc.

The patch supports both big-endian and little-endian formats.  However,
it does require the ELF_DATA fix to elf64_fill_elf_header() that I reported
yesterday.  I have attached a separate patch to fix elf64_fill_elf_header
and elf32_fill_elf_header().

Please include these two patches in crash-gcore-command-1.3.0.

Thanks,
  Dave
Karlsson, Jan | 15 Oct 11:19 2014

FW: Number of cpus on ARM

Hi

 

Unfortunately I found another older example where my patch below did not work.

In that one only cpu 0 where online but 0,1,2,3 where active. So maybe:

 

                           return MAX(get_cpus_active(), get_highest_cpu_online()+1);

 

might work better. Someone with better knowledge about this than I have should look at the problem.

 

Jan

 

Jan Karlsson

Senior Software Engineer

System Assurance

 

Sony Mobile Communications

Tel: +46 703 062 174

jan.karlsson <at> sonymobile.com

 

sonymobile.com

 

 

From: Karlsson, Jan
Sent: den 15 oktober 2014 10:49
To: Discussion list for crash utility usage, maintenance and development
Subject:

 

Hi

 

I have seen a problem when it comes to the number of cpus for ARM (32-bits).

 

static int

arm_get_smp_cpus(void)

{

                           return MAX(get_cpus_active(), get_cpus_online());

}

 

In one of my example, “help –k” gives me:

       cpu_possible_map: 0 1 2 3

        cpu_present_map: 0 1 2 3

         cpu_online_map: 0 3

         cpu_active_map: 3

 

So the number of cpus will become 2. However there are code in a number of places that will then only accept cpu 0 and 1 as cpus to handle.

 

When I changed to code to be the same as for ARM64 things worked as expected:

 

static int

arm_get_smp_cpus(void)

{

                           return MAX(get_cpus_online(), get_highest_cpu_online()+1);

}

 

Jan

 

Jan Karlsson

Senior Software Engineer

System Assurance

 

Sony Mobile Communications

Tel: +46 703 062 174

jan.karlsson <at> sonymobile.com

 

sonymobile.com

 

 

<div><div class="WordSection1">
<p class="MsoNormal"><span>Hi<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Unfortunately I found another older example where my patch below did not work.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">In that one only cpu 0 where online but 0,1,2,3 where active. So maybe:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return MAX(get_cpus_active(), get_highest_cpu_online()+1);<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">might work better. Someone with better knowledge about this than I have should look at the problem.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jan<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Jan Karlsson</span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Senior Software Engineer<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">System Assurance<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Sony Mobile Communications<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Tel: +46 703 062 174<p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><a href="mailto:Firstname.Lastname <at> sonymobile.com">jan.karlsson <at> sonymobile.com</a><p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><a href="http://sonymobile.com/"><span>sonymobile.com</span></a></span><span><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span></span><span><p></p></span></p>
</div>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<div><div><p class="MsoNormal"><span lang="EN-US">From:</span><span lang="EN-US"> Karlsson, Jan <br>Sent: den 15 oktober 2014 10:49<br>To: Discussion list for crash utility usage, maintenance and development<br>Subject: <p></p></span></p></div></div>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><span lang="EN-US">Hi<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have seen a problem when it comes to the number of cpus for ARM (32-bits).<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">static int<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">arm_get_smp_cpus(void)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return MAX(get_cpus_active(), get_cpus_online());<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">In one of my example, &ldquo;help &ndash;k&rdquo; gives me:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cpu_possible_map: 0 1 2 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu_present_map: 0 1 2 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu_online_map: 0 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu_active_map: 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">So the number of cpus will become 2. However there are code in a number of places that will then only accept cpu 0 and 1 as cpus to handle.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">When I changed to code to be the same as for ARM64 things worked as expected:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">static int<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">arm_get_smp_cpus(void)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return MAX(get_cpus_online(), get_highest_cpu_online()+1);<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jan<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jan Karlsson</span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Senior Software Engineer<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">System Assurance<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Sony Mobile Communications<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Tel: +46 703 062 174<p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><a href="mailto:Firstname.Lastname <at> sonymobile.com">jan.karlsson <at> sonymobile.com</a><p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><a href="http://sonymobile.com/"><span lang="EN-US">sonymobile.com</span></a></span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span></span><span><p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div></div>
Karlsson, Jan | 15 Oct 10:49 2014

(no subject)

Hi

 

I have seen a problem when it comes to the number of cpus for ARM (32-bits).

 

static int

arm_get_smp_cpus(void)

{

                           return MAX(get_cpus_active(), get_cpus_online());

}

 

In one of my example, “help –k” gives me:

       cpu_possible_map: 0 1 2 3

        cpu_present_map: 0 1 2 3

         cpu_online_map: 0 3

         cpu_active_map: 3

 

So the number of cpus will become 2. However there are code in a number of places that will then only accept cpu 0 and 1 as cpus to handle.

 

When I changed to code to be the same as for ARM64 things worked as expected:

 

static int

arm_get_smp_cpus(void)

{

                           return MAX(get_cpus_online(), get_highest_cpu_online()+1);

}

 

Jan

 

Jan Karlsson

Senior Software Engineer

System Assurance

 

Sony Mobile Communications

Tel: +46 703 062 174

jan.karlsson <at> sonymobile.com

 

sonymobile.com

 

 

<div><div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have seen a problem when it comes to the number of cpus for ARM (32-bits).<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">static int<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">arm_get_smp_cpus(void)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return MAX(get_cpus_active(), get_cpus_online());<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">In one of my example, &ldquo;help &ndash;k&rdquo; gives me:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cpu_possible_map: 0 1 2 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu_present_map: 0 1 2 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu_online_map: 0 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cpu_active_map: 3 <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">So the number of cpus will become 2. However there are code in a number of places that will then only accept cpu 0 and 1 as cpus to handle.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">When I changed to code to be the same as for ARM64 things worked as expected:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">static int<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">arm_get_smp_cpus(void)<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return MAX(get_cpus_online(), get_highest_cpu_online()+1);<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jan<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jan Karlsson</span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Senior Software Engineer<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">System Assurance<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Sony Mobile Communications<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Tel: +46 703 062 174<p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><a href="mailto:Firstname.Lastname <at> sonymobile.com"><span>jan.karlsson <at> sonymobile.com</span></a><p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><a href="http://sonymobile.com/"><span lang="EN-US">sonymobile.com</span></a></span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span></span><span><p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div></div>
Dave Anderson | 14 Oct 22:37 2014
Picon

HEADS UP: crash will fail to initialize with upstream CONFIG_SLAB kernels


Just a heads-up to those who may be running with bleeding-edge upstream
kernels that have this commit:

   commit bf0dea23a9c094ae869a88bb694fbe966671bf6d
   Author: Joonsoo Kim <iamjoonsoo.kim <at> lge.com>
   Date: Thu Oct 9 15:26:27 2014 -0700

   mm/slab: use percpu allocator for cpu cache

This change will cause the crash session to fail during initialization
if the target kernel is configured with CONFIG_SLAB.  I haven't tried
it, but it looks like it would fail with an invalid structure member
offset message w/respect to "kmem_cache_s_array".  To work around it, 
you could try using the --no_kmem_cache command line option.

Since RHEL and Fedora use CONFIG_SLUB, it wouldn't be an issue with
those distributions.

Dave

[ANNOUNCE] crash gcore command, version 1.3.0-rc is released

This is the release of crash gcore command, version 1.3.0-rc.

The version 1.3.0 is going to newly add ARM64 support, and the
purpose of this rc version release is for verification by other
architecture maintainers. Please give me a verfication result as a
reply to this mail.

The remaining changes are all bugfixes.

ChangeLog:

 - Add ARM64 support. In addition to native ARM64 build, like crash
   utility, we can build x86_64 executable of crash gcore command for
   ARM64 crash dump by make target=ARM64, just like crash utility.
   (anderson <at> redhat.com)

 - Fix a bug that registers in NT_PRSTATUS note information is
   broken. This had been since v1.2.2 when O(1) note informaiton
   collection was added. Without this fix, we can never get reliable
   register values for failure analysis.
   (weishu <at> marvell.com)

 - Fix a bug that NT_386_IOPERM note information is not collected. So
   far, ioperm_get() had always returned 1. As a result, NT_386_IOPERM
   note information had never been not included in a generated core
   file even if it is available for a given task on a given crash
   dump.
   (d.hatayama <at> jp.fujitsu.com)

 - Add new member offset initialization for struct
   nsproxy::pid_ns_for_children. In upstream, the following patch
   renamed struct nsproxy::pid_ns into struct
   nsproxy::pid_ns_for_children.

    $ git log -1 c2b1df2e
    commit c2b1df2eb42978073ec27c99cc199d20ae48b849
    Author: Andy Lutomirski <luto <at> amacapital.net>
    Date:   Thu Aug 22 11:39:16 2013 -0700

        Rename nsproxy.pid_ns to nsproxy.pid_ns_for_children

        nsproxy.pid_ns is *not* the task's pid namespace.  The name
should clarify
        that.

        This makes it more obvious that setns on a pid namespace is weird --
        it won't change the pid namespace shown in procfs.

        Signed-off-by: Andy Lutomirski <luto <at> amacapital.net>
        Reviewed-by: "Eric W. Biederman" <ebiederm <at> xmission.com>
        Signed-off-by: David S. Miller <davem <at> davemloft.net>

   Without this fix, gcore exited abnormally at its initialization
   part and so core file is never generated.
   (d.hatayama <at> jp.fujitsu.com)

 - Fix a bug that a wrong way of checking return value of
   fopen(). fopen() returns NULL in case of error, but gcore had seen
   it as returning a minus integer. As a result, gcore continues
   execution after the check even in case of error and then exits
   abnormally at the first call of fwrite() with the broken file
   pointer gcore failed to open.

   From users' viewpoint, we face this bug when trying to overwrite an
   existing corefile with more priviledged permission and resulting in
   EPERM failure.

   (d.hatayama <at> jp.fujitsu.com)

MD5 CheckSum:

$ md5sum ./crash-gcore-command-1.3.0-rc.tar.gz
0b841985c084e790966800edfd1b5d43  ./crash-gcore-command-1.3.0-rc.tar.gz

--
Thanks.
HATAYAMA, Daisuke
This is the release of crash gcore command, version 1.3.0-rc.

The version 1.3.0 is going to newly add ARM64 support, and the
purpose of this rc version release is for verification by other
architecture maintainers. Please give me a verfication result as a
reply to this mail.

The remaining changes are all bugfixes.

ChangeLog:

 - Add ARM64 support. In addition to native ARM64 build, like crash
   utility, we can build x86_64 executable of crash gcore command for
   ARM64 crash dump by make target=ARM64, just like crash utility.
   (anderson <at> redhat.com)

 - Fix a bug that registers in NT_PRSTATUS note information is
   broken. This had been since v1.2.2 when O(1) note informaiton
   collection was added. Without this fix, we can never get reliable
   register values for failure analysis.
   (weishu <at> marvell.com)

 - Fix a bug that NT_386_IOPERM note information is not collected. So
   far, ioperm_get() had always returned 1. As a result, NT_386_IOPERM
   note information had never been not included in a generated core
   file even if it is available for a given task on a given crash
   dump.
   (d.hatayama <at> jp.fujitsu.com)

 - Add new member offset initialization for struct
   nsproxy::pid_ns_for_children. In upstream, the following patch
   renamed struct nsproxy::pid_ns into struct
   nsproxy::pid_ns_for_children.

    $ git log -1 c2b1df2e
    commit c2b1df2eb42978073ec27c99cc199d20ae48b849
    Author: Andy Lutomirski <luto <at> amacapital.net>
    Date:   Thu Aug 22 11:39:16 2013 -0700

        Rename nsproxy.pid_ns to nsproxy.pid_ns_for_children

        nsproxy.pid_ns is *not* the task's pid namespace.  The name
should clarify
        that.

        This makes it more obvious that setns on a pid namespace is weird --
        it won't change the pid namespace shown in procfs.

        Signed-off-by: Andy Lutomirski <luto <at> amacapital.net>
        Reviewed-by: "Eric W. Biederman" <ebiederm <at> xmission.com>
        Signed-off-by: David S. Miller <davem <at> davemloft.net>

   Without this fix, gcore exited abnormally at its initialization
   part and so core file is never generated.
   (d.hatayama <at> jp.fujitsu.com)

 - Fix a bug that a wrong way of checking return value of
   fopen(). fopen() returns NULL in case of error, but gcore had seen
   it as returning a minus integer. As a result, gcore continues
   execution after the check even in case of error and then exits
   abnormally at the first call of fwrite() with the broken file
   pointer gcore failed to open.

   From users' viewpoint, we face this bug when trying to overwrite an
   existing corefile with more priviledged permission and resulting in
   EPERM failure.

   (d.hatayama <at> jp.fujitsu.com)

MD5 CheckSum:

$ md5sum ./crash-gcore-command-1.3.0-rc.tar.gz
0b841985c084e790966800edfd1b5d43  ./crash-gcore-command-1.3.0-rc.tar.gz

--
Thanks.
HATAYAMA, Daisuke
qiaonuohan | 3 Oct 06:02 2014

[PATCH v3 00/21] support hiding data of offline cpu

For those who don't care about the removed cpu, data of offline cpu is
bothering. This patchset is trying to hide data of offline cpu. Please
check each patch to see what is hiden.

The last version is here:
https://www.redhat.com/archives/crash-utility/2014-September/msg00078.html

Changelog:
v2->v3:
1. change "<OFFLINE>" to "[OFFLINE]" to indicate data of offline cpu
2. delete the following patches:
        x86_64: modify help -m/-M to hide offline cpus' data
        modify help -k to hide offline cpus' number
        modify irq -a to hide offline cpus' data
        modify print_task_header() to indicate idle task on offline cpu

3. change the following patches to remain the original data and append an
    "[OFFLINE]" to indicate the data is related to the offline cpu:
        x86_64: modify mach to hide offline cpus' data
        modify ptov offset:cpuspec to hide offline cpus' data
        modify kmem -o to hide offline cpus' data

4. change output of "modify display_sys_stats() to hide cpus' number"
5. change ps to indicate swapper task on offline cpu with "-"

v1->v2:
1. patch 1: add environment variable and its argument to hide/show
    data of offline cpu.
2. add description of environment variable to crash.8
3. remove the restrict of x86_64
4. add "<OFFLINE>" to indicate those hiden data.
5. patch 22/23: addd "<OFFLINE>" to indicate idle task on offline

Qiao Nuohan (21):
   add a flag to display/hide data of offline cpus
   add an API to check whether to hide a cpus' data
   x86_64: modify bt -E to hide offline cpus' data
   x86_64: modify mach to indicate offline cpus' data
   x86_64: modify mach -c to hide offline cpus' data
   modify help -r to hide offline cpus' registers
   modify bt -c to hide offline cpus' data
   modify display_sys_stats() to indicate offline cpus
   modify set -c to hide offline cpu
   modify irq -s to hide offline cpus' data
   modify timer -r to hide offline cpus' data
   modify timer to hide offline cpus' data
   modify ptov offset:cpuspec to indicate offline cpus' data
   fix max_cpudata_limit() when offlined cpu exists
   modify kmem -o to indicate offline cpus' data
   modify kmem -S(SLUB) to hide offline cpus' data
   modify struct/union/* [:cpuspec] to hide offline cpus' data
   modify command p to hide offline cpus' data
   modify ps -l/-m -C cpu to hide offline cpus' data
   modify runq to hide offline cpus' data
   modify ps to indicate swapper task on offline cpu

  crash.8    |  4 ++++
  defs.h     |  3 +++
  diskdump.c |  6 ++++-
  help.c     | 10 +++++++-
  kernel.c   | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
  main.c     | 15 +++++++++++-
  memory.c   | 30 ++++++++++++++++++++----
  netdump.c  | 25 ++++++++++++++++++--
  symbols.c  | 15 +++++++++++-
  task.c     | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------
  tools.c    | 15 ++++++++++++
  x86_64.c   | 46 ++++++++++++++++++++++++++++++------
  12 files changed, 290 insertions(+), 30 deletions(-)

-- 
1.8.5.3
From d67eaa5dca792660802dff483f76451be0de1cbb Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Mon, 22 Sep 2014 10:23:08 +0800
Subject: [PATCH v3 01/21] add a flag to display/hide data of offline cpus

Add a field to pc->flags2 to display/hide data related to offline cpu. This
flag can be changed by the following 2 ways:
1. start crash with "--offline [show|hide]"
2. execute crash command "set offline show|hide"

The default set is "show". This flag can be used by later patches to hide
date related to offline cpus. And set can be checked by using command "set -v"

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 crash.8 |  4 ++++
 defs.h  |  1 +
 help.c  |  6 ++++++
 main.c  | 15 ++++++++++++++-
 tools.c | 15 +++++++++++++++
 5 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/crash.8 b/crash.8
index 1223aeb..bebffba 100644
--- a/crash.8
+++ b/crash.8
 <at>  <at>  -503,6 +503,10  <at>  <at>  determined value.
 .TP
 .BI --kvmio \ <size>
 override the automatically-calculated KVM guest I/O hole size.
+.TP
+.BI --offline \ [show|hide]
+Display/hide data related to offline cpu. Crash command "set offline
+[on|off]" can be used to override the set here.
 .SH COMMANDS
 Each 
 .B crash
diff --git a/defs.h b/defs.h
index cbdaa47..32c9d4d 100755
--- a/defs.h
+++ b/defs.h
 <at>  <at>  -505,6 +505,7  <at>  <at>  struct program_context {
 #define REM_PAUSED_F (0x1000ULL)
 #define RAMDUMP	(0x2000ULL)
 #define REMOTE_PAUSED() (pc->flags2 & REM_PAUSED_F)
+#define OFFLINE_HIDE (0x4000ULL)
 	char *cleanup;
 	char *namelist_orig;
 	char *namelist_debug_orig;
diff --git a/help.c b/help.c
index 30d7759..a6f834d 100755
--- a/help.c
+++ b/help.c
 <at>  <at>  -339,6 +339,10  <at>  <at>  char *program_usage_info[] = {
     "  --kvmio <size>",
     "    override the automatically-calculated KVM guest I/O hole size.",
     "",
+    "  --offline [show|hide]",
+    "    Display/hide data related to offline cpu. Crash command \"set offline",
+    "    [show|hide]\" can be used to override the set here",
+    "",
     "FILES:",
     "",
     "  .crashrc",
 <at>  <at>  -1054,6 +1058,8  <at>  <at>  char *help_set[] = {
 "                               must be a kernel or module text address, which", 
 "                               may be expressed symbolically or as a hexadecimal",
 "                               value.",
+"       offline show | hide     set crash to display or hide data related to",
+"                               offline cpu.",
 " ",
 "  Internal variables may be set in four manners:\n",
 "    1. entering the set command in $HOME/.%src.",
diff --git a/main.c b/main.c
index ad66058..8917f0f 100755
--- a/main.c
+++ b/main.c
 <at>  <at>  -70,6 +70,7  <at>  <at>  static struct option long_options[] = {
 	{"dec", 0, 0, 0},
 	{"no_strip", 0, 0, 0},
 	{"hash", required_argument, 0, 0},
+	{"offline", required_argument, 0, 0},
         {0, 0, 0, 0}
 };

 <at>  <at>  -279,7 +280,17  <at>  <at>  main(int argc, char **argv)
 				pc->flags2 |= RADIX_OVERRIDE;
 				pc->output_radix = 10;
 			}
-			
+
+			else if (STREQ(long_options[option_index].name, "offline")) {
+				if (STREQ(optarg, "show"))
+					pc->flags2 &= ~OFFLINE_HIDE;
+				else if (STREQ(optarg, "hide"))
+					pc->flags2 |= OFFLINE_HIDE;
+				else {
+					error(INFO, "invalid --offline argument: %s\n", optarg);
+					program_usage(SHORT_FORM);
+				}
+			}

 			else {
 				error(INFO, "internal error: option %s unhandled\n",
 <at>  <at>  -1393,6 +1404,8  <at>  <at>  dump_program_context(void)
 		fprintf(fp, "%sALLOW_FP", others++ ? "|" : "");
 	if (pc->flags2 & RAMDUMP)
 		fprintf(fp, "%sRAMDUMP", others++ ? "|" : "");
+	if (pc->flags2 & OFFLINE_HIDE)
+		fprintf(fp, "%sOFFLINE_HIDE", others++ ? "|" : "");
 	fprintf(fp, ")\n");

 	fprintf(fp, "         namelist: %s\n", pc->namelist);
diff --git a/tools.c b/tools.c
index a5f514f..f9c97a4 100755
--- a/tools.c
+++ b/tools.c
 <at>  <at>  -2365,6 +2365,20  <at>  <at>  cmd_set(void)
 					"on" : "off");
 			return;

+                } else if (STREQ(args[optind], "offline")) {
+
+                        if (args[optind+1]) {
+                                optind++;
+                                if (STREQ(args[optind], "show"))
+                                        pc->flags2 &= ~OFFLINE_HIDE;
+                                else if(STREQ(args[optind], "hide"))
+                                        pc->flags2 |= OFFLINE_HIDE;
+                                else
+                                        goto invalid_set_command;
+                        }
+
+			return;
+
 		} else if (XEN_HYPER_MODE()) {
 			error(FATAL, "invalid argument for the Xen hypervisor\n");
 		} else if (pc->flags & MINIMAL_MODE) {
 <at>  <at>  -2467,6 +2481,7  <at>  <at>  show_options(void)
 		fprintf(fp, "(%s)\n", value_to_symstr(pc->scope, buf, 0));
 	else
 		fprintf(fp, "(not set)\n");
+	fprintf(fp, "       offline: %s\n", pc->flags2 & OFFLINE_HIDE ? "hide" : "show");
 }

 
-- 
1.8.5.3

From 309752c6e495cfb47f0e4f48ed7244625010a65d Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Tue, 23 Sep 2014 14:19:32 +0800
Subject: [PATCH v3 02/21] add an API to check whether to hide a cpus' data

check_offline_cpu() is used to check whether a cpu is offline.

hide_offline_cpu() is based on check_offline_cpu() and used to check
whether the data related to the specified cpu should be hiden.
---
 defs.h   |  2 ++
 kernel.c | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/defs.h b/defs.h
index 32c9d4d..0cf4f31 100755
--- a/defs.h
+++ b/defs.h
 <at>  <at>  -4894,6 +4894,8  <at>  <at>  int get_cpus_online(void);
 int get_cpus_active(void);
 int get_cpus_present(void);
 int get_cpus_possible(void);
+int check_offline_cpu(int);
+int hide_offline_cpu(int);
 int get_highest_cpu_online(void);
 int get_highest_cpu_present(void);
 int get_cpus_to_display(void);
diff --git a/kernel.c b/kernel.c
index 87a0b75..8948c84 100755
--- a/kernel.c
+++ b/kernel.c
 <at>  <at>  -7989,6 +7989,33  <at>  <at>  get_cpus_online()
 }

 /*
+ * check to see whether a cpu is offline
+ */
+int
+check_offline_cpu(int cpu)
+{
+	if (!cpu_map_addr("online"))
+		return FALSE;
+
+	if (in_cpu_map(ONLINE_MAP, cpu))
+		return FALSE;
+
+	return TRUE;
+}
+
+/*
+ * check to see whether the data related to the specified cpu should be hide
+ */
+int
+hide_offline_cpu(int cpu)
+{
+	if (!(pc->flags2 & OFFLINE_HIDE))
+		return FALSE;
+
+	return check_offline_cpu(cpu);
+}
+
+/*
  *  If it exists, return the highest cpu number in the cpu_online_map.
  */
 int
-- 
1.8.5.3

From a96591bced3b0166373c03aa47488d7101c066c3 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Sun, 28 Sep 2014 16:36:54 +0800
Subject: [PATCH v3 03/21] x86_64: modify bt -E to hide offline cpus' data

bt -E will search all irq stacks and exception stacks for possible
exception frames. With this patch offline cpus will be hiden.

The original output will be like:
<cut>
crash> bt -E
CPU 0 IRQ STACK:
(none found)

CPU 1 IRQ STACK:
(none found)

CPU 2 IRQ STACK:
(none found)

CPU 3 IRQ STACK:
(none found)
...
CPU 2 STACKFAULT EXCEPTION STACK:
(none found)

CPU 2 DOUBLEFAULT EXCEPTION STACK:
(none found)

CPU 2 NMI EXCEPTION STACK:
(none found)

CPU 2 DEBUG EXCEPTION STACK:
(none found)

CPU 2 MCE EXCEPTION STACK:
(none found)
...
<cut>

With data of offline cpu hiden, the output is like:
<cut>
crash> bt -E
CPU 0 IRQ STACK:
(none found)

CPU 1 IRQ STACK:
(none found)

CPU 2 IRQ STACK: <OFFLINE>

CPU 3 IRQ STACK:
(none found)
...
CPU 2 STACKFAULT EXCEPTION STACK: <OFFLINE>

CPU 2 DOUBLEFAULT EXCEPTION STACK: <OFFLINE>

CPU 2 NMI EXCEPTION STACK: <OFFLINE>

CPU 2 DEBUG EXCEPTION STACK: <OFFLINE>

CPU 2 MCE EXCEPTION STACK: <OFFLINE>
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 x86_64.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/x86_64.c b/x86_64.c
index a2e4636..a076b02 100755
--- a/x86_64.c
+++ b/x86_64.c
 <at>  <at>  -2325,7 +2325,14  <at>  <at>  x86_64_eframe_search(struct bt_info *bt)
                 	if (ms->stkinfo.ibase[c] == 0)
                         	break;
                                 bt->hp->esp = ms->stkinfo.ibase[c];
-                                fprintf(fp, "CPU %d IRQ STACK:\n", c);
+                                fprintf(fp, "CPU %d IRQ STACK:", c);
+
+				if (hide_offline_cpu(c)) {
+					fprintf(fp, " [OFFLINE]\n\n");
+					continue;
+				} else
+					fprintf(fp, "\n");
+
                                 if ((cnt = x86_64_eframe_search(bt)))
 					fprintf(fp, "\n");
 				else
 <at>  <at>  -2337,8 +2344,15  <at>  <at>  x86_64_eframe_search(struct bt_info *bt)
                         	if (ms->stkinfo.ebase[c][i] == 0)
                                 	break;
                                 bt->hp->esp = ms->stkinfo.ebase[c][i];
-                                fprintf(fp, "CPU %d %s EXCEPTION STACK:\n", 
+                                fprintf(fp, "CPU %d %s EXCEPTION STACK:",
 					c, x86_64_exception_stacks[i]);
+
+				if (hide_offline_cpu(c)) {
+					fprintf(fp, " [OFFLINE]\n\n");
+					continue;
+				} else
+					fprintf(fp, "\n");
+
                                 if ((cnt = x86_64_eframe_search(bt)))
 					fprintf(fp, "\n");
 				else
-- 
1.8.5.3

From 2ea64d2e3af46b32a17382252d3976e978175baf Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 2 Oct 2014 10:17:35 +0800
Subject: [PATCH v3 04/21] x86_64: modify mach to indicate offline cpus' data

mach will display number of cpus and cpus' irq stacks and exception
stacks. This patch can indicate data of offline cpus.

The original output is like below:
<cut>
crash> mach
          MACHINE TYPE: x86_64
           MEMORY SIZE: 1 GB
                  CPUS: 4
...
            IRQ STACKS:
                 CPU 0: ffff88003fc00000
                 CPU 1: ffff88003fc80000
                 CPU 2: ffff88003fd00000
                 CPU 3: ffff88003fd80000
 STACKFAULT STACK SIZE: 4096
     STACKFAULT STACKS:
                 CPU 0: ffff88003fc04000
                 CPU 1: ffff88003fc84000
                 CPU 2: ffff88003fd04000
                 CPU 3: ffff88003fd84000
...
<cut>

With crash variable offline set to "hide", the output is like below:
<cut>
crash> mach
          MACHINE TYPE: x86_64
           MEMORY SIZE: 1 GB
                  CPUS: 4 [1 OFFLINE]
...
            IRQ STACKS:
                 CPU 0: ffff88003fc00000
                 CPU 1: ffff88003fc80000
                 CPU 2: ffff88003fd00000 <OFFLINE>
                 CPU 3: ffff88003fd80000
 STACKFAULT STACK SIZE: 4096
     STACKFAULT STACKS:
                 CPU 0: ffff88003fc04000
                 CPU 1: ffff88003fc84000
                 CPU 2: ffff88003fd04000 <OFFLINE>
                 CPU 3: ffff88003fd84000
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 x86_64.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/x86_64.c b/x86_64.c
index a076b02..9ff57d6 100755
--- a/x86_64.c
+++ b/x86_64.c
 <at>  <at>  -5047,7 +5047,8  <at>  <at>  x86_64_display_machine_stats(void)

 	fprintf(fp, "          MACHINE TYPE: %s\n", uts->machine);
 	fprintf(fp, "           MEMORY SIZE: %s\n", get_memory_size(buf));
-	fprintf(fp, "                  CPUS: %d\n", kt->cpus);
+	fprintf(fp, "                  CPUS: %d [%d OFFLINE]\n", kt->cpus,
+		kt->cpus - get_cpus_to_display());
 	if (!STREQ(kt->hypervisor, "(undetermined)") &&
 	    !STREQ(kt->hypervisor, "bare hardware"))
 		fprintf(fp, "            HYPERVISOR: %s\n",  kt->hypervisor);
 <at>  <at>  -5071,8 +5072,14  <at>  <at>  x86_64_display_machine_stats(void)
 	fprintf(fp, "            IRQ STACKS:\n");
 	for (c = 0; c < kt->cpus; c++) {
 		sprintf(buf, "CPU %d", c);
-		fprintf(fp, "%22s: %016lx\n", 
+		
+		fprintf(fp, "%22s: %016lx",
 			buf, machdep->machspec->stkinfo.ibase[c]);
+
+		if (hide_offline_cpu(c))
+			fprintf(fp, " [OFFLINE]\n");
+		else
+			fprintf(fp, "\n");
 	}

 	for (i = 0; i < MAX_EXCEPTION_STACKS; i++) {
 <at>  <at>  -5087,8 +5094,14  <at>  <at>  x86_64_display_machine_stats(void)
 			if (machdep->machspec->stkinfo.ebase[c][i] == 0)
 				break;
 			sprintf(buf, "CPU %d", c);
-			fprintf(fp, "%22s: %016lx\n", 
+
+			fprintf(fp, "%22s: %016lx",
 				buf, machdep->machspec->stkinfo.ebase[c][i]);
+
+			if (hide_offline_cpu(c))
+				fprintf(fp, " [OFFLINE]\n");
+			else
+				fprintf(fp, "\n");
 		}
 	}
 }
-- 
1.8.5.3

From ca861830879d3b9e3428d690b6fb502bedf80d16 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Tue, 23 Sep 2014 10:54:22 +0800
Subject: [PATCH v3 05/21] x86_64: modify mach -c to hide offline cpus' data

mach -c will display some per-cpu structures. This patch will hide
offline cpus' structures.

The original output is like below:
<cut>
crash> mach -c
...
  cpu_index = 1,
  microcode = 1
}

CPU 2:
struct cpuinfo_x86 {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 2 '\002',
  x86_mask = 3 '\003',
  x86_tlbsize = 0,
  x86_virt_bits = 48 '0',
  x86_phys_bits = 40 '(',
...
<cut>

With crash varialbe offline set to "hide", the output is like below:
<cut>
crash> mach -c
...
  cpu_index = 1,
  microcode = 1
}

CPU 2: [OFFLINE]

CPU 3:
struct cpuinfo_x86 {
struct cpuinfo_x86 {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 2 '\002',
  x86_mask = 3 '\003',
  x86_tlbsize = 0,
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 x86_64.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/x86_64.c b/x86_64.c
index 9ff57d6..bd2a3e0 100755
--- a/x86_64.c
+++ b/x86_64.c
 <at>  <at>  -5145,8 +5145,13  <at>  <at>  x86_64_display_cpu_data(unsigned int radix)
         for (cpu = 0; cpu < cpus; cpu++) {
 		if (boot_cpu)
                 	fprintf(fp, "BOOT CPU:\n");
-		else
-                	fprintf(fp, "%sCPU %d:\n", cpu ? "\n" : "", cpu);
+		else {
+			if (hide_offline_cpu(cpu)) {
+				fprintf(fp, "%sCPU %d: [OFFLINE]\n", cpu ? "\n" : "", cpu);
+				continue;
+			} else
+				fprintf(fp, "%sCPU %d:\n", cpu ? "\n" : "", cpu);
+		}

 		if (per_cpu)
 			cpu_data = per_cpu->value + kt->__per_cpu_offset[cpu];
-- 
1.8.5.3

From 08d71ea4baaf082b22f1385e3fe6a787d2873583 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Tue, 23 Sep 2014 15:54:45 +0800
Subject: [PATCH v3 06/21] modify help -r to hide offline cpus' registers

help -r can display registers on three types of vmcore:
1. qemu memoly-only dump
2. kdump(kdump-compressed format)
3. kdump(elf format)

This patch will hide the offline cpus' registers.

With offline cpus' registers hiden, the output is like below

1. qemu memory-only dump, cpu#1 and cpu#2 are offline
<cut>
...
  idt:
    selector:00000000  limit:00000fff  flags:00000000
    pad:00000000  base:ffffffffff529000
  cr[0]:000000008005003b  cr[1]:0000000000000000  cr[2]:00007f6885fa3000
  cr[3]:000000003b481000  cr[4]:00000000000006f0

CPU 1: [OFFLINE]

CPU 2: [OFFLINE]

CPU 3:
  rax:00000000ffffffed  rbx:ffff88003daeffd8  rcx:0100000000000000
  rdx:0000000000000000  rsi:0000000000000000  rdi:0000000000000046
  rsp:ffff88003daefe98  rbp:ffff88003daefe98   r8:0000000000000000
   r9:0000000000000000  r10:0000000000000013  r11:ffff88003db45028
  r12:0000000000000003  r13:ffff88003daeffd8  r14:0000000000000000
  r15:ffff88003daeffd8  rip:ffffffff81046346  rflags:00000286
...
<cut>

2. kdump(kdump-compressed format), cpu#2 is offline
<cut>
...
CPU 1:
    RIP: ffffffff8134b6c6  RSP: ffff88003df25e18  RFLAGS: 00010096
    RAX: 0000000000000010  RBX: 0000000000000063  RCX: 0000000000000000
    RDX: 0000000000000000  RSI: 0000000000000000  RDI: 0000000000000063
    RBP: ffff88003df25e18   R8: 0000000000000000   R9: ffffffff81645da0
    R10: 0000000000000001  R11: 0000000000000000  R12: 0000000000000000
    R13: ffffffff81b01a40  R14: 0000000000000286  R15: 0000000000000004
    CS: 0010  SS: 0018

CPU 2: [OFFLINE]

CPU 3:
    RIP: ffffffff81015670  RSP: ffff88003f3fdca0  RFLAGS: 00000097
    RAX: 0000000000000000  RBX: 000000000000001f  RCX: 0000000000000000
    RDX: 00000000000003d5  RSI: 000000000000001f  RDI: ffffffff81fdd2a8
...
<cut>

3. kdump(elf format), cpu #1 is offline
<cut>
...
    RBP: ffffffff818c3e98   R8: 0000000000000000   R9: 0000000000000000
    R10: 0000000000000000  R11: 0000000000000000  R12: 0000000000000000
    R13: ffffffff818c3fd8  R14: ffff88003ff54780  R15: ffffffff818c3fd8
    CS: 0010  SS: 0018

CPU 1: [OFFLINE]

CPU 2:
    RIP: ffffffff81046346  RSP: ffff88003daede98  RFLAGS: 00000286
    RAX: 00000000ffffffed  RBX: ffff88003daedfd8  RCX: 0100000000000000
    RDX: 0000000000000000  RSI: 0000000000000000  RDI: 0000000000000046
    RBP: ffff88003daede98   R8: 0000000000000000   R9: 0000000000000000
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 diskdump.c |  6 +++++-
 netdump.c  | 25 +++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/diskdump.c b/diskdump.c
index 7639e32..3938552 100644
--- a/diskdump.c
+++ b/diskdump.c
 <at>  <at>  -2057,7 +2057,11  <at>  <at>  dump_registers_for_compressed_kdump(void)
 		error(FATAL, "-r option not supported for this dumpfile\n");

 	for (c = 0; c < kt->cpus; c++) {
-		fprintf(fp, "%sCPU %d:\n", c ? "\n" : "", c);
+		if (hide_offline_cpu(c)) {
+			fprintf(fp, "%sCPU %d: [OFFLINE]\n", c ? "\n" : "", c);
+			continue;
+		} else
+			fprintf(fp, "%sCPU %d:\n", c ? "\n" : "", c);
 		diskdump_display_regs(c, fp);
 	}
 }
diff --git a/netdump.c b/netdump.c
index e946b45..35e4e69 100644
--- a/netdump.c
+++ b/netdump.c
 <at>  <at>  -2380,8 +2380,19  <at>  <at>  display_regs_from_elf_notes(int cpu)
 	Elf64_Nhdr *note64;
 	size_t len;
 	char *user_regs;
+	int c, skipped_count;

-	if (cpu >= nd->num_prstatus_notes) {
+	/*
+	 * NT_PRSTATUS notes are only related to online cpus, offline cpus
+	 * should be skipped.
+	 */
+	skipped_count = 0;
+	for (c = 0; c < cpu; c++) {
+		if (check_offline_cpu(c))
+			skipped_count++;
+	}
+
+	if ((cpu - skipped_count) >= nd->num_prstatus_notes) {
 		error(INFO, "registers not collected for cpu %d\n", cpu);
 		return;
 	}
 <at>  <at>  -2488,6 +2499,11  <at>  <at>  dump_registers_for_elf_dumpfiles(void)
 	}

         for (c = 0; c < kt->cpus; c++) {
+		if (check_offline_cpu(c)) {
+			fprintf(fp, "%sCPU %d: [OFFLINE]\n", c ? "\n" : "", c);
+			continue;
+		}
+
                 fprintf(fp, "%sCPU %d:\n", c ? "\n" : "", c);
                 display_regs_from_elf_notes(c);
         }
 <at>  <at>  -3786,7 +3802,12  <at>  <at>  dump_registers_for_qemu_mem_dump(void)

 		if (i)
 			netdump_print("\n");
-		netdump_print("CPU %d:\n", i);
+
+		if (hide_offline_cpu(i)) {
+			netdump_print("CPU %d: [OFFLINE]\n", i);
+			continue;
+		} else
+			netdump_print("CPU %d:\n", i);

 		if (CRASHDEBUG(1))
 			netdump_print("  version:%08lx      size:%08lx\n",
-- 
1.8.5.3

From 3175fabcc7110c19bfbc36445627a9e10b56f48e Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Tue, 23 Sep 2014 16:42:22 +0800
Subject: [PATCH v3 07/21] modify bt -c to hide offline cpus' data

bt -c will display the stack trace of the active task on specified cpus.
This patch will hide offline cpus' data and print a message like "bt:
CPU xx is offline" to indicate the hide(xx is the id of the offline cpu).

The original output is like below:
<cut>
crash> bt -c 2,3
PID: 0      TASK: ffff88003f380040  CPU: 2   COMMAND: "swapper"
 #0 [ffff88003f3adf00] cpu_idle at ffffffff8100a00b

PID: 22     TASK: ffff88003f3fb500  CPU: 3   COMMAND: "events/3"
 #0 [ffff880002387e90] crash_nmi_callback at ffffffff8102fee6
 #1 [ffff880002387ea0] notifier_call_chain at ffffffff8152d515
 #2 [ffff880002387ee0] atomic_notifier_call_chain at ffffffff8152d57a
 #3 [ffff880002387ef0] notify_die at ffffffff810a154e
 #4 [ffff880002387f20] do_nmi at ffffffff8152b1db
 #5 [ffff880002387f50] nmi at ffffffff8152aaa0
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> bt -c 2,3
bt: CPU 2 is OFFLINE.

PID: 22     TASK: ffff88003f3fb500  CPU: 3   COMMAND: "events/3"
 #0 [ffff880002387e90] crash_nmi_callback at ffffffff8102fee6
 #1 [ffff880002387ea0] notifier_call_chain at ffffffff8152d515
 #2 [ffff880002387ee0] atomic_notifier_call_chain at ffffffff8152d57a
 #3 [ffff880002387ef0] notify_die at ffffffff810a154e
 #4 [ffff880002387f20] do_nmi at ffffffff8152b1db
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 kernel.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel.c b/kernel.c
index 8948c84..f5f98ca 100755
--- a/kernel.c
+++ b/kernel.c
 <at>  <at>  -2261,6 +2261,12  <at>  <at>  cmd_bt(void)

 		for (i = 0; i < kt->cpus; i++) {
 			if (NUM_IN_BITMAP(cpus, i)) {
+				if (hide_offline_cpu(i)) {
+					error(INFO, "%sCPU %d is OFFLINE.\n",
+					      subsequent++ ? "\n" : "", i);
+					continue;
+				}
+
 				if ((task = get_active_task(i)))
 					tc = task_to_context(task);
 				else
-- 
1.8.5.3

From 94ce970f126c45b00f6215dd657df19f6cf1c593 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 2 Oct 2014 10:35:25 +0800
Subject: [PATCH v3 08/21] modify display_sys_stats() to indicate offline cpus

function display_sys_stats will display the cpus' total number at initiation
when crash is executed or when command sys is called. With this patch, offline
cpus's total number will also be displayed.

The has 4 cpus and cpu#2 is offline. The original display is like below:
<cut>
      KERNEL: ../kdump/vmlinux
    DUMPFILE: ../kdump/vmcore  [PARTIAL DUMP]
        CPUS: 4
        DATE: Tue Sep 23 14:54:26 2014
      UPTIME: 00:02:45
...
<cut>

With this patch, the output is like below:
<cut>
      KERNEL: ../kdump/vmlinux
    DUMPFILE: ../kdump/vmcore  [PARTIAL DUMP]
        CPUS: 4 [1 OFFLINE]
        DATE: Tue Sep 23 14:54:26 2014
      UPTIME: 00:02:45
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 kernel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel.c b/kernel.c
index f5f98ca..90e6f79 100755
--- a/kernel.c
+++ b/kernel.c
 <at>  <at>  -4796,8 +4796,11  <at>  <at>  display_sys_stats(void)
 				pc->kvmdump_mapfile);
 	}
 	
-	fprintf(fp, "        CPUS: %d\n",
-		machine_type("PPC64") ? get_cpus_to_display() : kt->cpus);
+	if (machine_type("PPC64"))
+		fprintf(fp, "        CPUS: %d\n", get_cpus_to_display());
+	else
+		fprintf(fp, "        CPUS: %d [%d OFFLINE]\n", kt->cpus,
+			kt->cpus - get_cpus_to_display());
 	if (ACTIVE())
 		get_xtime(&kt->date);
         fprintf(fp, "        DATE: %s\n", 
-- 
1.8.5.3

From 7a45a4e7d035c384d84050e5446f2813986e31c1 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Wed, 24 Sep 2014 11:38:25 +0800
Subject: [PATCH v3 09/21] modify set -c to hide offline cpu

With this patch and crash variable "offline" is hide(check command "set -v"),
"set -c" is not able to set to an offline cpu and message like below will be
printed.

<cut>
crash> set -c 2
set invalid cpu number: cpu 2 is OFFLINE
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 kernel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel.c b/kernel.c
index 90e6f79..6dd6daf 100755
--- a/kernel.c
+++ b/kernel.c
 <at>  <at>  -5486,6 +5486,10  <at>  <at>  set_cpu(int cpu)
 	if (cpu >= kt->cpus)
 		error(FATAL, "invalid cpu number: system has only %d cpu%s\n", 
 			kt->cpus, kt->cpus > 1 ? "s" : "");
+
+	if (hide_offline_cpu(cpu))
+		error(FATAL, "invalid cpu number: cpu %d is OFFLINE\n", cpu);
+
 	if ((task = get_active_task(cpu))) 
 		set_context(task, NO_PID);
 	else
-- 
1.8.5.3

From a238e38e8117bf9da221dec40a588bdebef0f5e9 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Wed, 24 Sep 2014 14:53:31 +0800
Subject: [PATCH v3 10/21] modify irq -s to hide offline cpus' data

irq -s will display kernel irq stats. This patch will hide data of
offline cpus

The original output is like below:
<cut>
crash> irq -s
           CPU0       CPU1       CPU2       CPU3
  0:        111          1          0          0  IO-APIC-edge     timer
  1:         71        149        140        155  IO-APIC-edge     i8042
  8:          0          0          0          1  IO-APIC-edge     rtc0
  9:          0          0          0          0  IO-APIC-fasteoi  acpi
...
<cut>

With data of offline cpu(cpu#2) hiden, the output is like below:
<cut>
crash> irq -s
irq: CPU2 is OFFLINE.
           CPU0       CPU1       CPU3
  0:        111          1          0  IO-APIC-edge     timer
  1:         71        149        155  IO-APIC-edge     i8042
  8:          0          0          1  IO-APIC-edge     rtc0
  9:          0          0          0  IO-APIC-fasteoi  acpi
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 kernel.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/kernel.c b/kernel.c
index 6dd6daf..ddf55aa 100755
--- a/kernel.c
+++ b/kernel.c
 <at>  <at>  -5626,9 +5626,18  <at>  <at>  cmd_irq(void)
 				SET_BIT(cpus, i);
 		}

+		for (i = 0; i < kt->cpus; i++) {
+			if (NUM_IN_BITMAP(cpus, i) && hide_offline_cpu(i))
+				error(INFO, "CPU%d is OFFLINE.\n", i);
+		}
+
 		fprintf(fp, "     ");
 		BZERO(buf, 10);
+
 		for (i = 0; i < kt->cpus; i++) {
+			if (hide_offline_cpu(i))
+				continue;
+
 			if (NUM_IN_BITMAP(cpus, i)) {
 				sprintf(buf, "CPU%d", i);
 				fprintf(fp, "%10s ", buf);
 <at>  <at>  -6426,6 +6435,9  <at>  <at>  generic_show_interrupts(int irq, ulong *cpus)
 	fprintf(fp, "%3d: ", irq);

 	for (i = 0; i < kt->cpus; i++) {
+		if (hide_offline_cpu(i))
+			continue;
+
 		if (NUM_IN_BITMAP(cpus, i))
 			fprintf(fp, "%10u ", kstat_irqs[i]);
 	}
-- 
1.8.5.3

From a74f889d9ada5ebe7c86b48f3aa0e3ceb5b9991d Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 25 Sep 2014 10:27:30 +0800
Subject: [PATCH v3 11/21] modify timer -r to hide offline cpus' data

timer -r will display hrtimer. This patch will hide offline cpus.

The original output is like below:
<cut>
crash> timer -r
...
  CLOCK: 2  HRTIMER_CLOCK_BASE: ffff88003fc8e800  [ktime_get_boottime]
  (empty)

CPU: 2  HRTIMER_CPU_BASE: ffff88003fd0e740
  CLOCK: 0  HRTIMER_CLOCK_BASE: ffff88003fd0e780  [ktime_get]
  (empty)

  CLOCK: 1  HRTIMER_CLOCK_BASE: ffff88003fd0e7c0  [ktime_get_real]
  (empty)

  CLOCK: 2  HRTIMER_CLOCK_BASE: ffff88003fd0e800  [ktime_get_boottime]
  (empty)

CPU: 3  HRTIMER_CPU_BASE: ffff88003fd8e740
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> timer -r
...
  CLOCK: 2  HRTIMER_CLOCK_BASE: ffff88003fc8e800  [ktime_get_boottime]
  (empty)

CPU: 2  [OFFLINE]

CPU: 3  HRTIMER_CPU_BASE: ffff88003fd8e740
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 kernel.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel.c b/kernel.c
index ddf55aa..377e03c 100755
--- a/kernel.c
+++ b/kernel.c
 <at>  <at>  -6761,9 +6761,16  <at>  <at>  dump_hrtimer_data(void)
 		option_not_supported('r');

 	hrtimer_bases = per_cpu_symbol_search("hrtimer_bases");
+
 	for (i = 0; i < kt->cpus; i++) {
 		if (i)
 			fprintf(fp, "\n");
+
+		if (hide_offline_cpu(i)) {
+			fprintf(fp, "CPU: %d  [OFFLINE]\n", i);
+			continue;
+		}
+
 		fprintf(fp, "CPU: %d  ", i);
 		if (VALID_STRUCT(hrtimer_clock_base)) {
 			fprintf(fp, "HRTIMER_CPU_BASE: %lx\n",
-- 
1.8.5.3

From 20e61c23ff5671a3799a5860210732cee4fefef5 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 25 Sep 2014 15:01:37 +0800
Subject: [PATCH v3 12/21] modify timer to hide offline cpus' data

This patch will hide timer data of offline cpus.

The original output is like below:
<cut>
crash> timer
...
4310933504  ffffffffa0311750  ffffffff8154f790  <inet_frag_secret_rebuild>
4380688384  ffff880036dae568  ffffffff8157ed30  <ipv6_regen_rndid>
TVEC_BASES[2]: ffff88003db20000
JIFFIES
4310640297
EXPIRES     TIMER_LIST         FUNCTION
TVEC_BASES[3]: ffff88003db44000
  JIFFIES
4310640297
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> timer
...
4310933504  ffffffffa0311750  ffffffff8154f790  <inet_frag_secret_rebuild>
4380688384  ffff880036dae568  ffffffff8157ed30  <ipv6_regen_rndid>
TVEC_BASES[2]: [OFFLINE]
TVEC_BASES[3]: ffff88003db44000
  JIFFIES
4310640297
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 kernel.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel.c b/kernel.c
index 377e03c..c71748d 100755
--- a/kernel.c
+++ b/kernel.c
 <at>  <at>  -7431,6 +7431,16  <at>  <at>  dump_timer_data_tvec_bases_v2(void)
 	cpu = 0;

 next_cpu:
+	/*
+	 * hide data of offline cpu and goto next cpu
+	 */
+
+	if (hide_offline_cpu(cpu)) {
+	        fprintf(fp, "TVEC_BASES[%d]: [OFFLINE]\n", cpu);
+		if (++cpu < kt->cpus)
+			goto next_cpu;
+	}
+

 	count = 0;
 	td = (struct timer_data *)NULL;
-- 
1.8.5.3

From d5bb07dc5f046bfee2b9f8eaa200fe04e1baf754 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 2 Oct 2014 11:23:22 +0800
Subject: [PATCH v3 13/21] modify ptov offset:cpuspec to indicate offline cpus'
 data

ptov offset:cpuspec can be used to translate per-cpu offset to kernel
virtual address. This patch will indicate data of offline cpu.

The original output is like below:
<cut>
crash> ptov bfa0:a
PER-CPU OFFSET: bfa0
  CPU    VIRTUAL
  [0]  ffff88003fc0bfa0
  [1]  ffff88003fc8bfa0
  [2]  ffff88003fd0bfa0
  [3]  ffff88003fd8bfa0
<cut>

With crash variable offline set to "hide", the output is like below:
<cut>
crash> ptov bfa0:a
PER-CPU OFFSET: bfa0
  CPU    VIRTUAL
  [0]  ffff88003fc0bfa0
  [1]  ffff88003fc8bfa0
  [2]  ffff88003fd0bfa0 <OFFLINE>
  [3]  ffff88003fd8bfa0
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 memory.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/memory.c b/memory.c
index 518c917..6b64e21 100755
--- a/memory.c
+++ b/memory.c
 <at>  <at>  -3192,9 +3192,14  <at>  <at>  cmd_ptov(void)
 					continue;
 				vaddr = paddr + kt->__per_cpu_offset[c];
 				sprintf(buf1, "[%d]", c);
-				fprintf(fp, "  %s%lx\n", 
-			    		mkstring(buf2, len, LJUST, buf1),
+				fprintf(fp, "  %s%lx",
+					mkstring(buf2, len, LJUST, buf1),
 					vaddr);
+
+				if (hide_offline_cpu(c))
+					fprintf(fp, " [OFFLINE]\n");
+				else
+					fprintf(fp, "\n");
 			}
 			FREEBUF(cpus);
 		} else {
-- 
1.8.5.3

From 7a5b0d9eb6642b994451c328d748b2e4481d23e0 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 25 Sep 2014 15:35:35 +0800
Subject: [PATCH v3 14/21] fix max_cpudata_limit() when offlined cpu exists

When determining the largest cpudata limit for kmem_cache, the member,
limit, of kmem_cache.array[NR_CPUS] is needed, and the process will
stop when kmem_cache.array[cpu] equals to NULL. However, when offline
cpus exist, kmem_cache.array[cpu] of offline cpus are alse NULL. Then
the process of determining the largest cpudata limit will ignore the
cpus after the offlined cpu.

This patch is used to fix the above problem.

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 memory.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/memory.c b/memory.c
index 6b64e21..c321b77 100755
--- a/memory.c
+++ b/memory.c
 <at>  <at>  -9182,7 +9182,13  <at>  <at>  kmem_cache_s_array_nodes:
             "array cache array", RETURN_ON_ERROR))
 		goto bail_out;

-	for (i = max_limit = 0; (i < kt->cpus) && cpudata[i]; i++) {
+	for (i = max_limit = 0; i < kt->cpus; i++) {
+		if (check_offline_cpu(i))
+			continue;
+
+		if (!cpudata[i])
+			break;
+
                 if (!readmem(cpudata[i]+OFFSET(array_cache_limit),
                     KVADDR, &limit, sizeof(int),
                     "array cache limit", RETURN_ON_ERROR)) {
-- 
1.8.5.3

From 72f372ed3361049a6051442c2bbd8cedea384698 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 2 Oct 2014 11:29:03 +0800
Subject: [PATCH v3 15/21] modify kmem -o to indicate offline cpus' data

kmem -o is used to display each cpu's offset value that is added
to per-cpu symbol values to translate them into kernel virtual
addresses. This patch will indicate data of offline cpus.

The original output is like below:
<cut>
crash> kmem -o
PER-CPU OFFSET VALUES:
  CPU 0: ffff88003fc00000
  CPU 1: ffff88003fc80000
  CPU 2: ffff88003fd00000
  CPU 3: ffff88003fd80000
<cut>

With crash variable offline set to "hide", the output is like below:
<cut>
crash> kmem -o
PER-CPU OFFSET VALUES:
  CPU 0: ffff88003fc00000
  CPU 1: ffff88003fc80000
  CPU 2: ffff88003fd00000 [OFFLINE]
  CPU 3: ffff88003fd80000
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 memory.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/memory.c b/memory.c
index c321b77..0d9849b 100755
--- a/memory.c
+++ b/memory.c
 <at>  <at>  -17017,7 +17017,13  <at>  <at>  dump_per_cpu_offsets(void)

 	for (c = 0; c < kt->cpus; c++) {
 		sprintf(buf, "CPU %d", c);
-		fprintf(fp, "%7s: %lx\n", buf, kt->__per_cpu_offset[c]);
+		fprintf(fp, "%7s: %lx", buf, kt->__per_cpu_offset[c]);
+
+		if(hide_offline_cpu(c))
+			fprintf(fp, " [OFFLINE]\n");
+		else
+			fprintf(fp, "\n");
+
 	}
 }

-- 
1.8.5.3

From 3bd76b38066acdd78619089544a89eff30f68462 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 25 Sep 2014 16:30:57 +0800
Subject: [PATCH v3 16/21] modify kmem -S(SLUB) to hide offline cpus' data

if SLUB is configured, kmem -S will display per-cpu data. This patch
will hide data of offline cpu.

The original output is like below:
<cut>
crash> kmem -S
...
CPU 1 KMEM_CACHE_CPU:
  ffff88003fc97360
CPU 1 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000dc0d40  ffff880037035000     0     16         11     5
  FREE / [ALLOCATED]
  [ffff880037035000]
  [ffff880037035100]
...
  [ffff88003c6e0f00]
CPU 2 KMEM_CACHE_CPU:
  ffff88003fd17360
CPU 2 SLAB:
  (empty)
CPU 2 PARTIAL:
  (empty)
CPU 3 KMEM_CACHE_CPU:
  ffff88003fd97360
CPU 3 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000ed8f80  ffff88003b63e000     0     16         13     3
  FREE / [ALLOCATED]
  [ffff88003b63e000]
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> kmem -S
...
CPU 1 KMEM_CACHE_CPU:
  ffff88003fc97360
CPU 1 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000dc0d40  ffff880037035000     0     16         11     5
  FREE / [ALLOCATED]
  [ffff880037035000]
  [ffff880037035100]
...
  [ffff88003c6e0f00]
CPU 2 [OFFLINE]
CPU 3 KMEM_CACHE_CPU:
  ffff88003fd97360
CPU 3 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000ed8f80  ffff88003b63e000     0     16         13     3
  FREE / [ALLOCATED]
  [ffff88003b63e000]
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 memory.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/memory.c b/memory.c
index 0d9849b..60a789f 100755
--- a/memory.c
+++ b/memory.c
 <at>  <at>  -17468,6 +17468,11  <at>  <at>  do_kmem_cache_slub(struct meminfo *si)
 	per_cpu = (ulong *)GETBUF(sizeof(ulong) * vt->numnodes);

         for (i = 0; i < kt->cpus; i++) {
+		if (hide_offline_cpu(i)) {
+			fprintf(fp, "CPU %d [OFFLINE]\n", i);
+			continue;
+		}
+
 		cpu_slab_ptr = ULONG(si->cache_buf + OFFSET(kmem_cache_cpu_slab)) +
 				kt->__per_cpu_offset[i];
 		fprintf(fp, "CPU %d KMEM_CACHE_CPU:\n  %lx\n", i, cpu_slab_ptr);
-- 
1.8.5.3

From aaf03675a7735624c56030087d5841e7a9ae2ce5 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 25 Sep 2014 16:45:11 +0800
Subject: [PATCH v3 17/21] modify struct/union/* [:cpuspec] to hide offline
 cpus' data

with [:cpuspec] struct/union/* will display per-cpu structure/union of the
specified cpus. This patch will hide data of offline cpus.

The original output is like below:
<cut>
crash> call_function_data 15080:a
[0]: ffff88003fc15080
struct call_function_data {
  csd = 0x177e8,
...
  cpumask = 0xffff88003daf4000,
  cpumask_ipi = 0xffff88003daf4400
}
[2]: ffff88003fd15080
struct call_function_data {
  csd = 0x18248,
  cpumask = 0xffff88003daf4800,
  cpumask_ipi = 0xffff88003daf4c00
}
[3]: ffff88003fd95080
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> call_function_data 15080:a
[0]: ffff88003fc15080
struct call_function_data {
  csd = 0x177e8,
...
  cpumask = 0xffff88003daf4000,
  cpumask_ipi = 0xffff88003daf4400
}
[2]: [OFFLINE]
[3]: ffff88003fd95080
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 symbols.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/symbols.c b/symbols.c
index a0f256e..c5c760f 100755
--- a/symbols.c
+++ b/symbols.c
 <at>  <at>  -6147,7 +6147,15  <at>  <at>  cmd_datatype_common(ulong flags)
 				continue;

 			cpuaddr = addr + kt->__per_cpu_offset[c];
-			fprintf(fp, "[%d]: %lx\n", c, cpuaddr);
+
+			fprintf(fp, "[%d]: ", c);
+
+			if (hide_offline_cpu(c)) {
+				fprintf(fp, "[OFFLINE]\n");
+				continue;
+			}
+
+			fprintf(fp, "%lx\n", cpuaddr);
 			do_datatype_addr(dm, cpuaddr , count,
 					 flags, memberlist, argc_members);
 		}
-- 
1.8.5.3

From 62e33a19d02bbecf8838911be473f395d9fbd548 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Thu, 25 Sep 2014 17:22:36 +0800
Subject: [PATCH v3 18/21] modify command p to hide offline cpus' data

command p can be used to display data of per-cpu symbol. This patch is
used to hide data of offline cpus.

The original output is like below:
<cut>
crash> p cpu_number:a
per_cpu(cpu_number, 0) = $1 = 0
per_cpu(cpu_number, 1) = $2 = 1
per_cpu(cpu_number, 2) = $3 = 2
per_cpu(cpu_number, 3) = $4 = 3
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> p cpu_number:a
per_cpu(cpu_number, 0) = $1 = 0
per_cpu(cpu_number, 1) = $2 = 1
cpu 2 is OFFLINE.
per_cpu(cpu_number, 3) = $3 = 3
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 symbols.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/symbols.c b/symbols.c
index c5c760f..8aee32a 100755
--- a/symbols.c
+++ b/symbols.c
 <at>  <at>  -6847,6 +6847,11  <at>  <at>  display_per_cpu_info(struct syment *sp, int radix, char *cpuspec)
 		module_symbol(sp->value, NULL, NULL, NULL, *gdb_output_radix);

 	for (c = 0; c < kt->cpus; c++) {
+		if (hide_offline_cpu(c)) {
+			fprintf(fp, "cpu %d is OFFLINE.\n", c);
+			continue;
+		}
+
 		if (cpus && !NUM_IN_BITMAP(cpus, c))
 			continue;
 		addr = sp->value + kt->__per_cpu_offset[c];
-- 
1.8.5.3

From 3aacee0f369acbef16743746c1314910bbc3cd62 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Sat, 27 Sep 2014 15:04:22 +0800
Subject: [PATCH v3 19/21] modify ps -l/-m -C cpu to hide offline cpus' data

ps -l/-m -C cpu is used to dump most-recently run tasks on specified
cpus. This patch is used to hide data of offline cpus.

The original output is like below:
<cut>
crash> ps -l -C 2
CPU: 2
[ 3443744250246] [??]  PID: 25     TASK: ffff88003dafb8e0  CPU: 2   COMMAND: "migration/2"
[ 3443744209862] [??]  PID: 24     TASK: ffff88003dafad80  CPU: 2   COMMAND: "watchdog/2"
...
[     501159134] [IN]  PID: 52     TASK: ffff88003d4a38e0  CPU: 2   COMMAND: "crypto"
[     409792745] [IN]  PID: 48     TASK: ffff88003d4a4440  CPU: 2   COMMAND: "kswapd0"
[             0] [RU]  PID: 0      TASK: ffff88003dad5b00  CPU: 2   COMMAND: "swapper/2"
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> ps -l -C 2
CPU: 2 [OFFLINE]
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 task.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/task.c b/task.c
index 53fc060..86be744 100755
--- a/task.c
+++ b/task.c
 <at>  <at>  -3332,8 +3332,14  <at>  <at>  show_last_run(struct task_context *tc, struct psinfo *psi)
 		for (c = others = 0; c < kt->cpus; c++) {
 			if (!NUM_IN_BITMAP(psi->cpus, c))
 				continue;
-			fprintf(fp, "%sCPU: %d\n", 
+			fprintf(fp, "%sCPU: %d",
 				others++ ? "\n" : "", c);
+			if (hide_offline_cpu(c)) {
+				fprintf(fp, " [OFFLINE]\n");
+				continue;
+			} else
+				fprintf(fp, "\n");
+
 			tcp = FIRST_CONTEXT();
 			for (i = 0; i < RUNNING_TASKS(); i++, tcp++) {
 				if (tcp->processor != c)
 <at>  <at>  -3415,9 +3421,15  <at>  <at>  show_milliseconds(struct task_context *tc, struct psinfo *psi)
 			if (!NUM_IN_BITMAP(psi->cpus, c))
 				continue;

-			fprintf(fp, "%sCPU: %d\n", 
+			fprintf(fp, "%sCPU: %d",
 				others++ ? "\n" : "", c);

+			if (hide_offline_cpu(c)) {
+				fprintf(fp, " [OFFLINE]\n");
+				continue;
+			} else
+				fprintf(fp, "\n");
+
 			if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF))
 				runq = rq_sp->value + kt->__per_cpu_offset[c];
 			else
-- 
1.8.5.3

From 7bc0b00bd90f5ae1bb8baa22027277817350c656 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Sun, 28 Sep 2014 16:22:26 +0800
Subject: [PATCH v3 20/21] modify runq to hide offline cpus' data

With the patch, runq [-t/-m/-g/-d] can hide data on offline cpus.

The original output of thest command is like below:
<cut>
crash> runq
CPU 0 RUNQUEUE: ffff88002c216680
  CURRENT: PID: 0      TASK: ffffffff81a8d020  COMMAND: "swapper"
  RT PRIO_ARRAY: ffff88002c216808
     [no tasks queued]
  CFS RB_ROOT: ffff88002c216718
     [no tasks queued]

...
CPU 3 RUNQUEUE: ffff88002c396680
  CURRENT: PID: 0      TASK: ffff880219f9aaa0  COMMAND: "swapper"
  RT PRIO_ARRAY: ffff88002c396808
     [no tasks queued]
  CFS RB_ROOT: ffff88002c396718
     [no tasks queued]
crash> runq -t
 CPU 0: 107470918732460
        000000000000000  PID: 0      TASK: ffffffff81a8d020  COMMAND: "swapper"
 CPU 1: 107470922094506
        000000000000000  PID: 0      TASK: ffff880219f5b540  COMMAND: "swapper"
 CPU 2: 107470921985118
        107470921000315  PID: 16905  TASK: ffff88018f6e3500  COMMAND: "crash"
 CPU 3: 15082503595357
        00000000000000  PID: 0      TASK: ffff880219f9aaa0  COMMAND: "swapper"
crash> runq -m
 CPU 0: [1 05:51:25.919]  PID: 0      TASK: ffffffff81a8d020  COMMAND: "swapper"
 CPU 1: [0 00:00:00.002]  PID: 16905  TASK: ffff88018f6e3500  COMMAND: "crash"
 CPU 2: [1 05:51:25.911]  PID: 0      TASK: ffff880219f64040  COMMAND: "swapper"
 CPU 3: [0 04:11:22.503]  PID: 0      TASK: ffff880219f9aaa0  COMMAND: "swapper"
crash> runq -g
CPU 0
  CURRENT: PID: 0      TASK: ffffffff81a8d020  COMMAND: "swapper"
  INIT_TASK_GROUP: ffffffff81e1f780  RT_RQ: ffff88002c216808
     [no tasks queued]
  INIT_TASK_GROUP: ffffffff81e1f780  CFS_RQ: ffff88002c2166e8
     [no tasks queued]

...
CPU 3
  CURRENT: PID: 0      TASK: ffff880219f9aaa0  COMMAND: "swapper"
  INIT_TASK_GROUP: ffffffff81e1f780  RT_RQ: ffff88002c396808
     [no tasks queued]
  INIT_TASK_GROUP: ffffffff81e1f780  CFS_RQ: ffff88002c3966e8
     [no tasks queued]
crash> runq -d
CPU 0
     [no tasks queued]

CPU 1
     [120] PID: 2760   TASK: ffff88021305aaa0  COMMAND: "Xorg"

CPU 2
     [120] PID: 16905  TASK: ffff88018f6e3500  COMMAND: "crash"

CPU 3
     [no tasks queued]
<cut>

With data of offline cpu(cpu #3) hiden, the output is like below:
<cut>
crash> runq
CPU 0 RUNQUEUE: ffff88002c216680
  CURRENT: PID: 0      TASK: ffffffff81a8d020  COMMAND: "swapper"
  RT PRIO_ARRAY: ffff88002c216808
     [no tasks queued]
  CFS RB_ROOT: ffff88002c216718
     [no tasks queued]

...
CPU 2 RUNQUEUE: ffff88002c316680
  CURRENT: PID: 16905  TASK: ffff88018f6e3500  COMMAND: "crash"
  RT PRIO_ARRAY: ffff88002c316808
     [no tasks queued]
  CFS RB_ROOT: ffff88002c316718
     [no tasks queued]

CPU 3 [OFFLINE]
crash> runq -t
 CPU 0: 107605503006397
        107605495037692  PID: 16905  TASK: ffff88018f6e3500  COMMAND: "crash"
 CPU 1: 107605503645955
        000000000000000  PID: 0      TASK: ffff880219f5b540  COMMAND: "swapper"
 CPU 2: 107605500267130
        000000000000000  PID: 0      TASK: ffff880219f64040  COMMAND: "swapper"
 CPU 3: [OFFLINE]
crash> runq -m
 CPU 0: [1 05:53:41.958]  PID: 0      TASK: ffffffff81a8d020  COMMAND: "swapper"
 CPU 1: [1 05:53:41.959]  PID: 0      TASK: ffff880219f5b540  COMMAND: "swapper"
 CPU 2: [0 00:00:00.000]  PID: 16905  TASK: ffff88018f6e3500  COMMAND: "crash"
 CPU 3: [OFFLINE]
crash> runq -g
CPU 0
  CURRENT: PID: 0      TASK: ffffffff81a8d020  COMMAND: "swapper"
  INIT_TASK_GROUP: ffffffff81e1f780  RT_RQ: ffff88002c216808
     [no tasks queued]
  INIT_TASK_GROUP: ffffffff81e1f780  CFS_RQ: ffff88002c2166e8
     [no tasks queued]

...
CPU 2
  CURRENT: PID: 0      TASK: ffff880219f64040  COMMAND: "swapper"
  INIT_TASK_GROUP: ffffffff81e1f780  RT_RQ: ffff88002c316808
     [no tasks queued]
  INIT_TASK_GROUP: ffffffff81e1f780  CFS_RQ: ffff88002c3166e8
     [no tasks queued]

CPU 3 [OFFLINE]
crash> runq -d
CPU 0
     [no tasks queued]

CPU 1
     [120] PID: 16905  TASK: ffff88018f6e3500  COMMAND: "crash"

CPU 2
     [no tasks queued]

CPU 3 [OFFLINE]
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 task.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 41 insertions(+), 8 deletions(-)

diff --git a/task.c b/task.c
index 86be744..b8ff658 100755
--- a/task.c
+++ b/task.c
 <at>  <at>  -7619,8 +7619,14  <at>  <at>  dump_on_rq_timestamp(void)

                 sprintf(buf, pc->output_radix == 10 ? "%llu" : "%llx",
 			timestamp);
-		fprintf(fp, "%sCPU %d: %s\n", cpu < 10 ? " " : "", 
-			cpu, buf);
+		fprintf(fp, "%sCPU %d: ", cpu < 10 ? " " : "", cpu);
+
+		if (hide_offline_cpu(cpu)) {
+			fprintf(fp, "[OFFLINE]\n");
+			continue;
+		} else
+			fprintf(fp, "%s\n", buf);
+
 		len = strlen(buf);

 		if ((tc = task_to_context(tt->active_set[cpu]))){
 <at>  <at>  -7699,6 +7705,11  <at>  <at>  dump_on_rq_milliseconds(void)
 		else
 			indent = max_indent - 4;

+		if (hide_offline_cpu(cpu)) {
+			fprintf(fp, "%sCPU %d: [OFFLINE]\n", space(indent), cpu);
+			continue;
+		}
+
 		if ((tc = task_to_context(tt->active_set[cpu])))
 			task_timestamp = task_last_run(tc->task);
 		else { 
 <at>  <at>  -7826,8 +7837,13  <at>  <at>  dump_runqueues(void)
 				runq = rq_sp->value;
 		}

-		fprintf(fp, "%sCPU %d RUNQUEUE: %lx\n", cpu ? "\n" : "", 
-			cpu, runq);
+		fprintf(fp, "%sCPU %d ", cpu ? "\n" : "", cpu);
+
+		if (hide_offline_cpu(cpu)) {
+			fprintf(fp, "[OFFLINE]\n");
+			continue;
+		} else
+			fprintf(fp, "RUNQUEUE: %lx\n", runq);

 		fprintf(fp, "  CURRENT: ");
 		if ((tc = task_to_context(tt->active_set[cpu])))
 <at>  <at>  -8281,8 +8297,13  <at>  <at>  dump_on_rq_tasks(void)
 	}

 	for (cpu = 0; cpu < kt->cpus; cpu++) {
+                fprintf(fp, "%sCPU %d", cpu ? "\n" : "", cpu);

-                fprintf(fp, "%sCPU %d\n", cpu ? "\n" : "", cpu);
+		if (hide_offline_cpu(cpu)) {
+			fprintf(fp, " [OFFLINE]\n");
+			continue;
+		} else
+			fprintf(fp, "\n");

 		tc = FIRST_CONTEXT();
 		tot = 0;
 <at>  <at>  -8415,8 +8436,13  <at>  <at>  dump_CFS_runqueues(void)
 		else
 			runq = rq_sp->value;

-                fprintf(fp, "%sCPU %d RUNQUEUE: %lx\n", cpu ? "\n" : "",
-			cpu, runq);
+                fprintf(fp, "%sCPU %d ", cpu ? "\n" : "", cpu);
+
+		if (hide_offline_cpu(cpu)) {
+			fprintf(fp, "[OFFLINE]\n");
+			continue;
+		} else
+			fprintf(fp, "RUNQUEUE: %lx\n", runq);

 		fprintf(fp, "  CURRENT: ");
 		if ((tc = task_to_context(tt->active_set[cpu])))
 <at>  <at>  -8908,7 +8934,14  <at>  <at>  dump_tasks_by_task_group(void)
 			sizeof(ulong), "task_group rt_rq", FAULT_ON_ERROR);
 		readmem(cfs_rq + cpu * sizeof(ulong), KVADDR, &cfs_rq_p,
 			sizeof(ulong), "task_group cfs_rq", FAULT_ON_ERROR);
-		fprintf(fp, "%sCPU %d\n", cpu ? "\n" : "", cpu);
+		fprintf(fp, "%sCPU %d", cpu ? "\n" : "", cpu);
+
+		if (hide_offline_cpu(cpu)) {
+			fprintf(fp, " [OFFLINE]\n");
+			continue;
+		} else
+			fprintf(fp, "\n");
+
 		fprintf(fp, "  CURRENT: ");
 		if ((tc = task_to_context(tt->active_set[cpu])))
 			fprintf(fp, "PID: %-5ld  TASK: %lx  COMMAND: \"%s\"\n",
-- 
1.8.5.3

From 4ca96fe2948ef5697a691ad10eb57262044e3bd0 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Fri, 3 Oct 2014 11:38:25 +0800
Subject: [PATCH v3 21/21] modify ps to indicate swapper task on offline cpu

this patch will make ps command display "-" preceding the information of
swapper task on offline cpu, instead of ">".

The original output is like below:
<cut>
   PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
>     0      0   0  ffffffff818d5440  RU   0.0       0      0  [swapper/0]
>     0      0   1  ffff88003dad4fa0  RU   0.0       0      0  [swapper/1]
>     0      0   2  ffff88003dad5b00  RU   0.0       0      0  [swapper/2]
>     0      0   3  ffff88003dad6660  RU   0.0       0      0  [swapper/3]
      1      0   1  ffff88003da98000  IN   0.7   50792   7056  systemd
      2      0   3  ffff88003da98b60  IN   0.0       0      0  [kthreadd]
...
<cut>

With crash variable "offline" set to "hide", the output will be like below:
<cut>
   PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
>     0      0   0  ffffffff818d5440  RU   0.0       0      0  [swapper/0]
>     0      0   1  ffff88003dad4fa0  RU   0.0       0      0  [swapper/1]
-     0      0   2  ffff88003dad5b00  RU   0.0       0      0  [swapper/2]
>     0      0   3  ffff88003dad6660  RU   0.0       0      0  [swapper/3]
      1      0   1  ffff88003da98000  IN   0.7   50792   7056  systemd
      2      0   3  ffff88003da98b60  IN   0.0       0      0  [kthreadd]
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 help.c |  4 +++-
 task.c | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/help.c b/help.c
index a6f834d..ad42dbf 100755
--- a/help.c
+++ b/help.c
 <at>  <at>  -1267,7 +1267,9  <at>  <at>  char *help_ps[] = {
 "       -s  replace the TASK column with the KSTACKP column.",
 " ",
 "  On SMP machines, the active task on each CPU will be highlighted by an",
-"  angle bracket (\">\") preceding its information.",
+"  angle bracket (\">\") preceding its information. And If the crash variable",
+"  \"offline\" is \"hide\", the active task on offline CPU will be highlighted",
+"  by \"-\"",
 " ",
 "  Alternatively, information regarding parent-child relationships,",
 "  per-task time usage data, argument/environment data, thread groups,",
diff --git a/task.c b/task.c
index b8ff658..d52d424 100755
--- a/task.c
+++ b/task.c
 <at>  <at>  -3093,6 +3093,7  <at>  <at>  show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)
 	char buf2[BUFSIZE];
 	char buf3[BUFSIZE];
 	ulong tgid;
+	int task_active;

 	if ((flag & PS_USER) && is_kernel_thread(tc->task))
 		return;
 <at>  <at>  -3153,7 +3154,17  <at>  <at>  show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)

 	tm = &task_mem_usage;
 	get_task_mem_usage(tc->task, tm);
-	fprintf(fp, "%s", is_task_active(tc->task) ? "> " : "  ");
+
+	task_active = is_task_active(tc->task);
+
+	if (task_active) {
+		if (hide_offline_cpu(tc->processor))
+			fprintf(fp, "- ");
+		else
+			fprintf(fp, "> ");
+	} else
+		fprintf(fp, "  ");
+
 	fprintf(fp, "%5ld  %5ld  %2s  %s %3s",
 		tc->pid, task_to_pid(tc->ptask),
 		task_cpu(tc->processor, buf2, !VERBOSE),
-- 
1.8.5.3

From 4ca96fe2948ef5697a691ad10eb57262044e3bd0 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
Date: Fri, 3 Oct 2014 11:38:25 +0800
Subject: [PATCH v3 21/21] modify ps to indicate swapper task on offline cpu

this patch will make ps command display "-" preceding the information of
swapper task on offline cpu, instead of ">".

The original output is like below:
<cut>
   PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
>     0      0   0  ffffffff818d5440  RU   0.0       0      0  [swapper/0]
>     0      0   1  ffff88003dad4fa0  RU   0.0       0      0  [swapper/1]
>     0      0   2  ffff88003dad5b00  RU   0.0       0      0  [swapper/2]
>     0      0   3  ffff88003dad6660  RU   0.0       0      0  [swapper/3]
      1      0   1  ffff88003da98000  IN   0.7   50792   7056  systemd
      2      0   3  ffff88003da98b60  IN   0.0       0      0  [kthreadd]
...
<cut>

With crash variable "offline" set to "hide", the output will be like below:
<cut>
   PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
>     0      0   0  ffffffff818d5440  RU   0.0       0      0  [swapper/0]
>     0      0   1  ffff88003dad4fa0  RU   0.0       0      0  [swapper/1]
-     0      0   2  ffff88003dad5b00  RU   0.0       0      0  [swapper/2]
>     0      0   3  ffff88003dad6660  RU   0.0       0      0  [swapper/3]
      1      0   1  ffff88003da98000  IN   0.7   50792   7056  systemd
      2      0   3  ffff88003da98b60  IN   0.0       0      0  [kthreadd]
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan <at> cn.fujitsu.com>
---
 help.c |  4 +++-
 task.c | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/help.c b/help.c
index a6f834d..ad42dbf 100755
--- a/help.c
+++ b/help.c
 <at>  <at>  -1267,7 +1267,9  <at>  <at>  char *help_ps[] = {
 "       -s  replace the TASK column with the KSTACKP column.",
 " ",
 "  On SMP machines, the active task on each CPU will be highlighted by an",
-"  angle bracket (\">\") preceding its information.",
+"  angle bracket (\">\") preceding its information. And If the crash variable",
+"  \"offline\" is \"hide\", the active task on offline CPU will be highlighted",
+"  by \"-\"",
 " ",
 "  Alternatively, information regarding parent-child relationships,",
 "  per-task time usage data, argument/environment data, thread groups,",
diff --git a/task.c b/task.c
index b8ff658..d52d424 100755
--- a/task.c
+++ b/task.c
 <at>  <at>  -3093,6 +3093,7  <at>  <at>  show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)
 	char buf2[BUFSIZE];
 	char buf3[BUFSIZE];
 	ulong tgid;
+	int task_active;

 	if ((flag & PS_USER) && is_kernel_thread(tc->task))
 		return;
 <at>  <at>  -3153,7 +3154,17  <at>  <at>  show_ps_data(ulong flag, struct task_context *tc, struct psinfo *psi)

 	tm = &task_mem_usage;
 	get_task_mem_usage(tc->task, tm);
-	fprintf(fp, "%s", is_task_active(tc->task) ? "> " : "  ");
+
+	task_active = is_task_active(tc->task);
+
+	if (task_active) {
+		if (hide_offline_cpu(tc->processor))
+			fprintf(fp, "- ");
+		else
+			fprintf(fp, "> ");
+	} else
+		fprintf(fp, "  ");
+
 	fprintf(fp, "%5ld  %5ld  %2s  %s %3s",
 		tc->pid, task_to_pid(tc->ptask),
 		task_cpu(tc->processor, buf2, !VERBOSE),
--

-- 
1.8.5.3

Pete Delaney | 2 Oct 05:18 2014

gdb on KDUMP files

Hi:

 

Six years ago Dave and I were discussing using gdb on KDUMP files:

                http://www.redhat.com/archives/crash-utility/2008-March/msg00039.html

 

At the time you weren’t sure of gdb could read 64bit elf headers.

 

I’m trying to look at KDUMP files with gdb and seeing similar problems.

I configured and built gdb with –enable-largefile but it didn’t help.

I also tried uncommenting _LARGE_FILE in gdb/config.h thought I doubt that’s correct.

 

 

Wondering what’s been done in the last six years on this. The kernel I’m

Running with is only using 4GB but is running in 64 bit mode.

Looking at the kexec src if seems KEXEC use to support:

 

            #   KEXEC_ARGS="--elf32-core-headers"

 

This was used to force the dump to be elf32 just so gdb could read the core file

It appears that this support was dropped for 64 bit machines by Vivek Goyak

Who seems was concerned for the health of the crash utility:

 

    http://lse.sourceforge.net/kdump/patches/1.101-kdump10/broken-out/x86_64-kdump-remove-elf32-core-header-support.patch

 


The Linux kernel Documentation/kdump/kdump.txt was last

Updated on July 4th of this year and clearly says that gdb can

Read KDUMP files but says the crash-dumping kernel should

Be started with --elf32-core-headers kernel option:

 

420 Analysis

421 ========

422

423 Before analyzing the dump image, you should reboot into a stable kernel.

424

425 You can do limited analysis using GDB on the dump file copied out of

426 /proc/vmcore. Use the debug vmlinux built with -g and run the following

427 command:

428

429    gdb vmlinux <dump-file>

430

431 Stack trace for the task on processor 0, register display, and memory

432 display work fine.

433

434 Note: GDB cannot analyze core files generated in ELF64 format for x86.

435 On systems with a maximum of 4GB of memory, you can generate

436 ELF32-format headers using the --elf32-core-headers kernel option on the

437 dump kernel.

 

But I can’t fine the string elf32-core-headers in the kernel source code.

 

Looking at the gdb Bugzilla page:

 

https://sourceware.org/bugzilla/buglist.cgi?quicksearch=elf64

 

Reading a few bug reports seems to indicate that gdb supports 64 bit elf.

 

I’m just trying to get the normal stack back-trace to work,

With formal and local variables, from a crash dump as well

as mapping the normal kernel memory so I can follow list like

that for the the system tasks.

 

With gdb I can read the init_task with both gdb and crash but can only

follow the list with crash.

 

Anyone know what’s going on?

 

--

Pete/Piet Delaney                                              

O: +1 408 935-1813

C: +1 408 646-8557

H: +1 408 243-8872

Home Email: piet.delaney <at> gmail.com

 

 

 

<div>
<div class="WordSection1">
<p class="MsoNormal">Hi:<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Six years ago Dave and I were discussing using gdb on KDUMP files:<br><br><p></p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.redhat.com/archives/crash-utility/2008-March/msg00039.html">
http://www.redhat.com/archives/crash-utility/2008-March/msg00039.html</a><p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">At the time you weren&rsquo;t sure of gdb could read 64bit elf headers.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I&rsquo;m trying to look at KDUMP files with gdb and seeing similar problems.<p></p></p>
<p class="MsoNormal">I configured and built gdb with &ndash;enable-largefile but it didn&rsquo;t help.<p></p></p>
<p class="MsoNormal">I also tried uncommenting _LARGE_FILE in gdb/config.h thought I doubt that&rsquo;s correct.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Wondering what&rsquo;s been done in the last six years on this. The kernel I&rsquo;m<p></p></p>
<p class="MsoNormal">Running with is only using 4GB but is running in 64 bit mode.<p></p></p>
<p class="MsoNormal"><p></p></p>
<p class="MsoNormal">Looking at the kexec src if seems KEXEC use to support:<p></p></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp; KEXEC_ARGS="--elf32-core-headers"<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>This was used to force the dump to be elf32 just so gdb could read the core file<p></p></span></p>
<p class="MsoNormal"><span>It appears that this support was dropped for 64 bit machines by Vivek Goyak
<p></p></span></p>
<p class="MsoNormal"><span>Who seems was concerned for the health of the crash utility:<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp; http://lse.sourceforge.net/kdump/patches/1.101-kdump10/broken-out/x86_64-kdump-remove-elf32-core-header-support.patch<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><br>
The Linux kernel Documentation/kdump/kdump.txt was last<p></p></span></p>
<p class="MsoNormal"><span>Updated on July 4th of this year and clearly says that gdb can<p></p></span></p>
<p class="MsoNormal"><span>Read KDUMP files but says the crash-dumping kernel should<p></p></span></p>
<p class="MsoNormal"><span>Be started with --elf32-core-headers kernel option:<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>420 Analysis<p></p></span></p>
<p class="MsoNormal"><span>421 ========<p></p></span></p>
<p class="MsoNormal"><span>422<p></p></span></p>
<p class="MsoNormal"><span>423 Before analyzing the dump image, you should reboot into a stable kernel.<p></p></span></p>
<p class="MsoNormal"><span>424<p></p></span></p>
<p class="MsoNormal"><span>425 You can do limited analysis using GDB on the dump file copied out of<p></p></span></p>
<p class="MsoNormal"><span>426 /proc/vmcore. Use the debug vmlinux built with -g and run the following<p></p></span></p>
<p class="MsoNormal"><span>427 command:<p></p></span></p>
<p class="MsoNormal"><span>428<p></p></span></p>
<p class="MsoNormal"><span>429&nbsp;&nbsp;&nbsp;
gdb vmlinux &lt;dump-file&gt;<p></p></span></p>
<p class="MsoNormal"><span>430<p></p></span></p>
<p class="MsoNormal"><span>431 Stack trace for the task on processor 0, register display, and memory<p></p></span></p>
<p class="MsoNormal"><span>432 display work fine.<p></p></span></p>
<p class="MsoNormal"><span>433<p></p></span></p>
<p class="MsoNormal"><span>434 Note: GDB cannot analyze core files generated in ELF64 format for x86.<p></p></span></p>
<p class="MsoNormal"><span>435 On systems with a maximum of 4GB of memory, you can generate<p></p></span></p>
<p class="MsoNormal"><span>436 ELF32-format headers using the
--elf32-core-headers kernel option on the<p></p></span></p>
<p class="MsoNormal"><span>437 dump kernel.<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>But I can&rsquo;t fine the string
</span><span>elf32-core-headers
</span><span>in the kernel source code.
<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>Looking at the gdb Bugzilla page:<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span><a href="https://sourceware.org/bugzilla/buglist.cgi?quicksearch=elf64">https://sourceware.org/bugzilla/buglist.cgi?quicksearch=elf64</a><p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>Reading a few bug reports seems to indicate that gdb supports 64 bit elf.<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>I&rsquo;m just trying to get the normal stack back-trace to work,<p></p></span></p>
<p class="MsoNormal"><span>With formal and local variables, from a crash dump as well
<p></p></span></p>
<p class="MsoNormal"><span>as mapping the normal kernel memory so I can follow list like
<p></p></span></p>
<p class="MsoNormal"><span>that for the the system tasks.<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>With gdb I can read the init_task with both gdb and crash but can only<p></p></span></p>
<p class="MsoNormal"><span>follow the list with crash.<p></p></span></p>
<p class="MsoNormal"><span><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span>Anyone know what&rsquo;s going on?<p></p></span></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">--<p></p></p>
<p class="MsoNormal">Pete/Piet Delaney&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p></p></p>
<p class="MsoNormal">O: +1 408 935-1813<p></p></p>
<p class="MsoNormal">C: +1 408 646-8557<p></p></p>
<p class="MsoNormal">H: +1 408 243-8872<p></p></p>
<p class="MsoNormal">Home Email: <a href="mailto:piet.delaney <at> gmail.com">piet.delaney <at> gmail.com</a><p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
</div>
HuKeping | 30 Sep 13:49 2014

[PATCH] Endian-mismatch: crash shows a contrary error message

When the vmcore or vmlinux is not the same endian with the host,
crash will give out a error message to show that mismatching, but
the message itself is not correct.
This patch fix that logical bug.

Signed-off-by: Hu Keping <hukeping <at> huawei.com>
---
 tools.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools.c b/tools.c
index 4ff3fd5..cb684b1 100644
--- a/tools.c
+++ b/tools.c
 <at>  <at>  -5515,12 +5515,12  <at>  <at>  endian_mismatch(char *file, char dumpfile_endian, ulong query)
 	case ELFDATA2LSB:
 		if (__BYTE_ORDER == __LITTLE_ENDIAN)
 			return FALSE;
-		endian = "big-endian";
+		endian = "little-endian";
 		break;
 	case ELFDATA2MSB:
 		if (__BYTE_ORDER == __BIG_ENDIAN)	
 			return FALSE;
-		endian = "little-endian";
+		endian = "big-endian";
 		break;
 	default:
 		endian = "unknown";	
--

-- 
1.8.5.5

Qiao Nuohan | 29 Sep 04:08 2014

[PATCH v2 00/25] support hiding data of offline cpu

For those who don't care about the removed cpu, data of offline cpu is
bothering. This patchset is trying to hide data of offline cpu. Please
check each patch to see what is hiden.

The last version is here:
https://www.redhat.com/archives/crash-utility/2014-September/msg00000.html

Changelog:
v1->v2:
1. patch 1: add environment variable and its argument to hide/show
   data of offline cpu.
2. add description of environment variable to crash.8
3. remove the restrict of x86_64
4. add "<OFFLINE>" to indicate those hiden data.
5. patch 22/23: addd "<OFFLINE>" to indicate idle task on offline
   cpu

Qiao Nuohan (25):
  add a flag to display/hide data of offline cpus
  add an API to check whether to hide a cpus' data
  x86_64: modify help -m/-M to hide offline cpus' data
  x86_64: modify bt -E to hide offline cpus' data
  x86_64: modify mach to hide offline cpus' data
  x86_64: modify mach -c to hide offline cpus' data
  modify help -r to hide offline cpus' registers
  modify bt -c to hide offline cpus' data
  modify display_sys_stats() to hide cpus' number
  modify help -k to hide offline cpus' number
  modify set -c to hide offline cpu
  modify irq -s to hide offline cpus' data
  modify irq -a to hide offline cpus' data
  modify timer -r to hide offline cpus' data
  modify timer to hide offline cpus' data
  modify ptov offset:cpuspec to hide offline cpus' data
  fix max_cpudata_limit() when offlined cpu exists
  modify kmem -o to hide offline cpus' data
  modify kmem -S(SLUB) to hide offline cpus' data
  modify struct/union/* [:cpuspec] to hide offline cpus' data
  modify command p to hide offline cpus' data
  modify ps to indicate idle task on offline cpu
  modify print_task_header() to indicate idle task on offline cpu
  modify ps -l/-m -C cpu to hide offline cpus' data
  modify runq to hide offline cpus' data

 crash.8    |  4 +++
 defs.h     |  3 ++
 diskdump.c |  6 +++-
 help.c     |  6 ++++
 kernel.c   | 83 +++++++++++++++++++++++++++++++++++++++++++++++++----
 main.c     | 15 +++++++++-
 memory.c   | 30 +++++++++++++++----
 netdump.c  | 25 ++++++++++++++--
 symbols.c  | 15 +++++++++-
 task.c     | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------
 tools.c    | 15 ++++++++++
 x86_64.c   | 74 +++++++++++++++++++++++++++++++++++++++--------
 12 files changed, 331 insertions(+), 42 deletions(-)

--

-- 
1.8.5.3

HuKeping | 28 Sep 11:59 2014

[PATCH] arm32: fix "unknown HZ value" error

This patch fix the error info
"UPTIME: (cannot calculate: unknown HZ value)"
on arm(32 bit), if the CONFIG_IKCONFIG was not selected.

Signed-off-by: Hu Keping <hukeping <at> huawei.com>
---
 arm.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arm.c b/arm.c
index 7405583..cfdc5f1 100644
--- a/arm.c
+++ b/arm.c
 <at>  <at>  -315,6 +315,9  <at>  <at>  arm_init(int when)
 				   "pr_pid");
 		MEMBER_OFFSET_INIT(elf_prstatus_pr_reg, "elf_prstatus",
 				   "pr_reg");
+	
+		if(!machdep->hz)
+			machdep->hz = 100;
 		break;

 	case POST_VM:
--

-- 
1.8.5.5


Gmane