All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/percpu: Enable named address spaces for all capable GCC versions
@ 2024-05-20  8:21 Uros Bizjak
  2024-05-21  8:18 ` Ingo Molnar
  2024-05-21 11:57 ` [tip: x86/percpu] " tip-bot2 for Uros Bizjak
  0 siblings, 2 replies; 4+ messages in thread
From: Uros Bizjak @ 2024-05-20  8:21 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
	Denys Vlasenko, H . Peter Anvin, Linus Torvalds, Peter Zijlstra,
	Thomas Gleixner, Josh Poimboeuf

Enable named address spaces also for GCC 6, GCC 7 and GCC 8
releases. These compilers all produce kernel images that boot
without problems.

Use compile-time test to detect compiler support for named
address spaces. The test passes with GCC 6 as the earliest
compiler version where the support for named address spaces
was introduced.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9d16fee6bdb8..c9e0a54f469e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2430,7 +2430,8 @@ source "kernel/livepatch/Kconfig"
 endmenu
 
 config CC_HAS_NAMED_AS
-	def_bool CC_IS_GCC && GCC_VERSION >= 90100
+	def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)
+	depends on CC_IS_GCC
 
 config CC_HAS_NAMED_AS_FIXED_SANITIZERS
 	def_bool CC_IS_GCC && GCC_VERSION >= 130300
-- 
2.45.1


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

* Re: [PATCH] x86/percpu: Enable named address spaces for all capable GCC versions
  2024-05-20  8:21 [PATCH] x86/percpu: Enable named address spaces for all capable GCC versions Uros Bizjak
@ 2024-05-21  8:18 ` Ingo Molnar
  2024-05-21  9:13   ` Uros Bizjak
  2024-05-21 11:57 ` [tip: x86/percpu] " tip-bot2 for Uros Bizjak
  1 sibling, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2024-05-21  8:18 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: linux-kernel, x86, Andy Lutomirski, Brian Gerst, Denys Vlasenko,
	H . Peter Anvin, Linus Torvalds, Peter Zijlstra, Thomas Gleixner,
	Josh Poimboeuf


* Uros Bizjak <ubizjak@gmail.com> wrote:

> Enable named address spaces also for GCC 6, GCC 7 and GCC 8
> releases. These compilers all produce kernel images that boot
> without problems.
> 
> Use compile-time test to detect compiler support for named
> address spaces. The test passes with GCC 6 as the earliest
> compiler version where the support for named address spaces
> was introduced.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Brian Gerst <brgerst@gmail.com>
> Cc: Denys Vlasenko <dvlasenk@redhat.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  arch/x86/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 9d16fee6bdb8..c9e0a54f469e 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2430,7 +2430,8 @@ source "kernel/livepatch/Kconfig"
>  endmenu
>  
>  config CC_HAS_NAMED_AS
> -	def_bool CC_IS_GCC && GCC_VERSION >= 90100
> +	def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)
> +	depends on CC_IS_GCC

So ... will this test also trigger on Clang, which might have a 
__seg_fs/__seg_gs work-alike definition?

Thanks,

	Ingo

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

* Re: [PATCH] x86/percpu: Enable named address spaces for all capable GCC versions
  2024-05-21  8:18 ` Ingo Molnar
@ 2024-05-21  9:13   ` Uros Bizjak
  0 siblings, 0 replies; 4+ messages in thread
From: Uros Bizjak @ 2024-05-21  9:13 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, x86, Andy Lutomirski, Brian Gerst, Denys Vlasenko,
	H . Peter Anvin, Linus Torvalds, Peter Zijlstra, Thomas Gleixner,
	Josh Poimboeuf

On Tue, May 21, 2024 at 10:18 AM Ingo Molnar <mingo@kernel.org> wrote:
>
>
> * Uros Bizjak <ubizjak@gmail.com> wrote:
>
> > Enable named address spaces also for GCC 6, GCC 7 and GCC 8
> > releases. These compilers all produce kernel images that boot
> > without problems.
> >
> > Use compile-time test to detect compiler support for named
> > address spaces. The test passes with GCC 6 as the earliest
> > compiler version where the support for named address spaces
> > was introduced.
> >
> > Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Cc: Brian Gerst <brgerst@gmail.com>
> > Cc: Denys Vlasenko <dvlasenk@redhat.com>
> > Cc: H. Peter Anvin <hpa@zytor.com>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> > ---
> >  arch/x86/Kconfig | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 9d16fee6bdb8..c9e0a54f469e 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -2430,7 +2430,8 @@ source "kernel/livepatch/Kconfig"
> >  endmenu
> >
> >  config CC_HAS_NAMED_AS
> > -     def_bool CC_IS_GCC && GCC_VERSION >= 90100
> > +     def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)
> > +     depends on CC_IS_GCC
>
> So ... will this test also trigger on Clang, which might have a
> __seg_fs/__seg_gs work-alike definition?

Yes, but please note the dependence on CC_IS_GCC. This dependence can
be removed once CLANG is tested to create correct code for named AS.

Thanks,
Uros.

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

* [tip: x86/percpu] x86/percpu: Enable named address spaces for all capable GCC versions
  2024-05-20  8:21 [PATCH] x86/percpu: Enable named address spaces for all capable GCC versions Uros Bizjak
  2024-05-21  8:18 ` Ingo Molnar
@ 2024-05-21 11:57 ` tip-bot2 for Uros Bizjak
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2024-05-21 11:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Josh Poimboeuf,
	Linus Torvalds, Ard Biesheuvel, x86, linux-kernel

The following commit has been merged into the x86/percpu branch of tip:

Commit-ID:     47ff30cc1be7bf426c03ecc84371452109b416e4
Gitweb:        https://git.kernel.org/tip/47ff30cc1be7bf426c03ecc84371452109b416e4
Author:        Uros Bizjak <ubizjak@gmail.com>
AuthorDate:    Mon, 20 May 2024 10:21:14 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 21 May 2024 10:17:01 +02:00

x86/percpu: Enable named address spaces for all capable GCC versions

Enable named address spaces also for GCC 6, GCC 7 and GCC 8
releases. These compilers all produce kernel images that boot
without problems.

Use compile-time test to detect compiler support for named
address spaces. The test passes with GCC 6 as the earliest
compiler version where the support for named address spaces
was introduced.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240520082134.121320-1-ubizjak@gmail.com
---
 arch/x86/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9d16fee..c9e0a54 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2430,7 +2430,8 @@ source "kernel/livepatch/Kconfig"
 endmenu
 
 config CC_HAS_NAMED_AS
-	def_bool CC_IS_GCC && GCC_VERSION >= 90100
+	def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x c - -S -o /dev/null)
+	depends on CC_IS_GCC
 
 config CC_HAS_NAMED_AS_FIXED_SANITIZERS
 	def_bool CC_IS_GCC && GCC_VERSION >= 130300

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

end of thread, other threads:[~2024-05-21 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-20  8:21 [PATCH] x86/percpu: Enable named address spaces for all capable GCC versions Uros Bizjak
2024-05-21  8:18 ` Ingo Molnar
2024-05-21  9:13   ` Uros Bizjak
2024-05-21 11:57 ` [tip: x86/percpu] " tip-bot2 for Uros Bizjak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.