Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751246AbcCHVnM (ORCPT ); Tue, 8 Mar 2016 16:43:12 -0500 Received: from smtprelay0074.hostedemail.com ([216.40.44.74]:59359 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750903AbcCHVnC (ORCPT ); Tue, 8 Mar 2016 16:43:02 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 30,2,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1543:1593:1594:1605:1711:1730:1747:1777:1792:2198:2199:2393:2525:2553:2560:2563:2682:2685:2859:2895:2911:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4425:4605:5007:6261:7514:7576:7875:7903:8660:9025:10010:10400:10848:10967:11026:11232:11658:11914:12043:12291:12294:12295:12296:12438:12517:12519:12555:12663:12683:12740:13095:13148:13230:13439:14096:14097:14659:14721:21080:30003:30025:30054:30070:30089:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:1:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: tray09_3700102a14304 X-Filterd-Recvd-Size: 4958 Date: Tue, 8 Mar 2016 16:42:56 -0500 From: Steven Rostedt To: Petr Mladek Cc: linuxppc-dev@ozlabs.org, Balbir Singh , duwe@lst.de, linux-kernel@vger.kernel.org, kamalesh@linux.vnet.ibm.com, jeyu@redhat.com, jkosina@suse.cz, live-patching@vger.kernel.org, mbenes@suse.cz, Torsten Duwe Subject: Re: [PATCH][v4] livepatch/ppc: Enable livepatching on powerpc Message-ID: <20160308164256.5979e42f@gandalf.local.home> In-Reply-To: <1457023921-2051-1-git-send-email-pmladek@suse.com> References: <1457023921-2051-1-git-send-email-pmladek@suse.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3837 Lines: 99 On Thu, 3 Mar 2016 17:52:01 +0100 Petr Mladek wrote: > From: Balbir Singh > > Changelog v4: > 1. Renamed klp_matchaddr() to klp_get_ftrace_location() > and used it just to convert the function address. > 2. Synced klp_write_module_reloc() with s390(); made it > inline, no error message, return -ENOSYS > 3. Added an error message when including > powerpc/include/asm/livepatch.h without HAVE_LIVEPATCH > 4. Update some comments. > Changelog v3: > 1. Moved -ENOSYS to -EINVAL in klp_write_module_reloc > 2. Moved klp_matchaddr to use ftrace_location_range > Changelog v2: > 1. Implement review comments by Michael > 2. The previous version compared _NIP from the > wrong location to check for whether we > are going to a patched location > > This applies on top of the patches posted by Michael > https://patchwork.ozlabs.org/patch/589791/ > > It enables livepatching. This takes patch 6/8 and 7/8 of v8 as the base. > (See the reference [1] below) and adds logic for checking offset ranges > in livepatch with ftrace_location_range. > > I tested the sample in the livepatch > > Signed-off-by: Torsten Duwe > Signed-off-by: Balbir Singh > Signed-off-by: Petr Mladek > --- > arch/powerpc/Kconfig | 3 +++ > arch/powerpc/include/asm/livepatch.h | 47 +++++++++++++++++++++++++++++++++ > arch/powerpc/kernel/Makefile | 1 + > arch/powerpc/kernel/entry_64.S | 50 ++++++++++++++++++++++++++++++++++++ > arch/powerpc/kernel/livepatch.c | 29 +++++++++++++++++++++ > include/linux/ftrace.h | 1 + > include/linux/livepatch.h | 2 ++ > kernel/livepatch/core.c | 28 +++++++++++++++++--- > kernel/trace/ftrace.c | 14 +++++++++- For the changes to the ftrace files, add my: Acked-by: Steven Rostedt You can take the rest. -- Steve > 9 files changed, 171 insertions(+), 4 deletions(-) > create mode 100644 arch/powerpc/include/asm/livepatch.h > create mode 100644 arch/powerpc/kernel/livepatch.c > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h > index c2b340e23f62..fb13cd3e68f9 100644 > --- a/include/linux/ftrace.h > +++ b/include/linux/ftrace.h > @@ -455,6 +455,7 @@ int ftrace_update_record(struct dyn_ftrace *rec, int enable); > int ftrace_test_record(struct dyn_ftrace *rec, int enable); > void ftrace_run_stop_machine(int command); > unsigned long ftrace_location(unsigned long ip); > +unsigned long ftrace_location_range(unsigned long start, unsigned long end); > unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec); > unsigned long ftrace_get_addr_curr(struct dyn_ftrace *rec); > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 57a6eea84694..f4e6aae6ebe7 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -1533,7 +1533,19 @@ static int ftrace_cmp_recs(const void *a, const void *b) > return 0; > } > > -static unsigned long ftrace_location_range(unsigned long start, unsigned long end) > +/** > + * ftrace_location_range - return the first address of a traced location > + * if it touches the given ip range > + * @start: start of range to search. > + * @end: end of range to search (inclusive). @end points to the last byte > + * to check. > + * > + * Returns rec->ip if the related ftrace location is a least partly within > + * the given address range. That is, the first address of the instruction > + * that is either a NOP or call to the function tracer. It checks the ftrace > + * internal tables to determine if the address belongs or not. > + */ > +unsigned long ftrace_location_range(unsigned long start, unsigned long end) > { > struct ftrace_page *pg; > struct dyn_ftrace *rec;