Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-20 Thread Benjamin Gray
On Tue, 2022-09-20 at 05:44 +, Christophe Leroy wrote: > > As far as I know, cachelines are minimum 64 bytes on PPC64 aren't > they ? In practice maybe. I don't know what the convention is in the kernel in cases where the ISA is less specific than what the supported machines do. > > Related

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-19 Thread Christophe Leroy
Le 20/09/2022 à 04:32, Benjamin Gray a écrit : > On Mon, 2022-09-19 at 07:16 +, Christophe Leroy wrote: >> Why would it be unpredictable ? Only one page is mapped. If it >> crosses >> the boundary, __put_kernel_nofault() will fail in a controled manner. >> I see no point in doing the check be

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-19 Thread Benjamin Gray
On Mon, 2022-09-19 at 07:16 +, Christophe Leroy wrote: > Why would it be unpredictable ? Only one page is mapped. If it > crosses > the boundary, __put_kernel_nofault() will fail in a controled manner. > I see no point in doing the check before every write. Oh I didn't see that get_vm_area au

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-19 Thread Benjamin Gray
On Mon, 2022-09-19 at 06:38 +, Christophe Leroy wrote: > Le 16/09/2022 à 08:23, Benjamin Gray a écrit : > > [...] > > +   /* Make sure we aren't patching a freed init section */ > > +   if (static_branch_likely(&init_mem_is_free) && > > init_section_contains(dest, 4)) > > + 

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-19 Thread Christophe Leroy
Le 19/09/2022 à 08:49, Benjamin Gray a écrit : > On Mon, 2022-09-19 at 06:04 +, Christophe Leroy wrote: >> With CONFIG_STRICT_KERNEL_RWX, this patches causes a 15% time >> increase >> for activation/deactivation of ftrace. > > It's possible that new alignment check is the cause. I'll see >

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-18 Thread Benjamin Gray
On Mon, 2022-09-19 at 06:04 +, Christophe Leroy wrote: > With CONFIG_STRICT_KERNEL_RWX, this patches causes a 15% time > increase > for activation/deactivation of ftrace. It's possible that new alignment check is the cause. I'll see > Without CONFIG_STRICT_KERNEL_RWX, it doesn't build. Yup

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-18 Thread Christophe Leroy
Le 16/09/2022 à 08:23, Benjamin Gray a écrit : > > -static int do_patch_instruction(u32 *addr, ppc_inst_t instr) > +static int patch_text(void *dest, const void *src, size_t size, bool is_exec) > { > int err; > unsigned long flags; > > - /* > - * During early early bo

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-18 Thread Christophe Leroy
Le 16/09/2022 à 08:23, Benjamin Gray a écrit : > Adds a generic text patching mechanism for patches of 1, 2, 4, or 8 > bytes. The patcher conditionally syncs the icache depending on if > the content will be executed (as opposed to, e.g., read-only data). > > The `patch_instruction` function is r

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-16 Thread kernel test robot
Hi Benjamin, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on powerpc/next] [also build test WARNING on next-20220916] [cannot apply to linus/master v6.0-rc5] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we su

Re: [PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-16 Thread kernel test robot
Hi Benjamin, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on next-20220916] [cannot apply to linus/master v6.0-rc5] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to

[PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-15 Thread Benjamin Gray
Adds a generic text patching mechanism for patches of 1, 2, 4, or 8 bytes. The patcher conditionally syncs the icache depending on if the content will be executed (as opposed to, e.g., read-only data). The `patch_instruction` function is reimplemented in terms of this more generic function. This g