Re: [PATCH v3 tip/core/rcu 3/9] rcu: Add synchronous grace-period waiting for RCU-tasks
From: Peter Zijlstra
Date: Fri Aug 08 2014 - 12:27:32 EST
On Fri, Aug 08, 2014 at 10:58:58AM -0400, Steven Rostedt wrote:
> > > No, they are also used by optimized kprobes. This is why optimized
> > > kprobes depend on !CONFIG_PREEMPT. [ added Masami to the discussion ].
> > How do those work? Is that one where the INT3 relocates the instruction
> > stream into an alternative 'text' and that JMPs back into the original
> > stream at the end?
> No, it's where we replace the 'int3' with a jump to a trampoline that
> simulates an INT3. Speeds things up quite a bit.
OK, so the trivial 'fix' for that is to patch the probe site like:
preempt_disable(); INC GS:%__preempt_count
call trampoline; CALL 0xDEADBEEF
preempt_enable(); DEC GS:%__preempt_count
At which point the preempt_disable/enable() are the read side primitives
and call_rcu_sched/synchronize_sched are sufficient to release it.
With the per-cpu preempt count stuff we have on x86 that is 4
instructions for the preempt_*() stuff -- they're 'big' instructions
though, since 3 have memops and 2 have a segment prefix.
Description: PGP signature