]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - arch/s390/kernel/stacktrace.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
[mirror_ubuntu-eoan-kernel.git] / arch / s390 / kernel / stacktrace.c
CommitLineData
a17ae4c3 1// SPDX-License-Identifier: GPL-2.0
5bdc9b44 2/*
5bdc9b44
HC
3 * Stack trace management functions
4 *
a53c8fab 5 * Copyright IBM Corp. 2006
5bdc9b44
HC
6 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
7 */
8
9#include <linux/sched.h>
b17b0153 10#include <linux/sched/debug.h>
5bdc9b44
HC
11#include <linux/stacktrace.h>
12#include <linux/kallsyms.h>
3994a52b 13#include <linux/export.h>
78c98f90
MS
14#include <asm/stacktrace.h>
15#include <asm/unwind.h>
66adce8f
HC
16
17void save_stack_trace(struct stack_trace *trace)
18{
78c98f90 19 struct unwind_state state;
66adce8f 20
78c98f90
MS
21 unwind_for_each_frame(&state, current, NULL, 0) {
22 if (trace->nr_entries >= trace->max_entries)
23 break;
24 if (trace->skip > 0)
25 trace->skip--;
26 else
27 trace->entries[trace->nr_entries++] = state.ip;
28 }
a3afe70b 29}
7b4c9505 30EXPORT_SYMBOL_GPL(save_stack_trace);
a3afe70b
HC
31
32void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
33{
78c98f90 34 struct unwind_state state;
a3afe70b 35
78c98f90
MS
36 unwind_for_each_frame(&state, tsk, NULL, 0) {
37 if (trace->nr_entries >= trace->max_entries)
38 break;
39 if (in_sched_functions(state.ip))
40 continue;
41 if (trace->skip > 0)
42 trace->skip--;
43 else
44 trace->entries[trace->nr_entries++] = state.ip;
45 }
5bdc9b44 46}
7b4c9505 47EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
e0115875
PA
48
49void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
50{
78c98f90 51 struct unwind_state state;
e0115875 52
78c98f90
MS
53 unwind_for_each_frame(&state, current, regs, 0) {
54 if (trace->nr_entries >= trace->max_entries)
55 break;
56 if (trace->skip > 0)
57 trace->skip--;
58 else
59 trace->entries[trace->nr_entries++] = state.ip;
60 }
e0115875
PA
61}
62EXPORT_SYMBOL_GPL(save_stack_trace_regs);