diff mbox series

[1/2] s390: only build for new CPUs with clang

Message ID 20190410201300.3528984-1-arnd@arndb.de
State New
Headers show
Series [1/2] s390: only build for new CPUs with clang | expand

Commit Message

Arnd Bergmann April 10, 2019, 8:12 p.m. UTC
llvm does does not understand -march=z9-109 and older target
specifiers, so disable the respective Kconfig settings and
the logic to make the boot code work on old systems when
building with clang.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 arch/s390/Kconfig       | 6 ++++++
 arch/s390/boot/Makefile | 2 ++
 2 files changed, 8 insertions(+)

-- 
2.20.0

Comments

Nick Desaulniers April 10, 2019, 10:20 p.m. UTC | #1
On Wed, Apr 10, 2019 at 1:13 PM Arnd Bergmann <arnd@arndb.de> wrote:
>

> llvm does does not understand -march=z9-109 and older target


Please file bugs for these in LLVM's issue tracker.  It might be
possible to enable these additional architecture variants if they're
similar to existing ones and simply unrecognized.  IIRC, we had this
issue with armv7 variants.

> specifiers, so disable the respective Kconfig settings and

> the logic to make the boot code work on old systems when

> building with clang.

>

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

>  arch/s390/Kconfig       | 6 ++++++

>  arch/s390/boot/Makefile | 2 ++

>  2 files changed, 8 insertions(+)

>

> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig

> index 8cd860cba4d1..1a2eec61196d 100644

> --- a/arch/s390/Kconfig

> +++ b/arch/s390/Kconfig

> @@ -240,6 +240,7 @@ choice

>

>  config MARCH_Z900

>         bool "IBM zSeries model z800 and z900"

> +       depends on !CC_IS_CLANG

>         select HAVE_MARCH_Z900_FEATURES

>         help

>           Select this to enable optimizations for model z800/z900 (2064 and

> @@ -248,6 +249,7 @@ config MARCH_Z900

>

>  config MARCH_Z990

>         bool "IBM zSeries model z890 and z990"

> +       depends on !CC_IS_CLANG

>         select HAVE_MARCH_Z990_FEATURES

>         help

>           Select this to enable optimizations for model z890/z990 (2084 and

> @@ -256,6 +258,7 @@ config MARCH_Z990

>

>  config MARCH_Z9_109

>         bool "IBM System z9"

> +       depends on !CC_IS_CLANG

>         select HAVE_MARCH_Z9_109_FEATURES

>         help

>           Select this to enable optimizations for IBM System z9 (2094 and

> @@ -347,12 +350,15 @@ config TUNE_DEFAULT

>

>  config TUNE_Z900

>         bool "IBM zSeries model z800 and z900"

> +       depends on !CC_IS_CLANG

>

>  config TUNE_Z990

>         bool "IBM zSeries model z890 and z990"

> +       depends on !CC_IS_CLANG

>

>  config TUNE_Z9_109

>         bool "IBM System z9"

> +       depends on !CC_IS_CLANG

>

>  config TUNE_Z10

>         bool "IBM System z10"

> diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile

> index c844eaf24ed7..953a74d04990 100644

> --- a/arch/s390/boot/Makefile

> +++ b/arch/s390/boot/Makefile

> @@ -11,6 +11,7 @@ KASAN_SANITIZE := n

>  KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)

>  KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)

>

> +ifndef CONFIG_CC_IS_CLANG

>  #

>  # Use -march=z900 for als.c to be able to print an error

>  # message if the kernel is started on a machine which is too old

> @@ -25,6 +26,7 @@ CFLAGS_als.o                  += -march=z900

>  CFLAGS_REMOVE_sclp_early_core.o        += $(CC_FLAGS_MARCH)

>  CFLAGS_sclp_early_core.o       += -march=z900

>  endif

> +endif

>

>  CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char

>

> --

> 2.20.0

>



-- 
Thanks,
~Nick Desaulniers
Heiko Carstens April 11, 2019, 6:23 a.m. UTC | #2
On Wed, Apr 10, 2019 at 10:12:40PM +0200, Arnd Bergmann wrote:
> llvm does does not understand -march=z9-109 and older target

> specifiers, so disable the respective Kconfig settings and

> the logic to make the boot code work on old systems when

> building with clang.

> 

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

>  arch/s390/Kconfig       | 6 ++++++

>  arch/s390/boot/Makefile | 2 ++

>  2 files changed, 8 insertions(+)

...
> diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile

> index c844eaf24ed7..953a74d04990 100644

> --- a/arch/s390/boot/Makefile

> +++ b/arch/s390/boot/Makefile

> @@ -11,6 +11,7 @@ KASAN_SANITIZE := n

>  KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)

