From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932435AbcA2PpK (ORCPT ); Fri, 29 Jan 2016 10:45:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48052 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756350AbcA2PpH (ORCPT ); Fri, 29 Jan 2016 10:45:07 -0500 Date: Fri, 29 Jan 2016 09:45:05 -0600 From: Josh Poimboeuf To: Steven Rostedt Cc: Jessica Yu , Seth Jennings , Jiri Kosina , Vojtech Pavlik , Miroslav Benes , Ingo Molnar , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] ftrace: Adjust priority of ftrace module notifier Message-ID: <20160129154505.GF4081@treble.redhat.com> References: <1454049827-3726-1-git-send-email-jeyu@redhat.com> <1454049827-3726-3-git-send-email-jeyu@redhat.com> <20160129093800.6c739e40@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160129093800.6c739e40@gandalf.local.home> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 29, 2016 at 09:38:00AM -0500, Steven Rostedt wrote: > On Fri, 29 Jan 2016 01:43:47 -0500 > Jessica Yu wrote: > > > > --- > > kernel/trace/ftrace.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > > index eca592f..bdd7bfc 100644 > > --- a/kernel/trace/ftrace.c > > +++ b/kernel/trace/ftrace.c > > @@ -5067,7 +5067,12 @@ static int ftrace_module_notify(struct notifier_block *self, > > > > struct notifier_block ftrace_module_nb = { > > .notifier_call = ftrace_module_notify, > > - .priority = INT_MIN, /* Run after anything that can remove kprobes */ > > + /* > > + * Run after anything that can remove kprobes and > > + * after livepatch's going notifier, but run before > > + * livepatch's coming notifier. > > + */ > > + .priority = INT_MIN+1, > > }; > > > > void __init ftrace_init(void) > > Actually, I rather break up the ftrace notifiers into two different > notifiers. One for coming and one for going (I use to have that before > hard coding the module updates in the module code). > > Have the coming notifier be INT_MAX, where it runs before everything > else (which it should, as tracing should be enabled then). And have the > module going to stay INT_MIN to run after everything. That sounds good to me. If we do that then I still think it would be a good idea to split up the livepatch notifiers, with: - INT_MAX-1 for coming so that relocations are all written before any other notifiers (besides ftrace) get a chance to run. - INT_MIN-1 for going. I don't have a good specific reason, but I think the symmetry will create less surprises and possibly fewer bugs if the module's patched state as seen by the other notifiers is the same for coming and going. -- Josh