Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-05 Thread Petr Mladek
On Fri 2016-02-05 15:40:27, Balbir Singh wrote: > On Thu, Feb 4, 2016 at 10:02 PM, Petr Mladek wrote: > For big endian builds I saw > > Dump of assembler code for function alloc_pages_current: >0xc0256f00 <+0>:mflrr0 >0xc0256f04 <+4>:std r0,16(r1) >

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-05 Thread Petr Mladek
On Fri 2016-02-05 15:40:27, Balbir Singh wrote: > On Thu, Feb 4, 2016 at 10:02 PM, Petr Mladek wrote: > For big endian builds I saw > > Dump of assembler code for function alloc_pages_current: >0xc0256f00 <+0>:mflrr0 >0xc0256f04 <+4>:std

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread Balbir Singh
On Thu, Feb 4, 2016 at 10:02 PM, Petr Mladek wrote: > On Thu 2016-02-04 18:31:40, AKASHI Takahiro wrote: >> 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

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread Jiri Kosina
On Thu, 4 Feb 2016, AKASHI Takahiro wrote: > 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 > >... > >... This means that we have

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread Petr Mladek
On Thu 2016-02-04 18:31:40, AKASHI Takahiro wrote: > 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

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread AKASHI Takahiro
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

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread Petr Mladek
On Thu 2016-02-04 18:31:40, AKASHI Takahiro wrote: > 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

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread Jiri Kosina
On Thu, 4 Feb 2016, AKASHI Takahiro wrote: > 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 > >... > >... This means that we have

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread Balbir Singh
On Thu, Feb 4, 2016 at 10:02 PM, Petr Mladek wrote: > On Thu 2016-02-04 18:31:40, AKASHI Takahiro wrote: >> 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: >>

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-04 Thread AKASHI Takahiro
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

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-03 Thread Torsten Duwe
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

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-03 Thread Jiri Kosina
On Wed, 3 Feb 2016, AKASHI Takahiro wrote: > > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > > allows to call _mcount very early in the function, which low-level > > ASM code and code patching functions need to consider. > > Especially the link register and the parameter

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-03 Thread Jiri Kosina
On Wed, 3 Feb 2016, AKASHI Takahiro wrote: > > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > > allows to call _mcount very early in the function, which low-level > > ASM code and code patching functions need to consider. > > Especially the link register and the parameter

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-03 Thread Torsten Duwe
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

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-02 Thread AKASHI Takahiro
Hi, On 01/26/2016 12:26 AM, Torsten Duwe wrote: The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, allows to call _mcount very early in the function, which low-level ASM code and code patching functions need to consider. Especially the link register and the parameter registers

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-02-02 Thread AKASHI Takahiro
Hi, On 01/26/2016 12:26 AM, Torsten Duwe wrote: The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, allows to call _mcount very early in the function, which low-level ASM code and code patching functions need to consider. Especially the link register and the parameter registers

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-28 Thread Torsten Duwe
On Thu, Jan 28, 2016 at 03:26:59PM +1100, Michael Ellerman wrote: > > That raises an interesting question, how does it work *without* > DYNAMIC_FTRACE? > > It looks like you haven't updated that version of _mcount at all? Or maybe I'm > missing an #ifdef somewhere? You didn't, I did. I haven't

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-28 Thread Torsten Duwe
On Thu, Jan 28, 2016 at 03:26:59PM +1100, Michael Ellerman wrote: > > That raises an interesting question, how does it work *without* > DYNAMIC_FTRACE? > > It looks like you haven't updated that version of _mcount at all? Or maybe I'm > missing an #ifdef somewhere? You didn't, I did. I haven't

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Michael Ellerman
On Wed, 2016-01-27 at 11:44 +0100, Torsten Duwe wrote: > On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > > Hi Torsten, > > > > > +++ b/arch/powerpc/kernel/entry_64.S > > > @@ -1206,7 +1206,12 @@ _GLOBAL(enter_prom) > > > #ifdef CONFIG_DYNAMIC_FTRACE > > > _GLOBAL(mcount) > >

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Michael Ellerman
On Wed, 2016-01-27 at 23:28 +1030, Alan Modra wrote: > On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > > Hi Torsten, > > > > On Mon, 2016-01-25 at 16:26 +0100, Torsten Duwe wrote: > > > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > > > allows to call

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Torsten Duwe
On Wed, Jan 27, 2016 at 11:28:09PM +1030, Alan Modra wrote: > On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > > > > Can we use r11 instead? eg: > > > > _GLOBAL(_mcount) > > mflrr11 > > mtctr r11 > > mtlrr0 > > bctr > > Depends on what you need to

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Alan Modra
On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > Hi Torsten, > > On Mon, 2016-01-25 at 16:26 +0100, Torsten Duwe wrote: > > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > > allows to call _mcount very early in the function, which low-level > > ASM code

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Torsten Duwe
On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > Hi Torsten, > > > +++ b/arch/powerpc/kernel/entry_64.S > > @@ -1206,7 +1206,12 @@ _GLOBAL(enter_prom) > > #ifdef CONFIG_DYNAMIC_FTRACE > > _GLOBAL(mcount) > > _GLOBAL(_mcount) > > - blr > > + std r0,LRSAVE(r1) /* gcc6

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Michael Ellerman
Hi Torsten, On Mon, 2016-01-25 at 16:26 +0100, Torsten Duwe wrote: > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > allows to call _mcount very early in the function, which low-level > ASM code and code patching functions need to consider. > Especially the link register

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Michael Ellerman
On Wed, 2016-01-27 at 11:44 +0100, Torsten Duwe wrote: > On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > > Hi Torsten, > > > > > +++ b/arch/powerpc/kernel/entry_64.S > > > @@ -1206,7 +1206,12 @@ _GLOBAL(enter_prom) > > > #ifdef CONFIG_DYNAMIC_FTRACE > > > _GLOBAL(mcount) > >

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Michael Ellerman
On Wed, 2016-01-27 at 23:28 +1030, Alan Modra wrote: > On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > > Hi Torsten, > > > > On Mon, 2016-01-25 at 16:26 +0100, Torsten Duwe wrote: > > > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > > > allows to call

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Michael Ellerman
Hi Torsten, On Mon, 2016-01-25 at 16:26 +0100, Torsten Duwe wrote: > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > allows to call _mcount very early in the function, which low-level > ASM code and code patching functions need to consider. > Especially the link register

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Torsten Duwe
On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > Hi Torsten, > > > +++ b/arch/powerpc/kernel/entry_64.S > > @@ -1206,7 +1206,12 @@ _GLOBAL(enter_prom) > > #ifdef CONFIG_DYNAMIC_FTRACE > > _GLOBAL(mcount) > > _GLOBAL(_mcount) > > - blr > > + std r0,LRSAVE(r1) /* gcc6

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Torsten Duwe
On Wed, Jan 27, 2016 at 11:28:09PM +1030, Alan Modra wrote: > On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > > > > Can we use r11 instead? eg: > > > > _GLOBAL(_mcount) > > mflrr11 > > mtctr r11 > > mtlrr0 > > bctr > > Depends on what you need to

Re: [PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-27 Thread Alan Modra
On Wed, Jan 27, 2016 at 09:19:27PM +1100, Michael Ellerman wrote: > Hi Torsten, > > On Mon, 2016-01-25 at 16:26 +0100, Torsten Duwe wrote: > > The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, > > allows to call _mcount very early in the function, which low-level > > ASM code

[PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-25 Thread Torsten Duwe
The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, allows to call _mcount very early in the function, which low-level ASM code and code patching functions need to consider. Especially the link register and the parameter registers are still alive and not yet saved into a new stack

[PATCH v6 1/9] ppc64 (le): prepare for -mprofile-kernel

2016-01-25 Thread Torsten Duwe
The gcc switch -mprofile-kernel, available for ppc64 on gcc > 4.8.5, allows to call _mcount very early in the function, which low-level ASM code and code patching functions need to consider. Especially the link register and the parameter registers are still alive and not yet saved into a new stack