LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] s390/jump_label: Correct asm contraint
@ 2019-01-23 12:55 Laura Abbott
  2019-01-23 13:24 ` Heiko Carstens
  0 siblings, 1 reply; 8+ messages in thread
From: Laura Abbott @ 2019-01-23 12:55 UTC (permalink / raw)
  To: Martin Schwidefsky, Heiko Carstens; +Cc: Laura Abbott, linux-s390, linux-kernel

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 <labbott@redhat.com>
---
 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


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

* Re: [PATCH] s390/jump_label: Correct asm contraint
  2019-01-23 12:55 [PATCH] s390/jump_label: Correct asm contraint Laura Abbott
@ 2019-01-23 13:24 ` Heiko Carstens
  2019-01-29  7:25   ` Laura Abbott
  0 siblings, 1 reply; 8+ messages in thread
From: Heiko Carstens @ 2019-01-23 13:24 UTC (permalink / raw)
  To: Laura Abbott, Andreas Krebbel, Ilya Leoshkevich
  Cc: Martin Schwidefsky, linux-s390, linux-kernel

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 <labbott@redhat.com>
> ---
>  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?


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

* Re: [PATCH] s390/jump_label: Correct asm contraint
  2019-01-23 13:24 ` Heiko Carstens
@ 2019-01-29  7:25   ` Laura Abbott
  2019-01-30  8:53     ` Heiko Carstens
  2019-02-05 12:43     ` Heiko Carstens
  0 siblings, 2 replies; 8+ messages in thread
From: Laura Abbott @ 2019-01-29  7:25 UTC (permalink / raw)
  To: Heiko Carstens, Andreas Krebbel, Ilya Leoshkevich
  Cc: Martin Schwidefsky, linux-s390, linux-kernel

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 <labbott@redhat.com>
>> ---
>>   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 :(


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

* Re: [PATCH] s390/jump_label: Correct asm contraint
  2019-01-29  7:25   ` Laura Abbott
@ 2019-01-30  8:53     ` Heiko Carstens
  2019-02-05 12:43     ` Heiko Carstens
  1 sibling, 0 replies; 8+ messages in thread
From: Heiko Carstens @ 2019-01-30  8:53 UTC (permalink / raw)
  To: Laura Abbott
  Cc: Andreas Krebbel, Ilya Leoshkevich, Martin Schwidefsky,
	linux-s390, linux-kernel

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?


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

* Re: [PATCH] s390/jump_label: Correct asm contraint
  2019-01-29  7:25   ` Laura Abbott
  2019-01-30  8:53     ` Heiko Carstens
@ 2019-02-05 12:43     ` Heiko Carstens
  2019-02-09 20:34       ` Laura Abbott
  1 sibling, 1 reply; 8+ messages in thread
From: Heiko Carstens @ 2019-02-05 12:43 UTC (permalink / raw)
  To: Laura Abbott
  Cc: Andreas Krebbel, Ilya Leoshkevich, Martin Schwidefsky,
	linux-s390, linux-kernel

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 <heiko.carstens@de.ibm.com>
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 <labbott@redhat.com>
Suggested-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 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


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

* Re: [PATCH] s390/jump_label: Correct asm contraint
  2019-02-05 12:43     ` Heiko Carstens
@ 2019-02-09 20:34       ` Laura Abbott
  2019-02-20  8:58         ` Heiko Carstens
  0 siblings, 1 reply; 8+ messages in thread
From: Laura Abbott @ 2019-02-09 20:34 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Andreas Krebbel, Ilya Leoshkevich, Martin Schwidefsky,
	linux-s390, linux-kernel

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 <heiko.carstens@de.ibm.com>
> 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 <labbott@redhat.com>
> Suggested-by: Ilya Leoshkevich <iii@linux.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
>   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 <labbott@redhat.com><

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

* Re: [PATCH] s390/jump_label: Correct asm contraint
  2019-02-09 20:34       ` Laura Abbott
@ 2019-02-20  8:58         ` Heiko Carstens
  2019-02-20 18:40           ` Laura Abbott
  0 siblings, 1 reply; 8+ messages in thread
From: Heiko Carstens @ 2019-02-20  8:58 UTC (permalink / raw)
  To: Laura Abbott
  Cc: Andreas Krebbel, Ilya Leoshkevich, Martin Schwidefsky,
	linux-s390, linux-kernel

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 <labbott@redhat.com><

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


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

* Re: [PATCH] s390/jump_label: Correct asm contraint
  2019-02-20  8:58         ` Heiko Carstens
@ 2019-02-20 18:40           ` Laura Abbott
  0 siblings, 0 replies; 8+ messages in thread
From: Laura Abbott @ 2019-02-20 18:40 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Andreas Krebbel, Ilya Leoshkevich, Martin Schwidefsky,
	linux-s390, linux-kernel

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 <labbott@redhat.com><
> 
> 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.

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

end of thread, other threads:[~2019-02-20 18:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23 12:55 [PATCH] s390/jump_label: Correct asm contraint Laura Abbott
2019-01-23 13:24 ` Heiko Carstens
2019-01-29  7:25   ` Laura Abbott
2019-01-30  8:53     ` Heiko Carstens
2019-02-05 12:43     ` Heiko Carstens
2019-02-09 20:34       ` Laura Abbott
2019-02-20  8:58         ` Heiko Carstens
2019-02-20 18:40           ` Laura Abbott

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