[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6B0B7437-0577-4FE7-A0BC-EFB5D94B8C21@vmware.com>
Date: Fri, 11 Jan 2019 21:36:59 +0000
From: Nadav Amit <namit@...are.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>
CC: Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
the arch/x86 maintainers <x86@...nel.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Masami Hiramatsu <mhiramat@...nel.org>,
Jason Baron <jbaron@...mai.com>, Jiri Kosina <jkosina@...e.cz>,
David Laight <David.Laight@...lab.com>,
Borislav Petkov <bp@...en8.de>,
Julia Cartwright <julia@...com>, Jessica Yu <jeyu@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Edward Cree <ecree@...arflare.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>
Subject: Re: [PATCH v3 0/6] Static calls
> On Jan 11, 2019, at 1:22 PM, Josh Poimboeuf <jpoimboe@...hat.com> wrote:
>
> On Fri, Jan 11, 2019 at 12:46:39PM -0800, Linus Torvalds wrote:
>> On Fri, Jan 11, 2019 at 12:31 PM Josh Poimboeuf <jpoimboe@...hat.com> wrote:
>>> I was referring to the fact that a single static call key update will
>>> usually result in patching multiple call sites. But you're right, it's
>>> only 1-2 trampolines per text_poke_bp() invocation. Though eventually
>>> we may want to batch all the writes like what Daniel has proposed for
>>> jump labels, to reduce IPIs.
>>
>> Yeah, my suggestion doesn't allow for batching, since it would
>> basically generate one trampoline for every rewritten instruction.
>
> As Andy said, I think batching would still be possible, it's just that
> we'd have to create multiple trampolines at a time.
>
> Or... we could do a hybrid approach: create a single custom trampoline
> which has the call destination patched in, but put the return address in
> %rax -- which is always clobbered, even for callee-saved PV ops. Like:
>
> trampoline:
> push %rax
> call patched-dest
>
> That way the batching could be done with a single trampoline
> (particularly if using rcu-sched to avoid the sti hack).
I don’t see RCU-sched solves the problem if you don’t disable preemption. On
a fully preemptable kernel, you can get preempted between the push and the
call (jmp) or before the push. RCU-sched can then finish, and the preempted
task may later jump to a wrong patched-dest.
Powered by blists - more mailing lists