ftrace.c (79790b6818e96c58fe2bffee1b418c16e64e7b80) | ftrace.c (12af2b83d0b17ec8b379b721dd4a8fbcd5d791f3) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Dynamic function tracing support. 4 * 5 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com> 6 * 7 * Thanks goes to Ingo Molnar, for suggesting the idea. 8 * Mathieu Desnoyers, for suggesting postponing the modifications. --- 11 unchanged lines hidden (view full) --- 20#include <linux/sched.h> 21#include <linux/slab.h> 22#include <linux/init.h> 23#include <linux/list.h> 24#include <linux/module.h> 25#include <linux/memory.h> 26#include <linux/vmalloc.h> 27#include <linux/set_memory.h> | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Dynamic function tracing support. 4 * 5 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com> 6 * 7 * Thanks goes to Ingo Molnar, for suggesting the idea. 8 * Mathieu Desnoyers, for suggesting postponing the modifications. --- 11 unchanged lines hidden (view full) --- 20#include <linux/sched.h> 21#include <linux/slab.h> 22#include <linux/init.h> 23#include <linux/list.h> 24#include <linux/module.h> 25#include <linux/memory.h> 26#include <linux/vmalloc.h> 27#include <linux/set_memory.h> |
28#include <linux/execmem.h> |
|
28 29#include <trace/syscall.h> 30 31#include <asm/kprobes.h> 32#include <asm/ftrace.h> 33#include <asm/nops.h> 34#include <asm/text-patching.h> 35 --- 220 unchanged lines hidden (view full) --- 256{ 257 ftrace_modify_all_code(command); 258} 259 260/* Currently only x86_64 supports dynamic trampolines */ 261#ifdef CONFIG_X86_64 262 263#ifdef CONFIG_MODULES | 29 30#include <trace/syscall.h> 31 32#include <asm/kprobes.h> 33#include <asm/ftrace.h> 34#include <asm/nops.h> 35#include <asm/text-patching.h> 36 --- 220 unchanged lines hidden (view full) --- 257{ 258 ftrace_modify_all_code(command); 259} 260 261/* Currently only x86_64 supports dynamic trampolines */ 262#ifdef CONFIG_X86_64 263 264#ifdef CONFIG_MODULES |
264#include <linux/moduleloader.h> | |
265/* Module allocation simplifies allocating memory for code */ 266static inline void *alloc_tramp(unsigned long size) 267{ | 265/* Module allocation simplifies allocating memory for code */ 266static inline void *alloc_tramp(unsigned long size) 267{ |
268 return module_alloc(size); | 268 return execmem_alloc(EXECMEM_FTRACE, size); |
269} 270static inline void tramp_free(void *tramp) 271{ | 269} 270static inline void tramp_free(void *tramp) 271{ |
272 module_memfree(tramp); | 272 execmem_free(tramp); |
273} 274#else 275/* Trampolines can only be created if modules are supported */ 276static inline void *alloc_tramp(unsigned long size) 277{ 278 return NULL; 279} 280static inline void tramp_free(void *tramp) { } --- 387 unchanged lines hidden --- | 273} 274#else 275/* Trampolines can only be created if modules are supported */ 276static inline void *alloc_tramp(unsigned long size) 277{ 278 return NULL; 279} 280static inline void tramp_free(void *tramp) { } --- 387 unchanged lines hidden --- |