Skip to content

Commit 14e56fb

Browse files
rpptmcgrof
authored andcommitted
x86/ftrace: enable dynamic ftrace without CONFIG_MODULES
Dynamic ftrace must allocate memory for code and this was impossible without CONFIG_MODULES. With execmem separated from the modules code, execmem_text_alloc() is available regardless of CONFIG_MODULES. Remove dependency of dynamic ftrace on CONFIG_MODULES and make CONFIG_DYNAMIC_FTRACE select CONFIG_EXECMEM in Kconfig. Signed-off-by: Mike Rapoport (IBM) <[email protected]> Reviewed-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 0cc2dc4 commit 14e56fb

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ config X86_64
3434
select SWIOTLB
3535
select ARCH_HAS_ELFCORE_COMPAT
3636
select ZONE_DMA32
37+
select EXECMEM if DYNAMIC_FTRACE
3738

3839
config FORCE_DYNAMIC_FTRACE
3940
def_bool y

arch/x86/kernel/ftrace.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,6 @@ void arch_ftrace_update_code(int command)
261261
/* Currently only x86_64 supports dynamic trampolines */
262262
#ifdef CONFIG_X86_64
263263

264-
#ifdef CONFIG_MODULES
265-
/* Module allocation simplifies allocating memory for code */
266264
static inline void *alloc_tramp(unsigned long size)
267265
{
268266
return execmem_alloc(EXECMEM_FTRACE, size);
@@ -271,14 +269,6 @@ static inline void tramp_free(void *tramp)
271269
{
272270
execmem_free(tramp);
273271
}
274-
#else
275-
/* Trampolines can only be created if modules are supported */
276-
static inline void *alloc_tramp(unsigned long size)
277-
{
278-
return NULL;
279-
}
280-
static inline void tramp_free(void *tramp) { }
281-
#endif
282272

283273
/* Defined as markers to the end of the ftrace default trampolines */
284274
extern void ftrace_regs_caller_end(void);

0 commit comments

Comments
 (0)