Frage

I have a requirement to dump CPU back-trace of all the CPU's.

In linux we have dump_stack which can be used to dump the stack of current cpu.

My requirement is to print the call stacks of the processes running on all the CPU'S(4 CPU's in my case). How can we do it? Is there a pre-built API for this?

War es hilfreich?

Lösung

To trigger something on other CPU's, platforms use IPI's.

The logic to do this on arm is defined in, smp_send_all_cpu_backtrace() -> file - kernel/arch/arm/kernel/smp.c

This sends IPI to all the cpu's to dump the stack. If you want to use it in your code, use the platform independent wrapper arch_trigger_all_cpu_backtrace() by including asm/irq.h

#include <asm/irq.h>

void dump_all_cpu_stack(void)
{
     arch_trigger_all_cpu_backtrace();
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top