How to write mpykdump extension

If you are dealing with a vmcore (Linux memory dump), you must be familiar with ‘crash’. It is a powerful tool, but it doesn’t cover all the data you can find in Linux kernel. So, there comes ‘mpykdump’ which is a crash extension which understands python code. mpykdump comes with many prebuilt commands that youContinue reading “How to write mpykdump extension”

Print callgraph of a function

Sometimes you may want to see what functions are called in a function in multiple level. Below command in my extension may help. crash> edis -c irq_exit {irq_exit} -+- {rcu_irq_exit} -+- {warn_slowpath_null} |- {idle_cpu} |- {tick_nohz_stop_sched_tick} -+- {ktime_get} | |- {update_ts_time_stats} | |- {sched_clock_idle_sleep_event} | |- {rcu_needs_cpu} | |- {select_nohz_load_balancer} | |- {rcu_enter_nohz} | |-Continue reading “Print callgraph of a function”

Why error message not goes into pipe nor redirected path in ‘crash’?

In the below example, the error always shows in the console. crash> sym ffffffffa02ef86 > /dev/null sym: invalid address: ffffffffa02ef86 This ‘sym’ command is implemented in ‘void cmd_sym(void)’ function in crash. /* * This command may be used to: * * 1. Translate a symbol to its value. * 2. Translate a value to itContinue reading “Why error message not goes into pipe nor redirected path in ‘crash’?”

An example case with some of my commands

System got high load average and it wasn’t responding for long which is a typical hang situation. It shows total 56 tasks in D (Uninterruptible) state and 5 tasks were in D state longer than 120 seconds which is considered as a hung task. Let’s see what it was waiting for in this process. Alright,Continue reading “An example case with some of my commands”

Python/CRASH API aka pkydump

I am dealing with vmcore analysis for the most of my daily work. To speed up the analysis, I needed some extra command set on top of the commands ‘crash’ is providing. Luckily there is a tool names ‘pkydump’ which is a crash extension and also provides a way to implement extensions using python. IContinue reading “Python/CRASH API aka pkydump”

crash extension ‘pstree’

‘crash’ is useful tool to analyse system crashes or debugging in Linux system. It has many useful commands, but sometimes I wanted to get full picture of process list that was running at the time of crash. You can get process list with ‘ps’, but if you want to get hierarchical view, only ‘ps -p’Continue reading “crash extension ‘pstree’”

Jump into vmcore analysis – Step 8

There’s a time you want to check the local variables or other entries in the stack. Below is an example that was crashed in ‘kmem_freepages’ and needed to check why it’s crashed whiling freeing it. PID: 26 TASK: ffff81027f9197a0 CPU: 0 COMMAND: “events/0” #0 [ffff81027f92fa90] crash_kexec at ffffffff800aaa0c #1 [ffff81027f92fb50] __die at ffffffff8006520f #2 [ffff81027f92fb90]Continue reading “Jump into vmcore analysis – Step 8”

Jump into vmcore analysis – Step 7

If the vmcore was generated by human and you want to check who actually was, you might need to check the related process. There are various options in ‘ps’ command, so, you would be able to check it with below steps. crash> ps -a 6326 PID: 6326 TASK: ffff810402165820 CPU: 1 COMMAND: “fuser” ARG: fuserContinue reading “Jump into vmcore analysis – Step 7”

Jump into vmcore analysis – Step 6

The real merit of the vmcore is that you can trace the code with the current value each variable holds. Here you can find one example that traces the filesystem which ended up with the corrupted data entry somehow. http://pagead2.googlesyndication.com/pagead/show_ads.js crash> bt PID: 6326 TASK: ffff810402165820 CPU: 1 COMMAND: “fuser” #0 [ffff8103b54efa80] crash_kexec at ffffffff800b099cContinue reading “Jump into vmcore analysis – Step 6”

Jump into vmcore analysis – Step 5

With ‘bt’ command you can check the processes that occupied the CPU at the time of crash. But, there is the time you want to check other processes’s backtrace to see what interaction had been established between processes. You can check it by using one of below two methods. crash> set 24960 PID: 24960 COMMAND:Continue reading “Jump into vmcore analysis – Step 5”

Jump into vmcore analysis – Step 4

There are times the crash had happened because of the lack of memory. Or times that system had hard time because of the memory issue. To check those, you can use below command. crash> kmem -i PAGES TOTAL PERCENTAGE TOTAL MEM 16464824 62.8 GB —- FREE 3807386 14.5 GB 23% of TOTAL MEM USED 12657438Continue reading “Jump into vmcore analysis – Step 4”

Jump into vmcore analysis – Step 3

Now we are ready to deep dive into vmcore analysis to confirm what went wrong in the system. In general, first thing I’m checking is the system’s log. crash> log …. …. end_request: I/O error, dev sdajm, sector 0 end_request: I/O error, dev sdajm, sector 8 end_request: I/O error, dev sdajm, sector 0 NMI WatchdogContinue reading “Jump into vmcore analysis – Step 3”