From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965016AbbJ1IQd (ORCPT ); Wed, 28 Oct 2015 04:16:33 -0400 Received: from smtprelay0108.hostedemail.com ([216.40.44.108]:38854 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752457AbbJ1IQa (ORCPT ); Wed, 28 Oct 2015 04:16:30 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:966:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2553:2559:2562:2693:2731:2907:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3872:3874:4321:4385:5007:6117:6119:6261:7875:7903:8660:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12291:12517:12519:12555:12740:13148:13230:14096:14097:21080:21212:30054: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:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: swim37_1b2a6b3847009 X-Filterd-Recvd-Size: 3284 Date: Wed, 28 Oct 2015 04:16:19 -0400 From: Steven Rostedt To: Li Bin Cc: , , , , , , , Subject: Re: [PATCH] recordmcount: arm64: replace the ignored mcount call into nop Message-ID: <20151028041619.4e44491a@grimm.local.home> In-Reply-To: <1446019445-14421-1-git-send-email-huawei.libin@huawei.com> References: <1446019445-14421-1-git-send-email-huawei.libin@huawei.com> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; 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 On Wed, 28 Oct 2015 16:04:05 +0800 Li Bin wrote: > By now, the recordmcount only records the function that in > following sections: > .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/ > .kprobes.text/.text.unlikely > > For the function that not in these sections, the call mcount > will be in place and not be replaced when kernel boot up. And > it will bring performance overhead, such as do_mem_abort (in > .exception.text section). This patch make the call mcount to > nop for this case in recordmcount. I can take this in my tree with an Ack from the ARM64 maintainers. -- Steve > > Signed-off-by: Li Bin > --- > scripts/recordmcount.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c > index 3d1984e..f697226 100644 > --- a/scripts/recordmcount.c > +++ b/scripts/recordmcount.c > @@ -42,6 +42,7 @@ > > #ifndef EM_AARCH64 > #define EM_AARCH64 183 > +#define R_AARCH64_NONE 0 > #define R_AARCH64_ABS64 257 > #endif > > @@ -160,6 +161,21 @@ static int make_nop_x86(void *map, size_t const offset) > return 0; > } > > +static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5}; > +static int make_nop_arm64(void *map, size_t const offset) > +{ > + uint32_t *ptr; > + > + ptr = map + offset; > + if (*ptr != 0x94000000) > + return -1; > + > + /* Convert to nop */ > + ulseek(fd_map, offset, SEEK_SET); > + uwrite(fd_map, ideal_nop, 4); > + return 0; > +} > + > /* > * Get the whole file as a programming convenience in order to avoid > * malloc+lseek+read+free of many pieces. If successful, then mmap > @@ -353,7 +369,12 @@ do_file(char const *const fname) > altmcount = "__gnu_mcount_nc"; > break; > case EM_AARCH64: > - reltype = R_AARCH64_ABS64; gpfx = '_'; break; > + reltype = R_AARCH64_ABS64; > + make_nop = make_nop_arm64; > + rel_type_nop = R_AARCH64_NONE; > + ideal_nop = ideal_nop4_arm64; > + gpfx = '_'; > + break; > case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break; > case EM_METAG: reltype = R_METAG_ADDR32; > altmcount = "_mcount_wrapper";