2019-01-23 12:56:56

by Laura Abbott

[permalink] [raw]
Subject: [PATCH] s390/jump_label: Correct asm contraint

There's a build failure with gcc9:

./arch/s390/include/asm/jump_label.h: Assembler messages:
./arch/s390/include/asm/jump_label.h:23: Error: bad expression
./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1

According to the toolchain people, the actual issue is the use of
"X" constraint which is too permissive. Switch to using "i" instead.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1668703
Signed-off-by: Laura Abbott <[email protected]>
---
arch/s390/include/asm/jump_label.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jump_label.h
index e2d3e6c43395..41dabfd8518d 100644
--- a/arch/s390/include/asm/jump_label.h
+++ b/arch/s390/include/asm/jump_label.h
@@ -22,7 +22,7 @@ static inline bool arch_static_branch(struct static_key *key, bool branch)
".long 0b-.,%l[label]-.\n"
".quad %0-.\n"
".popsection\n"
- : : "X" (&((char *)key)[branch]) : : label);
+ : : "i" (&((char *)key)[branch]) : : label);
return false;
label:
return true;
@@ -36,7 +36,7 @@ static inline bool arch_static_branch_jump(struct static_key *key, bool branch)
".long 0b-.,%l[label]-.\n"
".quad %0-.\n"
".popsection\n"
- : : "X" (&((char *)key)[branch]) : : label);
+ : : "i" (&((char *)key)[branch]) : : label);
return false;
label:
return true;
--
2.20.1



2019-01-23 13:26:47

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH] s390/jump_label: Correct asm contraint

On Wed, Jan 23, 2019 at 01:55:13PM +0100, Laura Abbott wrote:
> There's a build failure with gcc9:
>
> ./arch/s390/include/asm/jump_label.h: Assembler messages:
> ./arch/s390/include/asm/jump_label.h:23: Error: bad expression
> ./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
> make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
>
> According to the toolchain people, the actual issue is the use of
> "X" constraint which is too permissive. Switch to using "i" instead.
>
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1668703
> Signed-off-by: Laura Abbott <[email protected]>
> ---
> arch/s390/include/asm/jump_label.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jump_label.h
> index e2d3e6c43395..41dabfd8518d 100644
> --- a/arch/s390/include/asm/jump_label.h
> +++ b/arch/s390/include/asm/jump_label.h
> @@ -22,7 +22,7 @@ static inline bool arch_static_branch(struct static_key *key, bool branch)
> ".long 0b-.,%l[label]-.\n"
> ".quad %0-.\n"
> ".popsection\n"
> - : : "X" (&((char *)key)[branch]) : : label);
> + : : "i" (&((char *)key)[branch]) : : label);
> return false;
> label:
> return true;

Hmmm, this works only for the kernel image, but not for modules, which
we compile with "-fPIC", which again doesn't work as described in the
referenced bugzilla:

In file included from ././include/linux/compiler_types.h:68,
from <command-line>:
./arch/s390/include/asm/jump_label.h: In function 'kvm_vcpu_ioctl':
./include/linux/compiler-gcc.h:124:38: warning: asm operand 0 probably doesn't match constraints
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
^~~
./arch/s390/include/asm/jump_label.h:19:2: note: in expansion of macro 'asm_volatile_goto'
asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
^~~~~~~~~~~~~~~~~
./include/linux/compiler-gcc.h:124:38: error: impossible constraint in 'asm'
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
^~~
./arch/s390/include/asm/jump_label.h:19:2: note: in expansion of macro 'asm_volatile_goto'
asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"

Andreas, Ilya, any idea how to fix this?


2019-01-29 07:26:47

by Laura Abbott

[permalink] [raw]
Subject: Re: [PATCH] s390/jump_label: Correct asm contraint

On 1/23/19 5:24 AM, Heiko Carstens wrote:
> On Wed, Jan 23, 2019 at 01:55:13PM +0100, Laura Abbott wrote:
>> There's a build failure with gcc9:
>>
>> ./arch/s390/include/asm/jump_label.h: Assembler messages:
>> ./arch/s390/include/asm/jump_label.h:23: Error: bad expression
>> ./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
>> make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
>>
>> According to the toolchain people, the actual issue is the use of
>> "X" constraint which is too permissive. Switch to using "i" instead.
>>
>> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1668703
>> Signed-off-by: Laura Abbott <[email protected]>
>> ---
>> arch/s390/include/asm/jump_label.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jump_label.h
>> index e2d3e6c43395..41dabfd8518d 100644
>> --- a/arch/s390/include/asm/jump_label.h
>> +++ b/arch/s390/include/asm/jump_label.h
>> @@ -22,7 +22,7 @@ static inline bool arch_static_branch(struct static_key *key, bool branch)
>> ".long 0b-.,%l[label]-.\n"
>> ".quad %0-.\n"
>> ".popsection\n"
>> - : : "X" (&((char *)key)[branch]) : : label);
>> + : : "i" (&((char *)key)[branch]) : : label);
>> return false;
>> label:
>> return true;
>
> Hmmm, this works only for the kernel image, but not for modules, which
> we compile with "-fPIC", which again doesn't work as described in the
> referenced bugzilla:
>
> In file included from ././include/linux/compiler_types.h:68,
> from <command-line>:
> ./arch/s390/include/asm/jump_label.h: In function 'kvm_vcpu_ioctl':
> ./include/linux/compiler-gcc.h:124:38: warning: asm operand 0 probably doesn't match constraints
> #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
> ^~~
> ./arch/s390/include/asm/jump_label.h:19:2: note: in expansion of macro 'asm_volatile_goto'
> asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
> ^~~~~~~~~~~~~~~~~
> ./include/linux/compiler-gcc.h:124:38: error: impossible constraint in 'asm'
> #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
> ^~~
> ./arch/s390/include/asm/jump_label.h:19:2: note: in expansion of macro 'asm_volatile_goto'
> asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
>
> Andreas, Ilya, any idea how to fix this?
>

