Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

From: Masami Hiramatsu
Date: Thu Sep 10 2020 - 22:32:37 EST


Hi Peter and Ingo,

On Wed, 2 Sep 2020 09:02:26 +0200
peterz@xxxxxxxxxxxxx wrote:

> On Wed, Sep 02, 2020 at 09:37:39AM +0900, Masami Hiramatsu wrote:
> > On Tue, 1 Sep 2020 21:08:08 +0200
> > Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > > On Sat, Aug 29, 2020 at 09:59:49PM +0900, Masami Hiramatsu wrote:
> > > > Masami Hiramatsu (16):
> > > > kprobes: Add generic kretprobe trampoline handler
> > > > x86/kprobes: Use generic kretprobe trampoline handler
> > > > arm: kprobes: Use generic kretprobe trampoline handler
> > > > arm64: kprobes: Use generic kretprobe trampoline handler
> > > > arc: kprobes: Use generic kretprobe trampoline handler
> > > > csky: kprobes: Use generic kretprobe trampoline handler
> > > > ia64: kprobes: Use generic kretprobe trampoline handler
> > > > mips: kprobes: Use generic kretprobe trampoline handler
> > > > parisc: kprobes: Use generic kretprobe trampoline handler
> > > > powerpc: kprobes: Use generic kretprobe trampoline handler
> > > > s390: kprobes: Use generic kretprobe trampoline handler
> > > > sh: kprobes: Use generic kretprobe trampoline handler
> > > > sparc: kprobes: Use generic kretprobe trampoline handler
> > > > kprobes: Remove NMI context check
> > > > kprobes: Free kretprobe_instance with rcu callback
> > > > kprobes: Make local used functions static
> > > >
> > > > Peter Zijlstra (5):
> > > > llist: Add nonatomic __llist_add() and __llist_dell_all()
> > > > kprobes: Remove kretprobe hash
> > > > asm-generic/atomic: Add try_cmpxchg() fallbacks
> > > > freelist: Lock less freelist
> > > > kprobes: Replace rp->free_instance with freelist
> > >
> > > This looks good to me, do you want me to merge them through -tip? If so,
> > > do we want to try and get them in this release still?
> >
> > Yes, thanks. For the kretprobe missing issue, we will need the first half
> > (up to "kprobes: Remove NMI context check"), so we can split the series
> > if someone think the lockless is still immature.
>
> Ok, but then lockdep will yell at you if you have that enabled and run
> the unoptimized things.
>
> > > Ingo, opinions? This basically fixes a regression cauesd by
> > >
> > > 0d00449c7a28 ("x86: Replace ist_enter() with nmi_enter()")

So what would you think of this? I saw the unification part of this series
on the tip/master, but lockless part is not there. This might still keep
lockdep to warn on kretprobes if we disable CONFIG_FUNCTION_TRACER and
optprobe.

If we make the kretprobe lockless, we will remove all locks from in-kernel
kprobe handlers. So at least upstream user will be happy.

Or, do we fix lockdep warning on the spinlocks in kprobe handlers first?

Thank you,

--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>