From patchwork Mon Feb 15 22:21:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Torsten Duwe X-Patchwork-Id: 583095 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5B90F1402C0 for ; Tue, 16 Feb 2016 09:22:25 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3FBDC1A03FE for ; Tue, 16 Feb 2016 09:22:25 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org 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 lists.ozlabs.org (Postfix) with ESMTPS id 43F121A0065 for ; Tue, 16 Feb 2016 09:21:16 +1100 (AEDT) Received: by newverein.lst.de (Postfix, from userid 2005) id CF87468C4F; Mon, 15 Feb 2016 23:21:11 +0100 (CET) Date: Mon, 15 Feb 2016 23:21:11 +0100 From: Torsten Duwe To: Michael Ellerman Subject: Re: [PATCH v8 4/8] ppc64 ftrace_with_regs configuration variables Message-ID: <20160215222111.GA3321@lst.de> References: <20160210174221.EBBEC692C8@newverein.lst.de> <20160210174450.9C065692C8@newverein.lst.de> <1455176897.2885.12.camel@gmail.com> <20160211084230.GB29683@lst.de> <1455532035.26205.5.camel@ellerman.id.au> <20160215140408.GA22872@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160215140408.GA22872@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Petr Mladek , Jessica Yu , Jiri Kosina , linux-kernel@vger.kernel.org, Steven Rostedt , live-patching@vger.kernel.org, Miroslav Benes , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Feb 15, 2016 at 03:04:08PM +0100, Torsten Duwe wrote: > If you use "-pg -mprofile-kernel", gcc seems to forget that, and omits the TOC > load, for a similar assembler calling sequence. > > Looking at the code I can _understand_ why this is so, but my GCC knowledge > is not that deep that I could easily _fix_ this reliably. Nonetheless, here's a proposal. --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -25154,6 +25154,10 @@ rs6000_emit_prologue (void) { cfun->machine->r2_setup_needed = df_regs_ever_live_p (TOC_REGNUM); + /* Profiling _will_ generate a call to a global _mcount. */ + if (crtl->profile) + cfun->machine->r2_setup_needed = true; + /* With -mminimal-toc we may generate an extra use of r2 below. */ if (TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0) cfun->machine->r2_setup_needed = true;