xref: /openbmc/linux/fs/pstore/ftrace.c (revision 95e9fd10)
1 /*
2  * Copyright 2012  Google, Inc.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13 
14 #include <linux/kernel.h>
15 #include <linux/compiler.h>
16 #include <linux/irqflags.h>
17 #include <linux/percpu.h>
18 #include <linux/smp.h>
19 #include <linux/atomic.h>
20 #include <asm/barrier.h>
21 #include "internal.h"
22 
23 void notrace pstore_ftrace_call(unsigned long ip, unsigned long parent_ip)
24 {
25 	struct pstore_ftrace_record rec = {};
26 
27 	if (unlikely(oops_in_progress))
28 		return;
29 
30 	rec.ip = ip;
31 	rec.parent_ip = parent_ip;
32 	pstore_ftrace_encode_cpu(&rec, raw_smp_processor_id());
33 	psinfo->write_buf(PSTORE_TYPE_FTRACE, 0, NULL, 0, (void *)&rec,
34 			  sizeof(rec), psinfo);
35 }
36