From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762075AbdAJKkN (ORCPT ); Tue, 10 Jan 2017 05:40:13 -0500 Received: from mx2.suse.de ([195.135.220.15]:50653 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754711AbdAJKkK (ORCPT ); Tue, 10 Jan 2017 05:40:10 -0500 Date: Tue, 10 Jan 2017 11:40:04 +0100 From: Petr Mladek To: Josh Poimboeuf Cc: Miroslav Benes , Jessica Yu , Jiri Kosina , Linux Kernel Mailing List , live-patching@vger.kernel.org, Michael Ellerman , Heiko Carstens , x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Vojtech Pavlik , Jiri Slaby , Chris J Arges , Andy Lutomirski , Ingo Molnar , Peter Zijlstra Subject: Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model Message-ID: <20170110104004.GG20785@pathway.suse.cz> References: <20161220173246.GC25166@pathway.suse.cz> <20161221212505.dbxeddu2skmjmwiq@treble> <20161223101803.GB2541@linux.suse> <20170106200734.d7wvry4upz2ffwem@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170106200734.d7wvry4upz2ffwem@treble> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > > > #include > > > > > > #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