Re: [PATCH -v5 12/17] x86/kprobes: Fix ordering
From: Peter Zijlstra
Date: Thu Nov 14 2019 - 10:58:58 EST
On Thu, Nov 14, 2019 at 04:42:55PM +0100, Peter Zijlstra wrote:
> On Thu, Nov 14, 2019 at 10:30:01AM -0500, Mathieu Desnoyers wrote:
> > ----- On Nov 14, 2019, at 10:28 AM, Peter Zijlstra peterz@xxxxxxxxxxxxx wrote:
>
> > > I don't think that is needed. As per the patch under discussion, we
> > > unconditionally need that IPI-sync (even for !optimized) but we only
> > > need the synchonize_rcu_tasks() thing for optimized kprobes.
> > >
> > > Also, they really do two different things. Lets not tie them together.
> >
> > I'm fine with this approach, I just thought it would be good to consider
> > the alternative.
>
> Fair enough; I also just remembered we use synchronize_rcu_tasks() in
> scenarios where we don't need to IPI-sync, for instrance when freeing
> ftrace trampolines. There we just want to make sure nothing is still
> preempted inside the trampoline when we free it -- which would be BAD
> :-)
One more thing. I have a TODO item for making text_poke_sync() more
complicated.
Specifically we don't have to IPI CPUs that are in NOHZ_FULL userspace
context, provided we can make the kernel entry perform the
core-serialize thing.
It's not far up the TODO list though, but I figure I'd mention it just
in case other people fancy having a go.