[v3] riscv : select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY

Message ID 20221201151336.8044-1-suagrfillet@gmail.com
State New
Headers
Series [v3] riscv : select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY |

Commit Message

Song Shuai Dec. 1, 2022, 3:13 p.m. UTC
  In RISC-V, -fpatchable-function-entry option is used to support
dynamic ftrace in this commit afc76b8b8011 ("riscv: Using
PATCHABLE_FUNCTION_ENTRY instead of MCOUNT"). So recordmcount
don't have to be called to create the __mcount_loc section before
the vmlinux linking.

Here selects FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY to tell
Makefile not to run recordmcount.

Link_v1: https://lore.kernel.org/linux-riscv/CAAYs2=j3Eak9vU6xbAw0zPuoh00rh8v5C2U3fePkokZFibWs2g@mail.gmail.com/T/#t
Link_v2: https://lore.kernel.org/linux-riscv/CAAYs2=iYn8sLQB8oh+RzTKd2VKs8MXOLX6Mwpamx5gdVVN6mkA@mail.gmail.com/T/#m62138d7a76664798d00051818a438a601eff4cf1
Signed-off-by: Song Shuai <suagrfillet@gmail.com>
Tested-by: Guo Ren <guoren@kernel.org>
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Conor Dooley Dec. 1, 2022, 3:28 p.m. UTC | #1
On Thu, Dec 01, 2022 at 11:13:36PM +0800, Song Shuai wrote:
> In RISC-V, -fpatchable-function-entry option is used to support
> dynamic ftrace in this commit afc76b8b8011 ("riscv: Using
> PATCHABLE_FUNCTION_ENTRY instead of MCOUNT"). So recordmcount
> don't have to be called to create the __mcount_loc section before
> the vmlinux linking.
> 
> Here selects FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY to tell
> Makefile not to run recordmcount.
> 
> Link_v1: https://lore.kernel.org/linux-riscv/CAAYs2=j3Eak9vU6xbAw0zPuoh00rh8v5C2U3fePkokZFibWs2g@mail.gmail.com/T/#t
> Link_v2: https://lore.kernel.org/linux-riscv/CAAYs2=iYn8sLQB8oh+RzTKd2VKs8MXOLX6Mwpamx5gdVVN6mkA@mail.gmail.com/T/#m62138d7a76664798d00051818a438a601eff4cf1

Hey Song Shuai,

For future patches, please use normal "Link:" tags. If you're just
linking to prior versions of the patch, just put them below the ---
line so they don't end up in the git history.

Please don't resend for this alone :)

Thanks,
Conor.

> Signed-off-by: Song Shuai <suagrfillet@gmail.com>
> Tested-by: Guo Ren <guoren@kernel.org>
> ---
>  arch/riscv/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 572973103d73..c19cddb8feb9 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -277,6 +277,7 @@ config ARCH_RV64I
>  	select 64BIT
>  	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
>  	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
> +	select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
>  	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
>  	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
>  	select HAVE_SAMPLE_FTRACE_DIRECT
> -- 
> 2.20.1
>
  
Conor Dooley Dec. 1, 2022, 6:07 p.m. UTC | #2
On Thu, Dec 01, 2022 at 03:28:10PM +0000, Conor Dooley wrote:
> On Thu, Dec 01, 2022 at 11:13:36PM +0800, Song Shuai wrote:
> > In RISC-V, -fpatchable-function-entry option is used to support
> > dynamic ftrace in this commit afc76b8b8011 ("riscv: Using
> > PATCHABLE_FUNCTION_ENTRY instead of MCOUNT"). So recordmcount
> > don't have to be called to create the __mcount_loc section before
> > the vmlinux linking.
> > 
> > Here selects FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY to tell
> > Makefile not to run recordmcount.
> > 
> > Link_v1: https://lore.kernel.org/linux-riscv/CAAYs2=j3Eak9vU6xbAw0zPuoh00rh8v5C2U3fePkokZFibWs2g@mail.gmail.com/T/#t
> > Link_v2: https://lore.kernel.org/linux-riscv/CAAYs2=iYn8sLQB8oh+RzTKd2VKs8MXOLX6Mwpamx5gdVVN6mkA@mail.gmail.com/T/#m62138d7a76664798d00051818a438a601eff4cf1
> 
> Hey Song Shuai,
> 
> For future patches, please use normal "Link:" tags. If you're just
> linking to prior versions of the patch, just put them below the ---
> line so they don't end up in the git history.

> > Signed-off-by: Song Shuai <suagrfillet@gmail.com>
> > Tested-by: Guo Ren <guoren@kernel.org>
> > ---
> >  arch/riscv/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 572973103d73..c19cddb8feb9 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -277,6 +277,7 @@ config ARCH_RV64I
> >  	select 64BIT
> >  	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
> >  	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
> > +	select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE

Also, why are these not added in alphabetical order, like the current
list is? I don't see HAVE_DYNAMIC_FTRACE in linux-next from the other
day so that probably needs fixing in the series you are based on too.

> >  	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
> >  	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
> >  	select HAVE_SAMPLE_FTRACE_DIRECT
> > -- 
> > 2.20.1
> >
  
Song Shuai Dec. 5, 2022, 12:33 p.m. UTC | #3
Conor Dooley <conor@kernel.org> 于2022年12月1日周四 18:08写道:
>
> On Thu, Dec 01, 2022 at 03:28:10PM +0000, Conor Dooley wrote:
> > On Thu, Dec 01, 2022 at 11:13:36PM +0800, Song Shuai wrote:
> > > In RISC-V, -fpatchable-function-entry option is used to support
> > > dynamic ftrace in this commit afc76b8b8011 ("riscv: Using
> > > PATCHABLE_FUNCTION_ENTRY instead of MCOUNT"). So recordmcount
> > > don't have to be called to create the __mcount_loc section before
> > > the vmlinux linking.
> > >
> > > Here selects FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY to tell
> > > Makefile not to run recordmcount.
> > >
> > > Link_v1: https://lore.kernel.org/linux-riscv/CAAYs2=j3Eak9vU6xbAw0zPuoh00rh8v5C2U3fePkokZFibWs2g@mail.gmail.com/T/#t
> > > Link_v2: https://lore.kernel.org/linux-riscv/CAAYs2=iYn8sLQB8oh+RzTKd2VKs8MXOLX6Mwpamx5gdVVN6mkA@mail.gmail.com/T/#m62138d7a76664798d00051818a438a601eff4cf1
> >
> > Hey Song Shuai,
> >
> > For future patches, please use normal "Link:" tags. If you're just
> > linking to prior versions of the patch, just put them below the ---
> > line so they don't end up in the git history.
>
> > > Signed-off-by: Song Shuai <suagrfillet@gmail.com>
> > > Tested-by: Guo Ren <guoren@kernel.org>
> > > ---
> > >  arch/riscv/Kconfig | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > > index 572973103d73..c19cddb8feb9 100644
> > > --- a/arch/riscv/Kconfig
> > > +++ b/arch/riscv/Kconfig
> > > @@ -277,6 +277,7 @@ config ARCH_RV64I
> > >     select 64BIT
> > >     select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
> > >     select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
> > > +   select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
>
> Also, why are these not added in alphabetical order, like the current
> list is? I don't see HAVE_DYNAMIC_FTRACE in linux-next from the other
> day so that probably needs fixing in the series you are based on too.
>
Sorry for bothering you with this disorderly CONFIG  and the 'Link' tags
I'll tidy them up with Guo Ren in the next version.

> > >     select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
> > >     select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
> > >     select HAVE_SAMPLE_FTRACE_DIRECT
> > > --
> > > 2.20.1
> > >



--
Thanks,
Song
  

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 572973103d73..c19cddb8feb9 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -277,6 +277,7 @@  config ARCH_RV64I
 	select 64BIT
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
 	select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
+	select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
 	select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
 	select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
 	select HAVE_SAMPLE_FTRACE_DIRECT