Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752083AbcDKDbe (ORCPT ); Sun, 10 Apr 2016 23:31:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35895 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbcDKDbc (ORCPT ); Sun, 10 Apr 2016 23:31:32 -0400 Date: Sun, 10 Apr 2016 23:31:28 -0400 From: Jessica Yu To: Josh Poimboeuf Cc: Jiri Kosina , Miroslav Benes , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Vojtech Pavlik Subject: Re: livepatch: separate enabled and patched states Message-ID: <20160411033127.GC12795@packer-debian-8-amd64.digitalocean.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-OS: Linux eisen.io 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2296 Lines: 70 +++ Josh Poimboeuf [25/03/16 14:34 -0500]: >Once we have a consistency model, patches and their objects will be >enabled and disabled at different times. For example, when a patch is >disabled, its loaded objects' funcs can remain registered with ftrace >indefinitely until the unpatching operation is complete and they're no >longer in use. > >It's less confusing if we give them different names: patches can be >enabled or disabled; objects (and their funcs) can be patched or >unpatched: > >- Enabled means that a patch is logically enabled (but not necessarily > fully applied). > >- Patched means that an object's funcs are registered with ftrace and > added to the klp_ops func stack. > >Also, since these states are binary, represent them with booleans >instead of ints. > >Signed-off-by: Josh Poimboeuf >--- > include/linux/livepatch.h | 17 ++++------- > kernel/livepatch/core.c | 72 +++++++++++++++++++++++------------------------ > 2 files changed, 42 insertions(+), 47 deletions(-) > >diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h >index bd830d5..6d45dc7 100644 >--- a/include/linux/livepatch.h >+++ b/include/linux/livepatch.h >@@ -28,11 +28,6 @@ > > #include > >-enum klp_state { >- KLP_DISABLED, >- KLP_ENABLED >-}; >- > /** > * struct klp_func - function structure for live patching > * @old_name: name of the function to be patched >@@ -41,8 +36,8 @@ enum klp_state { > * can be found (optional) > * @old_addr: the address of the function being patched > * @kobj: kobject for sysfs resources >- * @state: tracks function-level patch application state > * @stack_node: list node for klp_ops func_stack list >+ * @patched: the func has been added to the klp_ops list > */ > struct klp_func { > /* external */ >@@ -60,8 +55,8 @@ struct klp_func { > /* internal */ > unsigned long old_addr; > struct kobject kobj; >- enum klp_state state; > struct list_head stack_node; >+ bool patched; > }; > > /** >@@ -90,7 +85,7 @@ struct klp_reloc { > * @kobj: kobject for sysfs resources > * @mod: kernel module associated with the patched object > * (NULL for vmlinux) >- * @state: tracks object-level patch application state >+ * @patched: the object's funcs have been add to the klp_ops list s/add/added :)