mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 11:36:53 +07:00
3994a52b54
Historically a lot of these existed because we did not have a distinction between what was modular code and what was providing support to modules via EXPORT_SYMBOL and friends. That changed when we forked out support for the latter into the export.h file. This means we should be able to reduce the usage of module.h in code that is obj-y Makefile or bool Kconfig. The advantage in doing so is that module.h itself sources about 15 other headers; adding significantly to what we feed cpp, and it can obscure what headers we are effectively using. Since module.h was the source for init.h (for __init) and for export.h (for EXPORT_SYMBOL) we consider each change instance for the presence of either and replace as needed. Build testing revealed some implicit header usage that was fixed up accordingly. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
74 lines
1.8 KiB
C
74 lines
1.8 KiB
C
/*
|
|
* Stack trace management functions
|
|
*
|
|
* Copyright IBM Corp. 2006
|
|
* Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
|
|
*/
|
|
|
|
#include <linux/sched.h>
|
|
#include <linux/stacktrace.h>
|
|
#include <linux/kallsyms.h>
|
|
#include <linux/export.h>
|
|
|
|
static int __save_address(void *data, unsigned long address, int nosched)
|
|
{
|
|
struct stack_trace *trace = data;
|
|
|
|
if (nosched && in_sched_functions(address))
|
|
return 0;
|
|
if (trace->skip > 0) {
|
|
trace->skip--;
|
|
return 0;
|
|
}
|
|
if (trace->nr_entries < trace->max_entries) {
|
|
trace->entries[trace->nr_entries++] = address;
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
static int save_address(void *data, unsigned long address, int reliable)
|
|
{
|
|
return __save_address(data, address, 0);
|
|
}
|
|
|
|
static int save_address_nosched(void *data, unsigned long address, int reliable)
|
|
{
|
|
return __save_address(data, address, 1);
|
|
}
|
|
|
|
void save_stack_trace(struct stack_trace *trace)
|
|
{
|
|
unsigned long sp;
|
|
|
|
sp = current_stack_pointer();
|
|
dump_trace(save_address, trace, NULL, sp);
|
|
if (trace->nr_entries < trace->max_entries)
|
|
trace->entries[trace->nr_entries++] = ULONG_MAX;
|
|
}
|
|
EXPORT_SYMBOL_GPL(save_stack_trace);
|
|
|
|
void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
|
|
{
|
|
unsigned long sp;
|
|
|
|
sp = tsk->thread.ksp;
|
|
if (tsk == current)
|
|
sp = current_stack_pointer();
|
|
dump_trace(save_address_nosched, trace, tsk, sp);
|
|
if (trace->nr_entries < trace->max_entries)
|
|
trace->entries[trace->nr_entries++] = ULONG_MAX;
|
|
}
|
|
EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
|
|
|
|
void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
|
|
{
|
|
unsigned long sp;
|
|
|
|
sp = kernel_stack_pointer(regs);
|
|
dump_trace(save_address, trace, NULL, sp);
|
|
if (trace->nr_entries < trace->max_entries)
|
|
trace->entries[trace->nr_entries++] = ULONG_MAX;
|
|
}
|
|
EXPORT_SYMBOL_GPL(save_stack_trace_regs);
|