[PATCH] 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 --- MAINTAINERS | 2 -- arch/powerpc/include/asm/livepatch.h | 10 +- arch/powerpc/kernel/irq.c| 1 - arch/powerpc/kernel/setup_64.c | 2 +- arch/s390/include/asm/livepatch.h| 22 -- arch/x86/include/asm/livepatch.h | 20 include/linux/livepatch.h| 2 -- kernel/livepatch/patch.c | 2 +- 8 files changed, 3 insertions(+), 58 deletions(-) delete mode 100644 arch/s390/include/asm/livepatch.h delete mode 100644 arch/x86/include/asm/livepatch.h diff --git a/MAINTAINERS b/MAINTAINERS index 1ef8327aef1f..cb5f0d4a8fcc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11253,8 +11253,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching.g F: Documentation/ABI/testing/sysfs-kernel-livepatch F: Documentation/livepatch/ F: arch/powerpc/include/asm/livepatch.h -F: arch/s390/include/asm/livepatch.h -F: arch/x86/include/asm/livepatch.h F: include/linux/livepatch.h F: kernel/livepatch/ F: lib/livepatch/ diff --git a/arch/powerpc/include/asm/livepatch.h b/arch/powerpc/include/asm/livepatch.h index 1c60094ea0cd..d044a1fd4f44 100644 --- a/arch/powerpc/include/asm/livepatch.h +++ b/arch/powerpc/include/asm/livepatch.h @@ -7,17 +7,9 @@ #ifndef _ASM_POWERPC_LIVEPATCH_H #define _ASM_POWERPC_LIVEPATCH_H -#include -#include +#include #include -#ifdef CONFIG_LIVEPATCH -static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip) -{ - ftrace_instruction_pointer_set(fregs, ip); -} -#endif /* CONFIG_LIVEPATCH */ - #ifdef CONFIG_LIVEPATCH_64 static inline void klp_init_thread_info(struct task_struct *p) { diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 1c4715a03cd1..8c20226bcc11 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -64,7 +64,6 @@ #include #include #include -#include #include #include diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index e547066a06aa..2c1e9a5ac6ca 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/s390/include/asm/livepatch.h b/arch/s390/include/asm/livepatch.h deleted file mode 100644 index 5209f223331a.. --- a/arch/s390/include/asm/livepatch.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * livepatch.h - s390-specific Kernel Live Patching Core - * - * Copyright (c) 2013-2015 SUSE - * Authors: Jiri Kosina - * Vojtech Pavlik - * Jiri Slaby - */ - -#ifndef ASM_LIVEPATCH_H -#define ASM_LIVEPATCH_H - -#include -#include - -static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip) -{ - ftrace_instruction_pointer_set(fregs, ip); -} - -#endif diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h deleted file mode 100644 index 7c5cc6660e4b.. --- a/arch/x86/include/asm/livepatch.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * livepatch.h - x86-specific Kernel Live Patching Core - * - * Copyright (C) 2014 Seth Jennings - * Copyright (C) 2014 SUSE - */ - -#ifndef _ASM_X86_LIVEPATCH_H -#define _ASM_X86_LIVEPATCH_H - -#include -#include - -static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip) -{ - ftrace_instruction_pointer_set(fregs, ip); -} - -#endif /* _ASM_X86_LIVEPATCH_H */ diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 2614247a9781..293e29960c6e 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -16,8 +16,6 @@ #if IS_ENABLED(CONFIG_LIVEPATCH) -#include - /* task patch states */ #define KLP_UNDEFINED -1 #define KLP_UNPATCHED 0 diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c index c172bf92b576..4c4f5a776d80 100644 --- a/kernel/livepatch/patch.c +++ b/kernel/livepatch/patch.c @@ -118,7 +118,7 @@ static void notrace klp_ftrace_handler(unsigned long ip, if (func->nop) goto unlock; - klp_arch_set_pc(fregs, (unsigned long)func->new_func); + ftrace_instruction_pointer_set(fregs, (unsigned long)func->new_func); unlock: ftrace_test_recursion_unlock(bit); -- 2.35.1
Re: linux-next: build failure in Linus' tree
Hi Linus, On Sun, 27 Mar 2022 15:23:24 -0700 Linus Torvalds wrote: > > Will apply that patch asap. Thanks -- Cheers, Stephen Rothwell pgp1yu3oqMq3e.pgp Description: OpenPGP digital signature
Re: linux-next: build failure in Linus' tree
-#endif /* CONFIG_LIVEPATCH */ On Sun, Mar 27, 2022 at 3:23 PM Linus Torvalds wrote: > > I even *looked* at that code when merging, and convinced myself I had > gotten the #ifdef/#endif chain right. Apparently I can't count. > > What a maroon I am. Oh, and I see why I screwed up: I even did a "git diff" against the original powerpc tree, but then I visually matched -#define klp_get_ftrace_location klp_get_ftrace_location ... -#endif /* CONFIG_LIVEPATCH */ as a #ifdef/#endif pair. Now that I look at it knowing that I screwed up, I go "Duh!". Time to take my meds, Linus
Re: linux-next: build failure in Linus' tree
On Sun, Mar 27, 2022 at 3:01 PM Stephen Rothwell wrote: > > Building LInus' tree, today's linux-next build (powerpc > ppc64_defconfig) failed like this: Gaah. I even *looked* at that code when merging, and convinced myself I had gotten the #ifdef/#endif chain right. Apparently I can't count. What a maroon I am. Will apply that patch asap. Thanks, Linus
linux-next: build failure in Linus' tree
Hi all, Building LInus' tree, today's linux-next build (powerpc ppc64_defconfig) failed like this: In file included from arch/powerpc/kernel/irq.c:66: arch/powerpc/include/asm/livepatch.h:7: error: unterminated #ifndef 7 | #ifndef _ASM_POWERPC_LIVEPATCH_H | Caused by commit 7001052160d1 ("Merge tag 'x86_core_for_5.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") A #endif got removed during the merge resolution :-( I have applied the following patch for today From: Stephen Rothwell Date: Mon, 28 Mar 2022 08:55:39 +1100 Subject: [PATCH] powerpc: restore removed #endif Fixes: 7001052160d1 ("Merge tag 'x86_core_for_5.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") Signed-off-by: Stephen Rothwell --- arch/powerpc/include/asm/livepatch.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/livepatch.h b/arch/powerpc/include/asm/livepatch.h index fd65931a739f..1c60094ea0cd 100644 --- a/arch/powerpc/include/asm/livepatch.h +++ b/arch/powerpc/include/asm/livepatch.h @@ -16,6 +16,7 @@ static inline void klp_arch_set_pc(struct ftrace_regs *fregs, unsigned long ip) { ftrace_instruction_pointer_set(fregs, ip); } +#endif /* CONFIG_LIVEPATCH */ #ifdef CONFIG_LIVEPATCH_64 static inline void klp_init_thread_info(struct task_struct *p) -- 2.35.1 -- Cheers, Stephen Rothwell pgpI3N0r1MHpO.pgp Description: OpenPGP digital signature
Re: [PATCH 05/22] acpica: Replace comments with C99 initializers
On Sat, Mar 26, 2022 at 7:39 PM Benjamin Stürz wrote: > > This replaces comments with C99's designated > initializers because the kernel supports them now. Does it follow the conventions which are accepted in the ACPI CA project? -- With Best Regards, Andy Shevchenko
Re: [PATCH 09/22] gpio-winbond: Use C99 initializers
On Sat, Mar 26, 2022 at 6:00 PM Benjamin Stürz wrote: > This replaces comments with C99's designated > initializers because the kernel supports them now. > > Signed-off-by: Benjamin Stürz Reviewed-by: Linus Walleij Yours, Linus Walleij
Re: [PATCH 11/22] rdmavt: Replace comments with C99 initializers
On Sat, Mar 26, 2022 at 05:58:58PM +0100, Benjamin Stürz wrote: > This replaces comments with C99's designated > initializers because the kernel supports them now. > > Signed-off-by: Benjamin Stürz > --- > drivers/infiniband/sw/rdmavt/rc.c | 62 +++ > 1 file changed, 31 insertions(+), 31 deletions(-) > > diff --git a/drivers/infiniband/sw/rdmavt/rc.c > b/drivers/infiniband/sw/rdmavt/rc.c > index 4e5d4a27633c..121b8a23ac07 100644 > --- a/drivers/infiniband/sw/rdmavt/rc.c > +++ b/drivers/infiniband/sw/rdmavt/rc.c > @@ -10,37 +10,37 @@ > * Convert the AETH credit code into the number of credits. > */ > static const u16 credit_table[31] = { > - 0, /* 0 */ > - 1, /* 1 */ > - 2, /* 2 */ > - 3, /* 3 */ > - 4, /* 4 */ > - 6, /* 5 */ > - 8, /* 6 */ > - 12, /* 7 */ > - 16, /* 8 */ > - 24, /* 9 */ > - 32, /* A */ > - 48, /* B */ > - 64, /* C */ > - 96, /* D */ > - 128,/* E */ > - 192,/* F */ > - 256,/* 10 */ > - 384,/* 11 */ > - 512,/* 12 */ > - 768,/* 13 */ > - 1024, /* 14 */ > - 1536, /* 15 */ > - 2048, /* 16 */ > - 3072, /* 17 */ > - 4096, /* 18 */ > - 6144, /* 19 */ > - 8192, /* 1A */ > - 12288, /* 1B */ > - 16384, /* 1C */ > - 24576, /* 1D */ > - 32768 /* 1E */ > + [0x00] = 0, > + [0x01] = 1, > + [0x02] = 2, > + [0x03] = 3, > + [0x04] = 4, > + [0x05] = 6, > + [0x06] = 8, > + [0x07] = 12, > + [0x08] = 16, > + [0x09] = 24, > + [0x0A] = 32, > + [0x0B] = 48, > + [0x0C] = 64, > + [0x0D] = 96, > + [0x0E] = 128, > + [0x0F] = 192, > + [0x10] = 256, > + [0x11] = 384, > + [0x12] = 512, > + [0x13] = 768, > + [0x14] = 1024, > + [0x15] = 1536, > + [0x16] = 2048, > + [0x17] = 3072, > + [0x18] = 4096, > + [0x19] = 6144, > + [0x1A] = 8192, > + [0x1B] = 12288, > + [0x1C] = 16384, > + [0x1D] = 24576, > + [0x1E] = 32768 > }; I have hard time to see any value in this commit, why is this change needed? Thanks > > /** > -- > 2.35.1 > >
Re: [RFC PATCH 3/3] objtool/mcount: Add powerpc specific functions
Hi Peter, Hi Josh Le 18/03/2022 à 13:26, Peter Zijlstra a écrit : > On Fri, Mar 18, 2022 at 04:21:40PM +0530, Sathvika Vasireddy wrote: >> This patch adds powerpc specific functions required for >> 'objtool mcount' to work, and enables mcount for ppc. > > I would love to see more objtool enablement for Power :-) > > I'm also very happy someone started to look at it. I thought it would be more difficult to get it work on powerpc. Iml looking forward to being able to use it and implement INLINE STATIC CALLs on PPC32 to start with. I'm wondering what are the plans on your side and what we should wait for and what we could start with. I could do the same as done by Sathvika for static calls, in extenso get it out of check.c into a standalone feature. On the other hand I understood that Josh is also working at making the different features of objtool independant, so should I wait for that ? Any idea of when it comes out ? Second point is the endianess and 32/64 selection, especially when crossbuilding. There is already some stuff regarding endianess based on bswap_if_needed() but that's based on constant selection at build time and I couldn't find an easy way to set it conditionaly based on the target being built. Regarding 32/64 selection, there is almost nothing, it's based on using type 'long' which means that at the time being the target and the build platform must both be 32 bits or 64 bits. For both cases (endianess and 32/64) I think the solution should probably be to start with the fileformat of the object file being reworked by objtool. What are current works in progress on objtool ? Should I wait Josh's changes before starting looking at all this ? Should I wait for anything else ? Christophe
[PATCH] powerpc/64: Fix build failure with allyesconfig in book3s_64_entry.S
Using conditional branches between two files is hasardous, they may get linked to far from each other. arch/powerpc/kvm/book3s_64_entry.o:(.text+0x3ec): relocation truncated to fit: R_PPC64_REL14 (stub) against symbol `system_reset_common' defined in .text section in arch/powerpc/kernel/head_64.o Reorganise the code to use non conditional branches. Cc: Nicholas Piggin Fixes: 89d35b239101 ("KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C") Signed-off-by: Christophe Leroy --- arch/powerpc/kvm/book3s_64_entry.S | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_entry.S b/arch/powerpc/kvm/book3s_64_entry.S index 05e003eb5d90..99fa36df36fa 100644 --- a/arch/powerpc/kvm/book3s_64_entry.S +++ b/arch/powerpc/kvm/book3s_64_entry.S @@ -414,10 +414,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_DAWR1) */ ld r10,HSTATE_SCRATCH0(r13) cmpwi r10,BOOK3S_INTERRUPT_MACHINE_CHECK - beq machine_check_common + beq 1f cmpwi r10,BOOK3S_INTERRUPT_SYSTEM_RESET - beq system_reset_common + bne . - b . + b system_reset_common +1: b machine_check_common #endif -- 2.35.1
Re: [PATCH 2/5] powerpc/83xx: fix possible object reference leak
Le 22/03/2019 à 04:05, Wen Yang a écrit : The call to of_find_node_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/powerpc/platforms/83xx/km83xx.c:68:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 59, but without a corresponding object release within this function. This was fixed by https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id=88654d5b4476 Signed-off-by: Wen Yang Cc: Scott Wood Cc: Kumar Gala Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-ker...@vger.kernel.org --- arch/powerpc/platforms/83xx/km83xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c index d8642a4..11eea7c 100644 --- a/arch/powerpc/platforms/83xx/km83xx.c +++ b/arch/powerpc/platforms/83xx/km83xx.c @@ -65,6 +65,7 @@ static void quirk_mpc8360e_qe_enet10(void) ret = of_address_to_resource(np_par, 0, &res); if (ret) { pr_warn("%s couldn;t map par_io registers\n", __func__); + of_node_put(np_par); return; }