From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 8EA3B1A0060 for ; Fri, 26 Feb 2016 00:52:09 +1100 (AEDT) Received: from newverein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 20013140307 for ; Fri, 26 Feb 2016 00:52:08 +1100 (AEDT) Date: Thu, 25 Feb 2016 14:52:05 +0100 From: Torsten Duwe To: Michael Ellerman Cc: linuxppc-dev@ozlabs.org, bsingharora@gmail.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, kamalesh@linux.vnet.ibm.com, pmladek@suse.com, jeyu@redhat.com, jkosina@suse.cz, live-patching@vger.kernel.org, mbenes@suse.cz Subject: Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel Message-ID: <20160225135205.GF21932@lst.de> References: <1456324115-21144-1-git-send-email-mpe@ellerman.id.au> <1456324115-21144-4-git-send-email-mpe@ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1456324115-21144-4-git-send-email-mpe@ellerman.id.au> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, Feb 25, 2016 at 01:28:27AM +1100, Michael Ellerman wrote: > @@ -450,17 +448,44 @@ static unsigned long stub_for_addr(const Elf64_Shdr *sechdrs, > return (unsigned long)&stubs[i]; > } > > +#ifdef CC_USING_MPROFILE_KERNEL > +static int is_early_mcount_callsite(u32 *instruction) > +{ > + /* -mprofile-kernel sequence starting with > + * mflr r0 and maybe std r0, LRSAVE(r1). > + */ > + if ((instruction[-3] == PPC_INST_MFLR && > + instruction[-2] == PPC_INST_STD_LR) || > + instruction[-2] == PPC_INST_MFLR) { > + /* Nothing to be done here, it's an _mcount > + * call location and r2 will have to be > + * restored in the _mcount function. > + */ > + return 1; > + } > + return 0; > +} > +#else *You* said this might page fault :) Did we agree yet whether we insist on a streamlined compiler? (GCC commit e95d0248dace required)? If not: if (instruction[-2] == PPC_INST_STD_LR) { if (instruction[-3] == PPC_INST_MFLR) return 1; } else if (instruction[-2] == PPC_INST_MFLR) return 1; return 0; leaves less freedom for the compiler to "optimise". Signed-off-by: Torsten Duwe Torsten