From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932958AbcBDJb5 (ORCPT ); Thu, 4 Feb 2016 04:31:57 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36263 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753963AbcBDJbs (ORCPT ); Thu, 4 Feb 2016 04:31:48 -0500 Subject: Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel To: Torsten Duwe , Jiri Kosina References: <20160125170459.14DB7692CE@newverein.lst.de> <20160125170723.D2CCE692CE@newverein.lst.de> <56B1AAE5.10500@linaro.org> <20160203112449.GA27247@lst.de> Cc: Steven Rostedt , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org From: AKASHI Takahiro Message-ID: <56B31A7C.2050803@linaro.org> Date: Thu, 4 Feb 2016 18:31:40 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20160203112449.GA27247@lst.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jiri, Torsten Thank you for your explanation. On 02/03/2016 08:24 PM, Torsten Duwe wrote: > On Wed, Feb 03, 2016 at 09:55:11AM +0100, Jiri Kosina wrote: >> On Wed, 3 Feb 2016, AKASHI Takahiro wrote: >>> those efforts, we are proposing[1] a new *generic* gcc option, -fprolog-add=N. >>> This option will insert N nop instructions at the beginning of each function. > >> The interesting part of the story with ppc64 is that you indeed want to >> create the callsite before the *most* of the prologue, but not really :) > > I was silently assuming that GCC would do this right on ppc64le; add the NOPs > right after the TOC load. Or after TOC load and LR save? ... On arm/arm64, link register must be saved before any function call. So anyhow we will have to add something, 3 instructions at the minimum, like: save lr branch _mcount restore lr ... ... >> The part of the prologue where TOC pointer is saved needs to happen before >> the fentry/profiling call. > > Yes, any call, to any profiler/tracer/live patcher is potentially global > and needs the _new_ TOC value. I don't want to bother you, but for my better understandings, could you show me an example of asm instructions for a function prologue under -mprofile-kernel, please? -Takahiro AKASHI > This proposal, if implemented in a too naive fashion, will worsen the problem > we currently discuss: a few NOPs _never_ cause any global reference. GCC might > be even more inclined to not load a new TOC value. That change would need to be > fairly smart on ppc64le. > > Torsten >