lkml.org 
[lkml]   [2020]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RESEND][PATCH v3 09/17] x86/static_call: Add out-of-line static call implementation
On Tue, Mar 24, 2020 at 02:56:12PM +0100, Peter Zijlstra wrote:
> +static void __static_call_transform(void *insn, u8 opcode, void *func)
> +{
> + const void *code = text_gen_insn(opcode, (long)insn, (long)func);
> +
> + if (WARN_ONCE(*(u8 *)insn != opcode,
> + "unexpected static call insn opcode 0x%x at %pS\n",
> + opcode, insn))
> + return;
> +
> + if (memcmp(insn, code, CALL_INSN_SIZE) == 0)
> + return;
> +
> + text_poke_bp(insn, code, CALL_INSN_SIZE, NULL);

Right, this is working with CALL_INSN_SIZE but ...

> +}
> +
> +void arch_static_call_transform(void *site, void *tramp, void *func)
> +{
> + mutex_lock(&text_mutex);
> +
> + if (tramp)
> + __static_call_transform(tramp, JMP32_INSN_OPCODE, func);

... it gets called with JMP32_INSN_OPCODE too. I mean, both lengths are
equal and all - it is just a bit confusing at a first glance. Maybe slap
a small comment that it is ok.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2020-03-26 15:57    [W:1.340 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site