>  KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)

> 

> +ifndef CONFIG_CC_IS_CLANG

>  #

>  # Use -march=z900 for als.c to be able to print an error

>  # message if the kernel is started on a machine which is too old

> @@ -25,6 +26,7 @@ CFLAGS_als.o			+= -march=z900

>  CFLAGS_REMOVE_sclp_early_core.o	+= $(CC_FLAGS_MARCH)

>  CFLAGS_sclp_early_core.o	+= -march=z900

>  endif

> +endif


This contradicts the whole purpose of als.c - printing an error
message to the console if the kernel is compiled for a newer
architecture than it is running on (and therefore uses instructions
unknown to the current system).
If this can't be fixed/changed in clang, then it should be at least
changed to the lowest possible architecture.
Arnd Bergmann April 11, 2019, 10:18 a.m. UTC | #3
On Thu, Apr 11, 2019 at 12:20 AM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
>

> On Wed, Apr 10, 2019 at 1:13 PM Arnd Bergmann <arnd@arndb.de> wrote:

> >

> > llvm does does not understand -march=z9-109 and older target

>

> Please file bugs for these in LLVM's issue tracker.  It might be

> possible to enable these additional architecture variants if they're

> similar to existing ones and simply unrecognized.  IIRC, we had this

> issue with armv7 variants.


I really don't see that as necessary here. While generally speaking,
it would be nice to support the widest possible range of hardware,
and it would not be hard to add this support, it seems highly unlikely
that anyone would actually want to use that in case of s390.

The last enterprise distros to support z9 were SLES11 (end of life as
of last month) and RHEL6 (ending its 10 year life next year). Anyone
who is still on those releases will probably not install a brand new
compiler, and anyone who is on newer releases won't run on prehistoric
hardware.

Debian still runs on very old hardware in theory, but even there you'd
have a hard time finding someone to test the output of the compiler
on an old machine.

       Arnd
Arnd Bergmann April 11, 2019, 10:19 a.m. UTC | #4
On Thu, Apr 11, 2019 at 8:24 AM Heiko Carstens
<heiko.carstens@de.ibm.com> wrote:
>

> On Wed, Apr 10, 2019 at 10:12:40PM +0200, Arnd Bergmann wrote:

> > llvm does does not understand -march=z9-109 and older target

> > specifiers, so disable the respective Kconfig settings and

> > the logic to make the boot code work on old systems when

> > building with clang.

> >

> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> > ---

> >  arch/s390/Kconfig       | 6 ++++++

> >  arch/s390/boot/Makefile | 2 ++

> >  2 files changed, 8 insertions(+)

> ...

> > diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile

> > index c844eaf24ed7..953a74d04990 100644

> > --- a/arch/s390/boot/Makefile

> > +++ b/arch/s390/boot/Makefile

> > @@ -11,6 +11,7 @@ KASAN_SANITIZE := n

> >  KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)

> >  KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)

> >

> > +ifndef CONFIG_CC_IS_CLANG

> >  #

> >  # Use -march=z900 for als.c to be able to print an error

> >  # message if the kernel is started on a machine which is too old

> > @@ -25,6 +26,7 @@ CFLAGS_als.o                        += -march=z900

> >  CFLAGS_REMOVE_sclp_early_core.o      += $(CC_FLAGS_MARCH)

> >  CFLAGS_sclp_early_core.o     += -march=z900

> >  endif

> > +endif

>

> This contradicts the whole purpose of als.c - printing an error

> message to the console if the kernel is compiled for a newer

