linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm
@ 2016-10-21 16:17 Steven Rostedt
  2016-10-21 23:44 ` Nicholas Piggin
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2016-10-21 16:17 UTC (permalink / raw)
  To: LKML, Al Viro
  Cc: Borislav Petkov, Thomas Gleixner, Ingo Molnar, Gabriel C, npiggin


Commit 784d5699eddc5 ("x86: move exports to actual definitions") removed the
EXPORT_SYMBOL(__fentry__) and EXPORT_SYMBOL(mcount) from x8664_ksyms_64.c,
and added EXPORT_SYMBOL(function_hook) in mcount_64.S instead. The problem
is that function_hook isn't a function at all, but a macro that is defined
as eithe mcount or __fentry__ depending on the support from gcc. But instead
of adding more #ifdefs like x8684_ksyms_64.c had, I suggest having another
export that can handle this similar to the way __string() works with
converting macros to strings. By having:

 EXPORT_MACRO_SYMBOL(function_hook)

Where we have:

 #define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x)

It will convert the macro into what it is defined as before calling
EXPORT_SYMBOL(), and this will just work properly again.

Cc: stable@vger.kernel.org
Fixes: Commit 784d5699eddc5 ("x86: move exports to actual definitions")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/mcount_64.S  | 2 +-
 include/asm-generic/export.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
index efe73aacf966..ccd9d912af27 100644
--- a/arch/x86/kernel/mcount_64.S
+++ b/arch/x86/kernel/mcount_64.S
@@ -295,7 +295,7 @@ trace:
 	jmp fgraph_trace
 END(function_hook)
 #endif /* CONFIG_DYNAMIC_FTRACE */
-EXPORT_SYMBOL(function_hook)
+EXPORT_MACRO_SYMBOL(function_hook)
 #endif /* CONFIG_FUNCTION_TRACER */
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
index 43199a049da5..cb86e746865e 100644
--- a/include/asm-generic/export.h
+++ b/include/asm-generic/export.h
@@ -90,5 +90,10 @@
 	__EXPORT_SYMBOL(name, KSYM(name),)
 #define EXPORT_DATA_SYMBOL_GPL(name)				\
 	__EXPORT_SYMBOL(name, KSYM(name),_gpl)
+/*
+ * If "name" is a macro of a function and not a function itself,
+ * it needs a second pass.
+ */
+#define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x)
 
 #endif
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm
  2016-10-21 16:17 [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm Steven Rostedt
@ 2016-10-21 23:44 ` Nicholas Piggin
  2016-10-22 19:08   ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Piggin @ 2016-10-21 23:44 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Al Viro, Borislav Petkov, Thomas Gleixner, Ingo Molnar, Gabriel C

On Fri, 21 Oct 2016 12:17:59 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Commit 784d5699eddc5 ("x86: move exports to actual definitions") removed the
> EXPORT_SYMBOL(__fentry__) and EXPORT_SYMBOL(mcount) from x8664_ksyms_64.c,
> and added EXPORT_SYMBOL(function_hook) in mcount_64.S instead. The problem
> is that function_hook isn't a function at all, but a macro that is defined
> as eithe mcount or __fentry__ depending on the support from gcc. But instead
> of adding more #ifdefs like x8684_ksyms_64.c had, I suggest having another
> export that can handle this similar to the way __string() works with
> converting macros to strings. By having:
> 
>  EXPORT_MACRO_SYMBOL(function_hook)
> 
> Where we have:
> 
>  #define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x)
> 
> It will convert the macro into what it is defined as before calling
> EXPORT_SYMBOL(), and this will just work properly again.
> 
> Cc: stable@vger.kernel.org
> Fixes: Commit 784d5699eddc5 ("x86: move exports to actual definitions")
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  arch/x86/kernel/mcount_64.S  | 2 +-
>  include/asm-generic/export.h | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
> index efe73aacf966..ccd9d912af27 100644
> --- a/arch/x86/kernel/mcount_64.S
> +++ b/arch/x86/kernel/mcount_64.S
> @@ -295,7 +295,7 @@ trace:
>  	jmp fgraph_trace
>  END(function_hook)
>  #endif /* CONFIG_DYNAMIC_FTRACE */
> -EXPORT_SYMBOL(function_hook)
> +EXPORT_MACRO_SYMBOL(function_hook)
>  #endif /* CONFIG_FUNCTION_TRACER */
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
> index 43199a049da5..cb86e746865e 100644
> --- a/include/asm-generic/export.h
> +++ b/include/asm-generic/export.h
> @@ -90,5 +90,10 @@
>  	__EXPORT_SYMBOL(name, KSYM(name),)
>  #define EXPORT_DATA_SYMBOL_GPL(name)				\
>  	__EXPORT_SYMBOL(name, KSYM(name),_gpl)
> +/*
> + * If "name" is a macro of a function and not a function itself,
> + * it needs a second pass.
> + */
> +#define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x)

