2020-03-17 00:12:27

by Sergei Trofimovich

[permalink] [raw]
Subject: [PATCH] Makefile: disallow data races on gcc-10 as well

gcc-10 will rename --param=allow-store-data-races=0
to -fno-allow-store-data-races.

The flag change happened at https://gcc.gnu.org/PR92046.

CC: Jiri Kosina <[email protected]>
CC: Masahiro Yamada <[email protected]>
CC: Michal Marek <[email protected]>
CC: [email protected]
Signed-off-by: Sergei Trofimovich <[email protected]>
---
Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 171f2b004c8a..9696eb2cd5a1 100644
--- a/Makefile
+++ b/Makefile
@@ -714,6 +714,7 @@ endif

# Tell gcc to never replace conditional load with a non-conditional one
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
+KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)

include scripts/Makefile.kcov
include scripts/Makefile.gcc-plugins
--
2.25.1


2020-03-17 01:09:10

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] Makefile: disallow data races on gcc-10 as well

On Tue, 17 Mar 2020, Sergei Trofimovich wrote:

> gcc-10 will rename --param=allow-store-data-races=0
> to -fno-allow-store-data-races.
>
> The flag change happened at https://gcc.gnu.org/PR92046.
>
> CC: Jiri Kosina <[email protected]>
> CC: Masahiro Yamada <[email protected]>
> CC: Michal Marek <[email protected]>
> CC: [email protected]
> Signed-off-by: Sergei Trofimovich <[email protected]>
> ---
> Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index 171f2b004c8a..9696eb2cd5a1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -714,6 +714,7 @@ endif
>
> # Tell gcc to never replace conditional load with a non-conditional one
> KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
> +KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)

I have to say I can't really read gcc sources without major cerebral pain,
so let me me dense here: what happens to gcc<10 if you pass
-fno-allow-store-data-races to it?

My expectation would be that it would just blow up in fatal error, meaning
that after we apply your patch, kernel couldn't be successfully compiled
by any compiler that doesn't understand '-fno-allow-store-data-races'
(which is just about any compiler on this planet).

Thanks,

--
Jiri Kosina
SUSE Labs

2020-03-17 03:23:50

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] Makefile: disallow data races on gcc-10 as well

On Tue, 17 Mar 2020, Jiri Kosina wrote:

> > The flag change happened at https://gcc.gnu.org/PR92046.
> >
> > CC: Jiri Kosina <[email protected]>
> > CC: Masahiro Yamada <[email protected]>
> > CC: Michal Marek <[email protected]>
> > CC: [email protected]
> > Signed-off-by: Sergei Trofimovich <[email protected]>
> > ---
> > Makefile | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 171f2b004c8a..9696eb2cd5a1 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -714,6 +714,7 @@ endif
> >
> > # Tell gcc to never replace conditional load with a non-conditional one
> > KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
> > +KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
>
> I have to say I can't really read gcc sources without major cerebral pain,
> so let me me dense here: what happens to gcc<10 if you pass
> -fno-allow-store-data-races to it?

Sorry, brainfart on my side, your patch is good :)

Acked-by: Jiri Kosina <[email protected]>

Thanks,

--
Jiri Kosina
SUSE Labs

2020-03-19 15:36:53

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] Makefile: disallow data races on gcc-10 as well

On Tue, Mar 17, 2020 at 10:41 AM Jiri Kosina <[email protected]> wrote:
>
> On Tue, 17 Mar 2020, Jiri Kosina wrote:
>
> > > The flag change happened at https://gcc.gnu.org/PR92046.
> > >
> > > CC: Jiri Kosina <[email protected]>
> > > CC: Masahiro Yamada <[email protected]>
> > > CC: Michal Marek <[email protected]>
> > > CC: [email protected]
> > > Signed-off-by: Sergei Trofimovich <[email protected]>
> > > ---
> > > Makefile | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 171f2b004c8a..9696eb2cd5a1 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -714,6 +714,7 @@ endif
> > >
> > > # Tell gcc to never replace conditional load with a non-conditional one
> > > KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
> > > +KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
> >
> > I have to say I can't really read gcc sources without major cerebral pain,
> > so let me me dense here: what happens to gcc<10 if you pass
> > -fno-allow-store-data-races to it?
>
> Sorry, brainfart on my side, your patch is good :)
>
> Acked-by: Jiri Kosina <[email protected]>
>
> Thanks,
>
> --
> Jiri Kosina
> SUSE Labs
>

Applied to linux-kbuild with Jiri's Ack.

Thanks.

--
Best Regards
Masahiro Yamada