I've had to turn off s390 in Fedora until this gets fixed :(


2019-01-30 08:54:20

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH] s390/jump_label: Correct asm contraint

On Tue, Jan 29, 2019 at 08:25:58AM +0100, Laura Abbott wrote:
> On 1/23/19 5:24 AM, Heiko Carstens wrote:
> >On Wed, Jan 23, 2019 at 01:55:13PM +0100, Laura Abbott wrote:
> >>There's a build failure with gcc9:
...
> >Hmmm, this works only for the kernel image, but not for modules, which
> >we compile with "-fPIC", which again doesn't work as described in the
> >referenced bugzilla:
> > ^~~
> >./arch/s390/include/asm/jump_label.h:19:2: note: in expansion of macro 'asm_volatile_goto'
> > asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
> >
> >Andreas, Ilya, any idea how to fix this?
>
> I've had to turn off s390 in Fedora until this gets fixed :(

I assume this means you only turned off CONFIG_JUMP_LABEL on s390
until we have a fix for this?


2019-02-05 12:46:31

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH] s390/jump_label: Correct asm contraint

On Tue, Jan 29, 2019 at 08:25:58AM +0100, Laura Abbott wrote:
> On 1/23/19 5:24 AM, Heiko Carstens wrote:
> >On Wed, Jan 23, 2019 at 01:55:13PM +0100, Laura Abbott wrote:
> >>There's a build failure with gcc9:
> >>
> >> ./arch/s390/include/asm/jump_label.h: Assembler messages:
> >> ./arch/s390/include/asm/jump_label.h:23: Error: bad expression
> >> ./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
> >> make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
...
> I've had to turn off s390 in Fedora until this gets fixed :(

Laura, the patch below should fix this (temporarily). If possible,
could you give it a try? It seems to work for me.

rom 4067027c2ccc8d3f1dc3bb19fe2d00da0c65bcd8 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <[email protected]>
Date: Tue, 5 Feb 2019 13:21:56 +0100
Subject: [PATCH] s390: disable section anchors

Disable section anchors to allow to compile with the current gcc 9
experimental version. The section anchors is a new feature for s390
with gcc 9, however it breaks our current usage of the 'X' constraint
within the asm goto construct within our jump label implementation.

Fixing this seems to be non-trivial, therefore (hopefully) temporarily
disable section anchors. We will hopefully have a better solution
before gcc 9 is released, so that this can be removed again.

Reported-by: Laura Abbott <[email protected]>
Suggested-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
---
arch/s390/Makefile | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index e21053e5e0da..1eac75bc3a29 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -62,6 +62,14 @@ cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
#
cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls

+#
+# Disable section anchors. This gcc 9 feature currently breaks the 'X'
+# constraint like it is used in the asm goto construct.
+#
+ifeq ($(call cc-option-yn,-fno-section-anchors),y)
+cflags-y += -fno-section-anchors
+endif
+
ifeq ($(call cc-option-yn,-mpacked-stack),y)
cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
--
2.16.4


2019-02-09 20:37:53

by Laura Abbott

[permalink] [raw]
Subject: Re: [PATCH] s390/jump_label: Correct asm contraint

