lkml.org 
[lkml]   [2013]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/8] x86: speed up int3-based patching using less paranoid write
On Fri, 08 Nov 2013 21:04:26 +0900
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:


> > static void do_sync_core(void *info)
> > {
> > sync_core();
> > @@ -648,15 +687,15 @@ void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler)
> > */
> > smp_wmb();
> >
> > - text_poke(addr, &int3, sizeof(int3));
> > + text_poke_part(addr, &int3, sizeof(int3));
>
> Anyway, text_poke itself will cause a BUG if it hits an error, but text_poke_part() seems
> silently failing. It should handle the error correctly (or call BUG()).
>

text_poke_part() shouldn't do a bug on error, but this code probably
should.

if (text_poke_part(addr, &int3, sizeof(int3)))
BUG();

Note, I would avoid doing:

BUG_ON(text_poke_part(...));

as we don't want "side effects" in the BUG() macros. You may do:

ret = text_poke_part(...);
BUG_ON(ret);

Which has the added benefit of the implicit "unlikely" in the BUG_ON()
macro.

Or we can have do_sync_core() be able to handle errors and have their
callers handle them too.

-- Steve


\
 
 \ /
  Last update: 2013-11-08 16:01    [W:0.036 / U:4.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site