linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] jump_label: Allow jump labels to be used in assembly
@ 2015-01-06 10:20 Anton Blanchard
  2015-01-06 10:20 ` [PATCH 2/2] powerpc: Include linux/jump_label.h to get HAVE_JUMP_LABEL define Anton Blanchard
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Anton Blanchard @ 2015-01-06 10:20 UTC (permalink / raw)
  To: benh, paulus, mpe, mmarek, akpm, jbaron, peterz, liuj97, mingo, mgorman
  Cc: linuxppc-dev, linux-kbuild, linux-kernel

To use jump labels in assembly we need the HAVE_JUMP_LABEL define,
so we select a fallback version if the toolchain does not support
them.

Modify linux/jump_label.h so it can be included by assembly files.
We also need to add -DCC_HAVE_ASM_GOTO to KBUILD_AFLAGS.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 Makefile                   |  1 +
 include/linux/jump_label.h | 21 +++++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index ef748e1..7b83c3f 100644
--- a/Makefile
+++ b/Makefile
@@ -774,6 +774,7 @@ KBUILD_ARFLAGS := $(call ar-option,D)
 # check for 'asm goto'
 ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
 	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+	KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
 endif
 
 include $(srctree)/scripts/Makefile.extrawarn
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 98f923b6..f4de473 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -45,6 +45,12 @@
  * same as using STATIC_KEY_INIT_FALSE.
  */
 
+#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
+# define HAVE_JUMP_LABEL
+#endif
+
+#ifndef __ASSEMBLY__
+
 #include <linux/types.h>
 #include <linux/compiler.h>
 #include <linux/bug.h>
@@ -55,7 +61,7 @@ extern bool static_key_initialized;
 				    "%s used before call to jump_label_init", \
 				    __func__)
 
-#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
+#ifdef HAVE_JUMP_LABEL
 
 struct static_key {
 	atomic_t enabled;
@@ -66,13 +72,18 @@ struct static_key {
 #endif
 };
 
-# include <asm/jump_label.h>
-# define HAVE_JUMP_LABEL
 #else
 struct static_key {
 	atomic_t enabled;
 };
-#endif	/* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
+#endif	/* HAVE_JUMP_LABEL */
+#endif /* __ASSEMBLY__ */
+
+#ifdef HAVE_JUMP_LABEL
+#include <asm/jump_label.h>
+#endif
+
+#ifndef __ASSEMBLY__
 
 enum jump_label_type {
 	JUMP_LABEL_DISABLE = 0,
@@ -203,3 +214,5 @@ static inline bool static_key_enabled(struct static_key *key)
 }
 
 #endif	/* _LINUX_JUMP_LABEL_H */
+
+#endif /* __ASSEMBLY__ */
-- 
2.1.0


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

* [PATCH 2/2] powerpc: Include linux/jump_label.h to get HAVE_JUMP_LABEL define
  2015-01-06 10:20 [PATCH 1/2] jump_label: Allow jump labels to be used in assembly Anton Blanchard
@ 2015-01-06 10:20 ` Anton Blanchard
  2015-01-06 15:46 ` [PATCH 1/2] jump_label: Allow jump labels to be used in assembly Jason Baron
  2015-01-06 17:48 ` Steven Rostedt
  2 siblings, 0 replies; 5+ messages in thread
From: Anton Blanchard @ 2015-01-06 10:20 UTC (permalink / raw)
  To: benh, paulus, mpe, mmarek, akpm, jbaron, peterz, liuj97, mingo, mgorman
  Cc: linuxppc-dev, linux-kbuild, linux-kernel

Commit 1bc9e47aa8e4 ("powerpc/jump_label: Use HAVE_JUMP_LABEL")
converted uses of CONFIG_JUMP_LABEL to HAVE_JUMP_LABEL in
some assembly files.

HAVE_JUMP_LABEL is defined in linux/jump_label.h, so we need to
include this or we always get the non jump label fallback code.

Fixes: 1bc9e47aa8e4 ("powerpc/jump_label: Use HAVE_JUMP_LABEL")
Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/platforms/pseries/hvCall.S | 2 +-
 arch/powerpc/platforms/pseries/lpar.c   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index ccd53f9..74b5b8e 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -7,12 +7,12 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/jump_label.h>
 #include <asm/hvcall.h>
 #include <asm/processor.h>
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 #include <asm/ptrace.h>
-#include <asm/jump_label.h>
 
 	.section	".text"
 	
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 469751d..14ac1ad 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -27,6 +27,7 @@
 #include <linux/console.h>
 #include <linux/export.h>
 #include <linux/static_key.h>
+#include <linux/jump_label.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/page.h>
-- 
2.1.0


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