> architecture than it is running on (and therefore uses instructions

> unknown to the current system).

> If this can't be fixed/changed in clang, then it should be at least

> changed to the lowest possible architecture.


Ok, I'll do that. I originally did something like it, but then went back
to the simpler workaround to just make it compile.

      Arnd
Nick Desaulniers April 11, 2019, 5:46 p.m. UTC | #5
On Thu, Apr 11, 2019 at 3:18 AM Arnd Bergmann <arnd@arndb.de> wrote:
>

> On Thu, Apr 11, 2019 at 12:20 AM 'Nick Desaulniers' via Clang Built

> Linux <clang-built-linux@googlegroups.com> wrote:

> >

> > On Wed, Apr 10, 2019 at 1:13 PM Arnd Bergmann <arnd@arndb.de> wrote:

> > >

> > > llvm does does not understand -march=z9-109 and older target

> >

> > Please file bugs for these in LLVM's issue tracker.  It might be

> > possible to enable these additional architecture variants if they're

> > similar to existing ones and simply unrecognized.  IIRC, we had this

> > issue with armv7 variants.

>

> I really don't see that as necessary here. While generally speaking,

> it would be nice to support the widest possible range of hardware,

> and it would not be hard to add this support, it seems highly unlikely

> that anyone would actually want to use that in case of s390.

>

> The last enterprise distros to support z9 were SLES11 (end of life as

> of last month) and RHEL6 (ending its 10 year life next year). Anyone

> who is still on those releases will probably not install a brand new

> compiler, and anyone who is on newer releases won't run on prehistoric

> hardware.


Are those machine variants worth dropping kernel support for then?

>

> Debian still runs on very old hardware in theory, but even there you'd

> have a hard time finding someone to test the output of the compiler

> on an old machine.

>

>        Arnd




-- 
Thanks,
~Nick Desaulniers
diff mbox series

Patch

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 8cd860cba4d1..1a2eec61196d 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -240,6 +240,7 @@  choice
 
 config MARCH_Z900
 	bool "IBM zSeries model z800 and z900"
+	depends on !CC_IS_CLANG
 	select HAVE_MARCH_Z900_FEATURES
 	help
 	  Select this to enable optimizations for model z800/z900 (2064 and
@@ -248,6 +249,7 @@  config MARCH_Z900
 
 config MARCH_Z990
 	bool "IBM zSeries model z890 and z990"
+	depends on !CC_IS_CLANG
 	select HAVE_MARCH_Z990_FEATURES
 	help
 	  Select this to enable optimizations for model z890/z990 (2084 and
@@ -256,6 +258,7 @@  config MARCH_Z990
 
 config MARCH_Z9_109
 	bool "IBM System z9"
+	depends on !CC_IS_CLANG
 	select HAVE_MARCH_Z9_109_FEATURES
 	help
 	  Select this to enable optimizations for IBM System z9 (2094 and
@@ -347,12 +350,15 @@  config TUNE_DEFAULT
 
 config TUNE_Z900
 	bool "IBM zSeries model z800 and z900"
+	depends on !CC_IS_CLANG
 
 config TUNE_Z990
 	bool "IBM zSeries model z890 and z990"
+	depends on !CC_IS_CLANG
 
 config TUNE_Z9_109
 	bool "IBM System z9"
+	depends on !CC_IS_CLANG
 
 config TUNE_Z10
 	bool "IBM System z10"
diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
index c844eaf24ed7..953a74d04990 100644
--- a/arch/s390/boot/Makefile
+++ b/arch/s390/boot/Makefile
@@ -11,6 +11,7 @@  KASAN_SANITIZE := n
 KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
 KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
 
+ifndef CONFIG_CC_IS_CLANG
 #
 # Use -march=z900 for als.c to be able to print an error
 # message if the kernel is started on a machine which is too old
@@ -25,6 +26,7 @@  CFLAGS_als.o			+= -march=z900
 CFLAGS_REMOVE_sclp_early_core.o	+= $(CC_FLAGS_MARCH)
 CFLAGS_sclp_early_core.o	+= -march=z900
 endif
+endif
 
 CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char