From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752943AbcFALnQ (ORCPT ); Wed, 1 Jun 2016 07:43:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:44613 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbcFALnO (ORCPT ); Wed, 1 Jun 2016 07:43:14 -0400 Date: Wed, 1 Jun 2016 13:43:15 +0200 (CEST) From: Miroslav Benes To: Christopher Arges cc: jpoimboe@redhat.com, jeyu@redhat.com, jikos@kernel.org, pmladek@suse.com, jslaby@suse.cz, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, huawei.libin@huawei.com, minfei.huang@yahoo.com Subject: Re: [PATCH v2] livepatch: allow removal of a disabled patch In-Reply-To: <20160601112949.GA11285@gmail.com> Message-ID: References: <20160601083159.7004-1-mbenes@suse.cz> <20160601112949.GA11285@gmail.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Jun 2016, Christopher Arges wrote: > On Wed, Jun 01, 2016 at 10:31:59AM +0200, Miroslav Benes wrote: > > > > diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c > > index 92819bb0961b..6cc49d253195 100644 > > --- a/kernel/livepatch/transition.c > > +++ b/kernel/livepatch/transition.c > > @@ -197,13 +197,21 @@ void klp_complete_transition(void) > > struct klp_func *func; > > struct task_struct *g, *task; > > unsigned int cpu; > > + bool is_immediate = false; > > > > if (klp_transition_patch->immediate) > > goto done; > > > > - klp_for_each_object(klp_transition_patch, obj) > > - klp_for_each_func(obj, func) > > + klp_for_each_object(klp_transition_patch, obj) { > > + klp_for_each_func(obj, func) { > > func->transition = false; > > + if (func->immediate) > > + is_immediate = true; > > Once an immediate function is found you could return from this function since > releasing a reference from the livepatch module is no longer possible. That is true, but I think we should tidy up after the patching process even in this case. That is clear all func->transition, task->patch_state and task->TIF_PATCH_PENDING flags. These all could be set if patch->immediate is false and one of the func->immediate is true. Regards, Miroslav