* Re: [PATCH 1/2] jump_label: Allow jump labels to be used in assembly
  2015-01-06 10:20 [PATCH 1/2] jump_label: Allow jump labels to be used in assembly Anton Blanchard
  2015-01-06 10:20 ` [PATCH 2/2] powerpc: Include linux/jump_label.h to get HAVE_JUMP_LABEL define Anton Blanchard
@ 2015-01-06 15:46 ` Jason Baron
  2015-01-06 17:48 ` Steven Rostedt
  2 siblings, 0 replies; 5+ messages in thread
From: Jason Baron @ 2015-01-06 15:46 UTC (permalink / raw)
  To: Anton Blanchard, benh, paulus, mpe, mmarek, akpm, peterz, liuj97,
	mingo, mgorman, rostedt
  Cc: linuxppc-dev, linux-kbuild, linux-kernel

On 01/06/2015 05:20 AM, Anton Blanchard wrote:
> To use jump labels in assembly we need the HAVE_JUMP_LABEL define,
> so we select a fallback version if the toolchain does not support
> them.
>
> Modify linux/jump_label.h so it can be included by assembly files.
> We also need to add -DCC_HAVE_ASM_GOTO to KBUILD_AFLAGS.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>

(adding Steven)

Acked-by: Jason Baron <jbaron@akamai.com>

The jump label stuff often gets picked up by Steve, but I guess this
could go through the powerpc tree as well...

Thanks,

-Jason

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

* Re: [PATCH 1/2] jump_label: Allow jump labels to be used in assembly
  2015-01-06 10:20 [PATCH 1/2] jump_label: Allow jump labels to be used in assembly Anton Blanchard
  2015-01-06 10:20 ` [PATCH 2/2] powerpc: Include linux/jump_label.h to get HAVE_JUMP_LABEL define Anton Blanchard
  2015-01-06 15:46 ` [PATCH 1/2] jump_label: Allow jump labels to be used in assembly Jason Baron
@ 2015-01-06 17:48 ` Steven Rostedt
  2015-01-07 10:34   ` Anton Blanchard
  2 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2015-01-06 17:48 UTC (permalink / raw)
  To: Anton Blanchard
  Cc: benh, paulus, mpe, mmarek, akpm, jbaron, peterz, liuj97, mingo,
	mgorman, linuxppc-dev, linux-kbuild, linux-kernel

On Tue, Jan 06, 2015 at 09:20:27PM +1100, Anton Blanchard wrote:
> To use jump labels in assembly we need the HAVE_JUMP_LABEL define,
> so we select a fallback version if the toolchain does not support
> them.
> 
> Modify linux/jump_label.h so it can be included by assembly files.
> We also need to add -DCC_HAVE_ASM_GOTO to KBUILD_AFLAGS.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>  Makefile                   |  1 +
>  include/linux/jump_label.h | 21 +++++++++++++++++----
>  2 files changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index ef748e1..7b83c3f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -774,6 +774,7 @@ KBUILD_ARFLAGS := $(call ar-option,D)
>  # check for 'asm goto'
>  ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
>  	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
> +	KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
>  endif
>  
>  include $(srctree)/scripts/Makefile.extrawarn
> diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> index 98f923b6..f4de473 100644
> --- a/include/linux/jump_label.h
> +++ b/include/linux/jump_label.h
> @@ -45,6 +45,12 @@
>   * same as using STATIC_KEY_INIT_FALSE.
>   */
>  
> +#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
> +# define HAVE_JUMP_LABEL
> +#endif
> +
> +#ifndef __ASSEMBLY__
> +
>  #include <linux/types.h>
>  #include <linux/compiler.h>
>  #include <linux/bug.h>
> @@ -55,7 +61,7 @@ extern bool static_key_initialized;
>  				    "%s used before call to jump_label_init", \
>  				    __func__)
>  
> -#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
> +#ifdef HAVE_JUMP_LABEL
>  
>  struct static_key {
>  	atomic_t enabled;
> @@ -66,13 +72,18 @@ struct static_key {
>  #endif
>  };
>  
> -# include <asm/jump_label.h>
> -# define HAVE_JUMP_LABEL
>  #else
>  struct static_key {
>  	atomic_t enabled;
>  };
> -#endif	/* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
> +#endif	/* HAVE_JUMP_LABEL */
> +#endif /* __ASSEMBLY__ */
> +
> +#ifdef HAVE_JUMP_LABEL
> +#include <asm/jump_label.h>
> +#endif

Have you tested this on other archs? Because just looking at x86, it doesn't
seem that asm/jump_label.h can handle being called in assembly.

-- Steve

> +
> +#ifndef __ASSEMBLY__
>  
>  enum jump_label_type {
>  	JUMP_LABEL_DISABLE = 0,
> @@ -203,3 +214,5 @@ static inline bool static_key_enabled(struct static_key *key)
>  }
>  
>  #endif	/* _LINUX_JUMP_LABEL_H */
> +
> +#endif /* __ASSEMBLY__ */
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH 1/2] jump_label: Allow jump labels to be used in assembly
  2015-01-06 17:48 ` Steven Rostedt
@ 2015-01-07 10:34   ` Anton Blanchard
  0 siblings, 0 replies; 5+ messages in thread
From: Anton Blanchard @ 2015-01-07 10:34 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: benh, paulus, mpe, mmarek, akpm, jbaron, peterz, liuj97, mingo,
	mgorman, linuxppc-dev, linux-kbuild, linux-kernel

Hi Steve,

> Have you tested this on other archs? Because just looking at x86, it
> doesn't seem that asm/jump_label.h can handle being called in
> assembly.

Since no one is including linux/jump_label.h in assembly yet, nothing
should break. We could however add __ASSEMBLY__ protection to all the
asm/jump_label.h files. Patches on the way.

Anton

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

end of thread, other threads:[~2015-01-07 10:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 10:20 [PATCH 1/2] jump_label: Allow jump labels to be used in assembly Anton Blanchard
2015-01-06 10:20 ` [PATCH 2/2] powerpc: Include linux/jump_label.h to get HAVE_JUMP_LABEL define Anton Blanchard
2015-01-06 15:46 ` [PATCH 1/2] jump_label: Allow jump labels to be used in assembly Jason Baron
2015-01-06 17:48 ` Steven Rostedt
2015-01-07 10:34   ` Anton Blanchard

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).