From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162947AbdEYGQE (ORCPT ); Thu, 25 May 2017 02:16:04 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33603 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162785AbdEYGP7 (ORCPT ); Thu, 25 May 2017 02:15:59 -0400 Date: Thu, 25 May 2017 08:15:55 +0200 From: Ingo Molnar To: Masami Hiramatsu Cc: "Paul E . McKenney" , Steven Rostedt , linux-kernel@vger.kernel.org, Peter Zijlstra , Ananth N Mavinakayanahalli , Thomas Gleixner , "H . Peter Anvin" Subject: Re: [RFC PATCH tip/master] kprobes: Use synchronize_rcu_tasks() for optprobe wit CONFIG_PREEMPT Message-ID: <20170525061555.m2ihe2dvjyedyzwn@gmail.com> References: <149562719270.15375.4565081030740506940.stgit@devbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <149562719270.15375.4565081030740506940.stgit@devbox> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Masami Hiramatsu wrote: > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -377,6 +377,23 @@ static inline void copy_kprobe(struct kprobe *ap, struct kprobe *p) > static bool kprobes_allow_optimization; > > /* > + * Synchronizing wait on trampline code for interrupted tasks/threads. > + * Since the threads running on dynamically allocated trampline code > + * can be interrupted, kprobes has to wait for those tasks back on > + * track and scheduled. If the kernel is preemptive, the thread can be > + * preempted by other tasks on the trampoline too. For such case, this > + * calls synchronize_rcu_tasks() to wait for those tasks back on track. > + */ > +static void synchronize_on_trampoline(void) > +{ > +#ifdef CONFIG_PREEMPT > + synchronize_rcu_tasks(); > +#else > + synchronize_sched(); > +#endif > +} So that's really unacceptably ugly. Paul, I still question the need to have tasks-RCU as a Kconfig distinction, _especially_ if its API usage results in such ugly secondary #ifdefs... Why isn't there a single synchronize_rcu_tasks() API function, which does what is expected, where the _RCU_ code figures out how to implement it? I.e.: - There should be no user configurable TASKS_RCU Kconfig setting - at most a helper Kconfig that is automatically selected by the RCU code itself. - Both ftrace andkprobes would use a simple synchronize_rcu_tasks() call. Thanks, Ingo