Seems okay, but what about just calling it EXPORT_SYMBOL?

Thanks,
Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm
  2016-10-21 23:44 ` Nicholas Piggin
@ 2016-10-22 19:08   ` Steven Rostedt
  2016-10-24  1:25     ` Nicholas Piggin
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2016-10-22 19:08 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: LKML, Al Viro, Borislav Petkov, Thomas Gleixner, Ingo Molnar, Gabriel C

On Sat, 22 Oct 2016 10:44:41 +1100
Nicholas Piggin <npiggin@gmail.com> wrote:

> >  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
> > index 43199a049da5..cb86e746865e 100644
> > --- a/include/asm-generic/export.h
> > +++ b/include/asm-generic/export.h
> > @@ -90,5 +90,10 @@
> >  	__EXPORT_SYMBOL(name, KSYM(name),)
> >  #define EXPORT_DATA_SYMBOL_GPL(name)				\
> >  	__EXPORT_SYMBOL(name, KSYM(name),_gpl)
> > +/*
> > + * If "name" is a macro of a function and not a function itself,
> > + * it needs a second pass.
> > + */
> > +#define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x)  
> 
> Seems okay, but what about just calling it EXPORT_SYMBOL?


Actually, this doesn't work. There's some magic going on it
Makefile.build in the scripts directory that causes this to fail.

I have another patch I'll be sending on Monday that fixes this.

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm
  2016-10-22 19:08   ` Steven Rostedt
@ 2016-10-24  1:25     ` Nicholas Piggin
  2016-10-24 14:14       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Piggin @ 2016-10-24  1:25 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Al Viro, Borislav Petkov, Thomas Gleixner, Ingo Molnar, Gabriel C

On Sat, 22 Oct 2016 15:08:52 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Sat, 22 Oct 2016 10:44:41 +1100
> Nicholas Piggin <npiggin@gmail.com> wrote:
> 
> > >  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > > diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
> > > index 43199a049da5..cb86e746865e 100644
> > > --- a/include/asm-generic/export.h
> > > +++ b/include/asm-generic/export.h
> > > @@ -90,5 +90,10 @@
> > >  	__EXPORT_SYMBOL(name, KSYM(name),)
> > >  #define EXPORT_DATA_SYMBOL_GPL(name)				\
> > >  	__EXPORT_SYMBOL(name, KSYM(name),_gpl)
> > > +/*
> > > + * If "name" is a macro of a function and not a function itself,
> > > + * it needs a second pass.
> > > + */
> > > +#define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x)    
> > 
> > Seems okay, but what about just calling it EXPORT_SYMBOL?  
> 
> 
> Actually, this doesn't work. There's some magic going on it
> Makefile.build in the scripts directory that causes this to fail.
> 
> I have another patch I'll be sending on Monday that fixes this.

Yes it's grepping for EXPORT_SYMBOL_* I think. If you need to
create a new name, EXPORT_SYMBOL prefix would be preferred. But
yeah if you make the standard macro do macro expansion, it
should just work, no?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm
  2016-10-24  1:25     ` Nicholas Piggin
@ 2016-10-24 14:14       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2016-10-24 14:14 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: LKML, Al Viro, Borislav Petkov, Thomas Gleixner, Ingo Molnar, Gabriel C

On Mon, 24 Oct 2016 12:25:45 +1100
Nicholas Piggin <npiggin@gmail.com> wrote:


> Yes it's grepping for EXPORT_SYMBOL_* I think. If you need to
> create a new name, EXPORT_SYMBOL prefix would be preferred. But
> yeah if you make the standard macro do macro expansion, it
> should just work, no?

Unfortunately, that's not enough. There's some magic in the Makefile
that seems to use the names found in EXPORT_SYMBOL*, which fails when
that name is just a macro to another name.

I'm just going to punt and include both names depending on the config.

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-24 14:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-21 16:17 [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm Steven Rostedt
2016-10-21 23:44 ` Nicholas Piggin
2016-10-22 19:08   ` Steven Rostedt
2016-10-24  1:25     ` Nicholas Piggin
2016-10-24 14:14       ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).