Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752968AbbDARXA (ORCPT ); Wed, 1 Apr 2015 13:23:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53957 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271AbbDARW6 (ORCPT ); Wed, 1 Apr 2015 13:22:58 -0400 Date: Wed, 1 Apr 2015 12:22:56 -0500 From: Josh Poimboeuf To: Minfei Huang Cc: Jiri Kosina , sjenning@redhat.com, vojtech@suse.cz, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] livepatch: Enhance livepatch to support remove patch module dynamically Message-ID: <20150401172256.GA6265@treble.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 Content-Length: 2003 Lines: 55 On Wed, Apr 01, 2015 at 10:40:19PM +0800, Minfei Huang wrote: > 2015-04-01 22:13 GMT+08:00 Jiri Kosina : > > On Wed, 1 Apr 2015, Minfei Huang wrote: > > > >> > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > >> > > index 3f9f1d6..0266950 100644 > >> > > --- a/kernel/livepatch/core.c > >> > > +++ b/kernel/livepatch/core.c > >> > > @@ -502,6 +502,17 @@ static int __klp_disable_patch(struct klp_patch *patch) > >> > > return 0; > >> > > } > >> > > > >> > > +static int __klp_disable_patch_nolock(struct klp_patch *patch) > >> > > +{ > >> > > + int ret = 0; > >> > > + > >> > > + ret = __klp_disable_patch(patch); > >> > > + if (ret) > >> > > + return ret; > >> > > + module_put(patch->mod); > >> > > + return ret; > >> > > +} > >> > > + > >> > > >> > Your patch doesn't solve the problem at all. > >> > > >> > There is no guarantee that once __klp_disable_patch() returns noone is > >> > using the old code any more. > >> > > >> > >> Yes, thanks. > >> > >> The __klp_disable_patch only guarantees that we will never call the > >> function in patch module. For now, patch module can never be removed > >> from the kernel once it was loaded. It may be inconvenience if we want > >> re-load a new patch module replace the old patch module. > > > > Patch stacking is possible though. > > > > How about check the stack when start to remove the patch module? We > can use the interface stop_machine to hang other CPU, then check and > remove if no function in patch module is used. Yeah, we'll eventually have something like that as part of the consistency model. The exact implementation is still undecided. Until then I think we want to disallow removing the patch module. -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/