[PATCH v8 3/6] powerpc/code-patching: Verify instruction patch succeeded

Benjamin Gray bgray at linux.ibm.com
Tue Oct 25 14:30:16 AEDT 2022


On Mon, 2022-10-24 at 14:20 +1100, Russell Currey wrote:
> On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote:
> > diff --git a/arch/powerpc/lib/code-patching.c
> > b/arch/powerpc/lib/code-patching.c
> > index 34fc7ac34d91..9b9eba574d7e 100644
> > --- a/arch/powerpc/lib/code-patching.c
> > +++ b/arch/powerpc/lib/code-patching.c
> > @@ -186,6 +186,8 @@ static int do_patch_instruction(u32 *addr,
> > ppc_inst_t instr)
> >         err = __do_patch_instruction(addr, instr);
> >         local_irq_restore(flags);
> >  
> > +       WARN_ON(!err && !ppc_inst_equal(instr,
> > ppc_inst_read(addr)));
> > +
> 
> As a side note, I had a look at test-code-patching.c and it doesn't
> look like we don't have a test for ppc_inst_equal() with prefixed
> instructions.  We should fix that.

Yeah, for a different series though I assume. And I think it would be
better suited in a suite dedicated to testing asm/inst.h functions.


More information about the Linuxppc-dev mailing list