On 2/5/19 12:43 PM, Heiko Carstens wrote:
> On Tue, Jan 29, 2019 at 08:25:58AM +0100, Laura Abbott wrote:
>> On 1/23/19 5:24 AM, Heiko Carstens wrote:
>>> On Wed, Jan 23, 2019 at 01:55:13PM +0100, Laura Abbott wrote:
>>>> There's a build failure with gcc9:
>>>>
>>>> ./arch/s390/include/asm/jump_label.h: Assembler messages:
>>>> ./arch/s390/include/asm/jump_label.h:23: Error: bad expression
>>>> ./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
>>>> make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
> ...
>> I've had to turn off s390 in Fedora until this gets fixed :(
>
> Laura, the patch below should fix this (temporarily). If possible,
> could you give it a try? It seems to work for me.
>
> rom 4067027c2ccc8d3f1dc3bb19fe2d00da0c65bcd8 Mon Sep 17 00:00:00 2001
> From: Heiko Carstens <[email protected]>
> Date: Tue, 5 Feb 2019 13:21:56 +0100
> Subject: [PATCH] s390: disable section anchors
>
> Disable section anchors to allow to compile with the current gcc 9
> experimental version. The section anchors is a new feature for s390
> with gcc 9, however it breaks our current usage of the 'X' constraint
> within the asm goto construct within our jump label implementation.
>
> Fixing this seems to be non-trivial, therefore (hopefully) temporarily
> disable section anchors. We will hopefully have a better solution
> before gcc 9 is released, so that this can be removed again.
>
> Reported-by: Laura Abbott <[email protected]>
> Suggested-by: Ilya Leoshkevich <[email protected]>
> Signed-off-by: Heiko Carstens <[email protected]>
> ---
> arch/s390/Makefile | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/s390/Makefile b/arch/s390/Makefile
> index e21053e5e0da..1eac75bc3a29 100644
> --- a/arch/s390/Makefile
> +++ b/arch/s390/Makefile
> @@ -62,6 +62,14 @@ cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
> #
> cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
>
> +#
> +# Disable section anchors. This gcc 9 feature currently breaks the 'X'
> +# constraint like it is used in the asm goto construct.
> +#
> +ifeq ($(call cc-option-yn,-fno-section-anchors),y)
> +cflags-y += -fno-section-anchors
> +endif
> +
> ifeq ($(call cc-option-yn,-mpacked-stack),y)
> cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
> aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
>

Tested-by: Laura Abbott <[email protected]><

2019-02-20 08:58:57

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH] s390/jump_label: Correct asm contraint

On Sat, Feb 09, 2019 at 12:34:20PM -0800, Laura Abbott wrote:
> On 2/5/19 12:43 PM, Heiko Carstens wrote:
> >On Tue, Jan 29, 2019 at 08:25:58AM +0100, Laura Abbott wrote:
> >>On 1/23/19 5:24 AM, Heiko Carstens wrote:
> >>>On Wed, Jan 23, 2019 at 01:55:13PM +0100, Laura Abbott wrote:
> >>>>There's a build failure with gcc9:
> >>>>
> >>>> ./arch/s390/include/asm/jump_label.h: Assembler messages:
> >>>> ./arch/s390/include/asm/jump_label.h:23: Error: bad expression
> >>>> ./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
> >>>> make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
> >...
> >>I've had to turn off s390 in Fedora until this gets fixed :(
> >
> >Laura, the patch below should fix this (temporarily). If possible,
> >could you give it a try? It seems to work for me.
> >
> >Subject: [PATCH] s390: disable section anchors
> Tested-by: Laura Abbott <[email protected]><

The patch won't be used. In the meantime Ilya provided a gcc 9 and
kernel patch which should fix this. The kernel patch is available here
https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/commit/?h=features&id=146448524bddbf6dfc62de31957e428de001cbda
and will go upstream during the next merge window.

Note: this obviously also requires to update the gcc 9 version in
Fedora, so it contains Ilya's patch, to be able to compile the kernel.

Thanks,
Heiko


2019-02-20 18:44:48

by Laura Abbott

[permalink] [raw]
Subject: Re: [PATCH] s390/jump_label: Correct asm contraint

On 2/20/19 12:58 AM, Heiko Carstens wrote:
> On Sat, Feb 09, 2019 at 12:34:20PM -0800, Laura Abbott wrote:
>> On 2/5/19 12:43 PM, Heiko Carstens wrote:
>>> On Tue, Jan 29, 2019 at 08:25:58AM +0100, Laura Abbott wrote:
>>>> On 1/23/19 5:24 AM, Heiko Carstens wrote:
>>>>> On Wed, Jan 23, 2019 at 01:55:13PM +0100, Laura Abbott wrote:
>>>>>> There's a build failure with gcc9:
>>>>>>
>>>>>> ./arch/s390/include/asm/jump_label.h: Assembler messages:
>>>>>> ./arch/s390/include/asm/jump_label.h:23: Error: bad expression
>>>>>> ./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
>>>>>> make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
>>> ...
>>>> I've had to turn off s390 in Fedora until this gets fixed :(
>>>
>>> Laura, the patch below should fix this (temporarily). If possible,
>>> could you give it a try? It seems to work for me.
>>>
>>> Subject: [PATCH] s390: disable section anchors
>> Tested-by: Laura Abbott <[email protected]><
>
> The patch won't be used. In the meantime Ilya provided a gcc 9 and
> kernel patch which should fix this. The kernel patch is available here
> https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/commit/?h=features&id=146448524bddbf6dfc62de31957e428de001cbda
> and will go upstream during the next merge window.
>
> Note: this obviously also requires to update the gcc 9 version in
> Fedora, so it contains Ilya's patch, to be able to compile the kernel.
>
> Thanks,
> Heiko
>

Thanks. I'll keep an eye out for that during the next merge
window.