Skip to content

Commit 5d7c854

Browse files
chleroypmladek
authored andcommitted
livepatch: Remove klp_arch_set_pc() and asm/livepatch.h
All three versions of klp_arch_set_pc() do exactly the same: they call ftrace_instruction_pointer_set(). Call ftrace_instruction_pointer_set() directly and remove klp_arch_set_pc(). As klp_arch_set_pc() was the only thing remaining in asm/livepatch.h on x86 and s390, remove asm/livepatch.h livepatch.h remains on powerpc but its content is exclusively used by powerpc specific code. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Acked-by: Petr Mladek <pmladek@suse.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Petr Mladek <pmladek@suse.com>
1 parent d111c9f commit 5d7c854

File tree

8 files changed

+3
-58
lines changed

8 files changed

+3
-58
lines changed

MAINTAINERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11338,8 +11338,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching.g
1133811338
F: Documentation/ABI/testing/sysfs-kernel-livepatch
1133911339
F: Documentation/livepatch/
1134011340
F: arch/powerpc/include/asm/livepatch.h
11341-
F: arch/s390/include/asm/livepatch.h
11342-
F: arch/x86/include/asm/livepatch.h
1134311341
F: include/linux/livepatch.h
1134411342
F: kernel/livepatch/
1134511343
F: lib/livepatch/

arch/powerpc/include/asm/livepatch.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@
77
#ifndef _ASM_POWERPC_LIVEPATCH_H
88
#define _ASM_POWERPC_LIVEPATCH_H
99

10-
#include <linux/module.h>
11-
#include <linux/ftrace.h>
10+
#include <linux/sched.h>
1211
#include <linux/sched/task_stack.h>
1312

14-
#ifdef CONFIG_LIVEPATCH
15-
static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip)
16-
{
17-
ftrace_instruction_pointer_set(fregs, ip);
18-
}
19-
#endif /* CONFIG_LIVEPATCH */
20-
2113
#ifdef CONFIG_LIVEPATCH_64
2214
static inline void klp_init_thread_info(struct task_struct *p)
2315
{

arch/powerpc/kernel/irq.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
#include <asm/machdep.h>
6464
#include <asm/udbg.h>
6565
#include <asm/smp.h>
66-
#include <asm/livepatch.h>
6766
#include <asm/hw_irq.h>
6867
#include <asm/softirq_stack.h>
6968

arch/powerpc/kernel/setup_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#include <asm/udbg.h>
6060
#include <asm/kexec.h>
6161
#include <asm/code-patching.h>
62-
#include <asm/livepatch.h>
62+
#include <asm/ftrace.h>
6363
#include <asm/opal.h>
6464
#include <asm/cputhreads.h>
6565
#include <asm/hw_irq.h>

arch/s390/include/asm/livepatch.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

arch/x86/include/asm/livepatch.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

include/linux/livepatch.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#if IS_ENABLED(CONFIG_LIVEPATCH)
1818

19-
#include <asm/livepatch.h>
20-
2119
/* task patch states */
2220
#define KLP_UNDEFINED -1
2321
#define KLP_UNPATCHED 0

kernel/livepatch/patch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static void notrace klp_ftrace_handler(unsigned long ip,
118118
if (func->nop)
119119
goto unlock;
120120

121-
klp_arch_set_pc(fregs, (unsigned long)func->new_func);
121+
ftrace_instruction_pointer_set(fregs, (unsigned long)func->new_func);
122122

123123
unlock:
124124
ftrace_test_recursion_unlock(bit);

0 commit comments

Comments
 (0)