Skip to content

Commit bec2737

Browse files
author
Fox Snowpatch
committed
1 parent 5165c17 commit bec2737

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

arch/powerpc/include/asm/ftrace.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@
2020
#ifndef __ASSEMBLY__
2121
extern void _mcount(void);
2222

23-
static inline unsigned long ftrace_call_adjust(unsigned long addr)
24-
{
25-
if (IS_ENABLED(CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY))
26-
addr += MCOUNT_INSN_SIZE;
27-
28-
return addr;
29-
}
30-
3123
unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip,
3224
unsigned long sp);
3325

@@ -142,8 +134,10 @@ static inline u8 this_cpu_get_ftrace_enabled(void) { return 1; }
142134
#ifdef CONFIG_FUNCTION_TRACER
143135
extern unsigned int ftrace_tramp_text[], ftrace_tramp_init[];
144136
void ftrace_free_init_tramp(void);
137+
unsigned long ftrace_call_adjust(unsigned long addr);
145138
#else
146139
static inline void ftrace_free_init_tramp(void) { }
140+
static inline unsigned long ftrace_call_adjust(unsigned long addr) { return addr; }
147141
#endif
148142
#endif /* !__ASSEMBLY__ */
149143

arch/powerpc/include/asm/sections.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ typedef struct func_desc func_desc_t;
1414

1515
extern char __head_end[];
1616
extern char __srwx_boundary[];
17+
extern char __exittext_begin[], __exittext_end[];
1718

1819
/* Patch sites */
1920
extern s32 patch__call_flush_branch_caches1;

arch/powerpc/kernel/trace/ftrace.c

+12
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,22 @@
2727
#include <asm/ftrace.h>
2828
#include <asm/syscall.h>
2929
#include <asm/inst.h>
30+
#include <asm/sections.h>
3031

3132
#define NUM_FTRACE_TRAMPS 2
3233
static unsigned long ftrace_tramps[NUM_FTRACE_TRAMPS];
3334

35+
unsigned long ftrace_call_adjust(unsigned long addr)
36+
{
37+
if (addr >= (unsigned long)__exittext_begin && addr < (unsigned long)__exittext_end)
38+
return 0;
39+
40+
if (IS_ENABLED(CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY))
41+
addr += MCOUNT_INSN_SIZE;
42+
43+
return addr;
44+
}
45+
3446
static ppc_inst_t ftrace_create_branch_inst(unsigned long ip, unsigned long addr, int link)
3547
{
3648
ppc_inst_t op;

arch/powerpc/kernel/trace/ftrace_64_pg.c

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
#define NUM_FTRACE_TRAMPS 8
3838
static unsigned long ftrace_tramps[NUM_FTRACE_TRAMPS];
3939

40+
unsigned long ftrace_call_adjust(unsigned long addr)
41+
{
42+
return addr;
43+
}
44+
4045
static ppc_inst_t
4146
ftrace_call_replace(unsigned long ip, unsigned long addr, int link)
4247
{

arch/powerpc/kernel/vmlinux.lds.S

+2
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ SECTIONS
281281
* to deal with references from __bug_table
282282
*/
283283
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
284+
__exittext_begin = .;
284285
EXIT_TEXT
286+
__exittext_end = .;
285287
}
286288

287289
. = ALIGN(PAGE_SIZE);

0 commit comments

Comments
 (0)