[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170110104004.GG20785@pathway.suse.cz>
Date: Tue, 10 Jan 2017 11:40:04 +0100
From: Petr Mladek <pmladek@...e.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Miroslav Benes <mbenes@...e.cz>, Jessica Yu <jeyu@...hat.com>,
Jiri Kosina <jikos@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
live-patching@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>,
Heiko Carstens <heiko.carstens@...ibm.com>, x86@...nel.org,
linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
Vojtech Pavlik <vojtech@...e.com>, Jiri Slaby <jslaby@...e.cz>,
Chris J Arges <chris.j.arges@...onical.com>,
Andy Lutomirski <luto@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v3 13/15] livepatch: change to a per-task consistency
model
On Fri 2017-01-06 14:07:34, Josh Poimboeuf wrote:
> On Fri, Dec 23, 2016 at 11:18:03AM +0100, Petr Mladek wrote:
> > On Fri 2016-12-23 10:24:35, Miroslav Benes wrote:
> > > > > > diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c
> > > > > > index 5efa262..e79ebb5 100644
> > > > > > --- a/kernel/livepatch/patch.c
> > > > > > +++ b/kernel/livepatch/patch.c
> > > > > > @@ -29,6 +29,7 @@
> > > > > > #include <linux/bug.h>
> > > > > > #include <linux/printk.h>
> > > > > > #include "patch.h"
> > > > > > +#include "transition.h"
> > > > > >
> > > > > > static LIST_HEAD(klp_ops);
> > > > > >
> > > > > > @@ -54,15 +55,53 @@ static void notrace klp_ftrace_handler(unsigned long ip,
> > > > > > {
> > > > > > struct klp_ops *ops;
> > > > > > struct klp_func *func;
> > > > > > + int patch_state;
> > > > > >
> > > > > > ops = container_of(fops, struct klp_ops, fops);
> > > > > >
> > > > > > rcu_read_lock();
> > > > > > +
> > > > > > func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
> > > > > > stack_node);
> > > > > > - if (WARN_ON_ONCE(!func))
> > > > > > +
> > > > > > + if (!func)
> > > > > > goto unlock;
> > > > >
> Yeah, I'm thinking we should keep the warning to catch any bugs in case
> any of our ftrace assumptions change. Maybe I should add a comment:
>
> /*
> * func can never be NULL because preemption should be disabled
> * here and unregister_ftrace_function() does the equivalent of
> * a synchronize_sched() before the func_stack removal.
> */
> if (WARN_ON_ONCE(!func))
> goto unlock;
Sounds reasonable to me.
Best Regards,
Petr
Powered by blists - more mailing lists