From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753374AbcBPFrZ (ORCPT ); Tue, 16 Feb 2016 00:47:25 -0500 Received: from e28smtp08.in.ibm.com ([125.16.236.8]:57677 "EHLO e28smtp08.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753061AbcBPFrX (ORCPT ); Tue, 16 Feb 2016 00:47:23 -0500 X-IBM-Helo: d28relay01.in.ibm.com X-IBM-MailFrom: kamalesh@linux.vnet.ibm.com X-IBM-RcptTo: live-patching@vger.kernel.org;linux-kernel@vger.kernel.org Date: Tue, 16 Feb 2016 11:17:02 +0530 From: Kamalesh Babulal To: Petr Mladek Cc: Balbir Singh , Jessica Yu , linux-kernel@vger.kernel.org, Steven Rostedt , Torsten Duwe , Jiri Kosina , live-patching@vger.kernel.org, Miroslav Benes , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v8 8/8] livepatch: Detect offset for the ftrace location during build Message-ID: <20160216054701.GA20570@linux.vnet.ibm.com> Reply-To: Kamalesh Babulal References: <20160210174221.EBBEC692C8@newverein.lst.de> <20160210174517.8347D692C8@newverein.lst.de> <1455293609.16012.9.camel@gmail.com> <20160212164517.GO12548@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20160212164517.GO12548@pathway.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable x-cbid: 16021605-0029-0000-0000-00000AF0E86A Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Petr Mladek [2016-02-12 17:45:17]: [...] > I guess that you used a broken gcc and cheated the check > to pass the compilation. Did you, please? > > The test used to detect the offset is using a minimalistic > function is is afftected by the gcc bug. > > The patch below might be used to cheat the offset check as well. > > Torsten, please mention this somewhere if you, just by chance, > send a new version of the patchset. > > From f6a438a3f2f60cc1acc859b41d0cc9259c9a331e Mon Sep 17 00:00:00 2001 > From: root > Date: Tue, 2 Feb 2016 15:35:06 +0100 > Subject: [PATCH 2/2] livepatch: Make sure the TOC is handled when detecting > ftrace location > > There seems to be a bug in gcc on PPC. It does not handle TOC > if the function does not access global variables or functions > by default. But it should when profiling is enabled. > > This patch works around this problem by adding a call > to a global function. > > This patch is for testing only! > --- > kernel/livepatch/ftrace-test.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/livepatch/ftrace-test.c b/kernel/livepatch/ftrace-test.c > index 22f0c54bf7b3..a3b7aabb67e5 100644 > --- a/kernel/livepatch/ftrace-test.c > +++ b/kernel/livepatch/ftrace-test.c > @@ -1,6 +1,9 @@ > /* Sample code to figure out mcount location offset */ > +#include > + > > int test(int a) > { > + printk("%d\n", a); > return ++a; > } Thanks. This workaround, helped to load sample livepatch module. Thanks, Kamalesh.