Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932956AbdLRH3x (ORCPT ); Mon, 18 Dec 2017 02:29:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:60610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752222AbdLRH3u (ORCPT ); Mon, 18 Dec 2017 02:29:50 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EA2120C0C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org Date: Mon, 18 Dec 2017 16:29:47 +0900 From: Masami Hiramatsu To: Josef Bacik Cc: netdev@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, darrick.wong@oracle.com, linux-kernel@vger.kernel.org, Josef Bacik Subject: Re: [PATCH] trace: reenable preemption if we modify the ip Message-Id: <20171218162947.bfe9442534fea482ab310ac6@kernel.org> In-Reply-To: <1513392177-10298-1-git-send-email-josef@toxicpanda.com> References: <1513392177-10298-1-git-send-email-josef@toxicpanda.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1542 Lines: 51 On Fri, 15 Dec 2017 21:42:57 -0500 Josef Bacik wrote: > From: Josef Bacik > > Things got moved around between the original bpf_override_return patches > and the final version, and now the ftrace kprobe dispatcher assumes if > you modified the ip that you also enabled preemption. Make a comment of > this and enable preemption, this fixes the lockdep splat that happened > when using this feature. > > Signed-off-by: Josef Bacik > --- > kernel/trace/trace_kprobe.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index 5db849809a56..91f4b57dab82 100644 > --- a/kernel/trace/trace_kprobe.c > +++ b/kernel/trace/trace_kprobe.c > @@ -1322,8 +1322,15 @@ static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) > if (tk->tp.flags & TP_FLAG_TRACE) > kprobe_trace_func(tk, regs); > #ifdef CONFIG_PERF_EVENTS > - if (tk->tp.flags & TP_FLAG_PROFILE) > + if (tk->tp.flags & TP_FLAG_PROFILE) { > ret = kprobe_perf_func(tk, regs); > + /* > + * The ftrace kprobe handler leaves it up to us to re-enable > + * preemption here before returning if we've modified the ip. > + */ > + if (ret) > + preempt_enable_no_resched(); Where is reset_current_kprobe()? Since kprobes still expects this modification is used by jprobes, we need to call it in caller-side. Thank you, > + } > #endif > return ret; > } > -- > 2.7.5 > -- Masami Hiramatsu