From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760665AbcBYOjP (ORCPT ); Thu, 25 Feb 2016 09:39:15 -0500 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:51643 "EHLO e23smtp02.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760249AbcBYOjN (ORCPT ); Thu, 25 Feb 2016 09:39:13 -0500 X-IBM-Helo: d23dlp02.au.ibm.com X-IBM-MailFrom: kamalesh@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;live-patching@vger.kernel.org Date: Thu, 25 Feb 2016 20:08:04 +0530 From: Kamalesh Babulal To: Michael Ellerman Cc: linuxppc-dev@ozlabs.org, bsingharora@gmail.com, duwe@lst.de, linux-kernel@vger.kernel.org, rostedt@goodmis.org, pmladek@suse.com, jeyu@redhat.com, jkosina@suse.cz, live-patching@vger.kernel.org, mbenes@suse.cz Subject: Re: [PATCH 01/12] powerpc/module: Only try to generate the ftrace_caller() stub once Message-ID: <20160225143800.GA5530@linux.vnet.ibm.com> Reply-To: Kamalesh Babulal References: <1456324115-21144-1-git-send-email-mpe@ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1456324115-21144-1-git-send-email-mpe@ellerman.id.au> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16022514-0005-0000-0000-000003652396 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Michael Ellerman [2016-02-25 01:28:24]: > Currently we generate the module stub for ftrace_caller() at the bottom > of apply_relocate_add(). However apply_relocate_add() is potentially > called more than once per module, which means we will try to generate > the ftrace_caller() stub multiple times. > > Although the current code deals with that correctly, ie. it only > generates a stub the first time, it would be clearer to only try to > generate the stub once. > > Note also on first reading it may appear that we generate a different > stub for each section that requires relocation, but that is not the > case. The code in stub_for_addr() that searches for an existing stub > uses sechdrs[me->arch.stubs_section], ie. the single stub section for > this module. > > A cleaner approach is to only generate the ftrace_caller() stub once, > from module_finalize(). An additional benefit is we can clean the ifdefs > up a little. > > Finally we must propagate the const'ness of some of the pointers passed > to module_finalize(), but that is also an improvement. > > Signed-off-by: Michael Ellerman For all of the patches in the series. Tested-by: Kamalesh Babulal Regards, Kamalesh.