summaryrefslogtreecommitdiff
path: root/fs/pstore/ftrace.c
blob: a130d484b7d35ba7fe4463075e6c84f3811ad2eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * Copyright 2012  Google, Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/irqflags.h>
#include <linux/percpu.h>
#include <linux/smp.h>
#include <linux/atomic.h>
#include <asm/barrier.h>
#include "internal.h"

void notrace pstore_ftrace_call(unsigned long ip, unsigned long parent_ip)
{
	struct pstore_ftrace_record rec = {};

	if (unlikely(oops_in_progress))
		return;

	rec.ip = ip;
	rec.parent_ip = parent_ip;
	pstore_ftrace_encode_cpu(&rec, raw_smp_processor_id());
	psinfo->write_buf(PSTORE_TYPE_FTRACE, 0, NULL, 0, (void *)&rec,
			  sizeof(rec), psinfo);
}