ck: UKFEF: report kernel crash event

to #34868789

Add kernel crash event into unified kernel fault event framework.

Signed-off-by: Wetp Zhang <wetp.zy@linux.alibaba.com>
Signed-off-by: Meng Shen <shenmeng@linux.alibaba.com>
Acked-by: Xunlei Pang <xlpang@linux.alibaba.com>
This commit is contained in:
Meng Shen 2021-07-15 20:38:20 +08:00 committed by Qiao Ma
parent 676a774b98
commit e57ca517d8
2 changed files with 9 additions and 1 deletions

View File

@ -37,6 +37,7 @@
#include <linux/compiler.h>
#include <linux/hugetlb.h>
#include <linux/objtool.h>
#include <linux/fault_event.h>
#include <asm/page.h>
#include <asm/sections.h>
@ -83,8 +84,13 @@ int kexec_should_crash(struct task_struct *p)
* There are 4 panic() calls in do_exit() path, each of which
* corresponds to each of these 4 conditions.
*/
if (in_interrupt() || !p->pid || is_global_init(p) || panic_on_oops)
if (in_interrupt() || !p->pid || is_global_init(p) || panic_on_oops) {
report_fault_event(smp_processor_id(),
current, FATAL_FAULT, FE_PANIC,
"kernel crash");
return 1;
}
return 0;
}

View File

@ -218,6 +218,8 @@ void panic(const char *fmt, ...)
console_verbose();
bust_spinlocks(1);
report_fault_event(smp_processor_id(), current, FATAL_FAULT,
FE_PANIC, NULL);
va_start(args, fmt);
len = vscnprintf(buf, sizeof(buf), fmt, args);
va_end(args);