Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1555133

Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model
Date 2017-01-10 11:50 +0100
Message-ID <sY2a6-dY-3@gated-at.bofh.it> (permalink)
References (2 earlier) <sQwym-89-1@gated-at.bofh.it> <sQWCt-fm-1@gated-at.bofh.it> <sRukO-53Q-3@gated-at.bofh.it> <sRv7b-5zL-1@gated-at.bofh.it> <sWIZQ-6RX-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3 13/15] livepatch: change to a per-task consistency  model Josh Poimboeuf <jpoimboe@redhat.com> - 2017-01-06 21:10 +0100
  Re: [PATCH v3 13/15] livepatch: change to a per-task consistency  model Petr Mladek <pmladek@suse.com> - 2017-01-10 11:50 +0100

csiph-web