All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: lse: Fix LSE atomics with LLVM
@ 2020-02-18 16:49 Vincenzo Frascino
  2020-02-18 16:54 ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-18 16:49 UTC (permalink / raw)
  To: linux-arm-kernel, clang-built-linux
  Cc: amit.kachhap, catalin.marinas, will.deacon

The introduction of the commit e0d5896bd356cd broke the compilation of
the kernel when the selected compiler is clang and it is used in
combination with "-no-integrated-as".
This happens because __LSE_PREAMBLE is defined as ".arch armv8-a+lse"
and this overrides the version of the architecture passed via -march
command line to the gas compiler.

The issue was noticed during the development of pauth on arm64 and an
error example is reported below:

$ aarch64-none-linux-gnu-as -EL -I ./arch/arm64/include
                                -I ./arch/arm64/include/generated
                                -I ./include -I ./include
                                -I ./arch/arm64/include/uapi
                                -I ./arch/arm64/include/generated/uapi
                                -I ./include/uapi -I ./include/generated/uapi
                                -I ./init -I ./init
                                -march=armv8.3-a -o init/do_mounts.o
                                /tmp/do_mounts-d7992a.s
/tmp/do_mounts-d7992a.s: Assembler messages:
/tmp/do_mounts-d7992a.s:1959: Error: selected processor does not support `autiasp'
/tmp/do_mounts-d7992a.s:2021: Error: selected processor does not support `paciasp'
/tmp/do_mounts-d7992a.s:2157: Error: selected processor does not support `autiasp'
/tmp/do_mounts-d7992a.s:2175: Error: selected processor does not support `paciasp'
/tmp/do_mounts-d7992a.s:2494: Error: selected processor does not support `autiasp'

Fix the issue replacing ".arch armv8-a+lse" with ".arch_extension lse" that does
not override the command line parameter.

Fixes: e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated assembler")
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Reported-by: Amit Kachhap <Amit.Kachhap@arm.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/include/asm/lse.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h
index d429f7701c36..5d10051c3e62 100644
--- a/arch/arm64/include/asm/lse.h
+++ b/arch/arm64/include/asm/lse.h
@@ -6,7 +6,7 @@
 
 #ifdef CONFIG_ARM64_LSE_ATOMICS
 
-#define __LSE_PREAMBLE	".arch armv8-a+lse\n"
+#define __LSE_PREAMBLE	".arch_extension lse\n"
 
 #include <linux/compiler_types.h>
 #include <linux/export.h>
-- 
2.25.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: lse: Fix LSE atomics with LLVM
  2020-02-18 16:49 [PATCH] arm64: lse: Fix LSE atomics with LLVM Vincenzo Frascino
@ 2020-02-18 16:54 ` Will Deacon
  2020-02-18 17:42   ` Vincenzo Frascino
  2020-02-18 18:02   ` Sami Tolvanen
  0 siblings, 2 replies; 7+ messages in thread
From: Will Deacon @ 2020-02-18 16:54 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: catalin.marinas, will.deacon, clang-built-linux, samitolvanen,
	amit.kachhap, linux-arm-kernel

[+Sami]

On Tue, Feb 18, 2020 at 04:49:06PM +0000, Vincenzo Frascino wrote:
> The introduction of the commit e0d5896bd356cd broke the compilation of
> the kernel when the selected compiler is clang and it is used in
> combination with "-no-integrated-as".

Curious, but have you tested this change with the integrated assembler as
well?

> This happens because __LSE_PREAMBLE is defined as ".arch armv8-a+lse"
> and this overrides the version of the architecture passed via -march
> command line to the gas compiler.
> 
> The issue was noticed during the development of pauth on arm64 and an
> error example is reported below:
> 
> $ aarch64-none-linux-gnu-as -EL -I ./arch/arm64/include
>                                 -I ./arch/arm64/include/generated
>                                 -I ./include -I ./include
>                                 -I ./arch/arm64/include/uapi
>                                 -I ./arch/arm64/include/generated/uapi
>                                 -I ./include/uapi -I ./include/generated/uapi
>                                 -I ./init -I ./init
>                                 -march=armv8.3-a -o init/do_mounts.o
>                                 /tmp/do_mounts-d7992a.s
> /tmp/do_mounts-d7992a.s: Assembler messages:
> /tmp/do_mounts-d7992a.s:1959: Error: selected processor does not support `autiasp'
> /tmp/do_mounts-d7992a.s:2021: Error: selected processor does not support `paciasp'
> /tmp/do_mounts-d7992a.s:2157: Error: selected processor does not support `autiasp'
> /tmp/do_mounts-d7992a.s:2175: Error: selected processor does not support `paciasp'
> /tmp/do_mounts-d7992a.s:2494: Error: selected processor does not support `autiasp'
> 
> Fix the issue replacing ".arch armv8-a+lse" with ".arch_extension lse" that does
> not override the command line parameter.
> 
> Fixes: e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated assembler")
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Reported-by: Amit Kachhap <Amit.Kachhap@arm.com>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  arch/arm64/include/asm/lse.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h
> index d429f7701c36..5d10051c3e62 100644
> --- a/arch/arm64/include/asm/lse.h
> +++ b/arch/arm64/include/asm/lse.h
> @@ -6,7 +6,7 @@
>  
>  #ifdef CONFIG_ARM64_LSE_ATOMICS
>  
> -#define __LSE_PREAMBLE	".arch armv8-a+lse\n"
> +#define __LSE_PREAMBLE	".arch_extension lse\n"

I'm ok with this, but Sami assumedly changed this for a reason in
e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated
assembler").

Sami?

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: lse: Fix LSE atomics with LLVM
  2020-02-18 16:54 ` Will Deacon
@ 2020-02-18 17:42   ` Vincenzo Frascino
  2020-02-18 18:03     ` Sami Tolvanen
  2020-02-18 18:02   ` Sami Tolvanen
  1 sibling, 1 reply; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-18 17:42 UTC (permalink / raw)
  To: Will Deacon
  Cc: catalin.marinas, will.deacon, clang-built-linux, samitolvanen,
	amit.kachhap, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 3337 bytes --]

Hi Will,

On 18/02/2020 16:54, Will Deacon wrote:
> [+Sami]
> 

Thanks for this, I forgot to add Sami in Cc.

> On Tue, Feb 18, 2020 at 04:49:06PM +0000, Vincenzo Frascino wrote:
>> The introduction of the commit e0d5896bd356cd broke the compilation of
>> the kernel when the selected compiler is clang and it is used in
>> combination with "-no-integrated-as".
> 
> Curious, but have you tested this change with the integrated assembler as
> well?
> 

The integrated assembler as far as I am aware cannot assemble the kernel for
reasons independent from lse (AS=clang generates a lot of errors). Not sure how
Sami is testing it. I would be happy to learn it myself.

The default option for clang in the kernel Makefile is "-no-integrated-as"
though hence e0d5896bd356cd introduces a regression.

>> This happens because __LSE_PREAMBLE is defined as ".arch armv8-a+lse"
>> and this overrides the version of the architecture passed via -march
>> command line to the gas compiler.
>>
>> The issue was noticed during the development of pauth on arm64 and an
>> error example is reported below:
>>
>> $ aarch64-none-linux-gnu-as -EL -I ./arch/arm64/include
>>                                 -I ./arch/arm64/include/generated
>>                                 -I ./include -I ./include
>>                                 -I ./arch/arm64/include/uapi
>>                                 -I ./arch/arm64/include/generated/uapi
>>                                 -I ./include/uapi -I ./include/generated/uapi
>>                                 -I ./init -I ./init
>>                                 -march=armv8.3-a -o init/do_mounts.o
>>                                 /tmp/do_mounts-d7992a.s
>> /tmp/do_mounts-d7992a.s: Assembler messages:
>> /tmp/do_mounts-d7992a.s:1959: Error: selected processor does not support `autiasp'
>> /tmp/do_mounts-d7992a.s:2021: Error: selected processor does not support `paciasp'
>> /tmp/do_mounts-d7992a.s:2157: Error: selected processor does not support `autiasp'
>> /tmp/do_mounts-d7992a.s:2175: Error: selected processor does not support `paciasp'
>> /tmp/do_mounts-d7992a.s:2494: Error: selected processor does not support `autiasp'
>>
>> Fix the issue replacing ".arch armv8-a+lse" with ".arch_extension lse" that does
>> not override the command line parameter.
>>
>> Fixes: e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated assembler")
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Reported-by: Amit Kachhap <Amit.Kachhap@arm.com>
>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
>> ---
>>  arch/arm64/include/asm/lse.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h
>> index d429f7701c36..5d10051c3e62 100644
>> --- a/arch/arm64/include/asm/lse.h
>> +++ b/arch/arm64/include/asm/lse.h
>> @@ -6,7 +6,7 @@
>>  
>>  #ifdef CONFIG_ARM64_LSE_ATOMICS
>>  
>> -#define __LSE_PREAMBLE	".arch armv8-a+lse\n"
>> +#define __LSE_PREAMBLE	".arch_extension lse\n"
> 
> I'm ok with this, but Sami assumedly changed this for a reason in
> e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated
> assembler").
> 
> Sami?
> 
> Will
> 

-- 
Regards,
Vincenzo

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 14291 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: lse: Fix LSE atomics with LLVM
  2020-02-18 16:54 ` Will Deacon
  2020-02-18 17:42   ` Vincenzo Frascino
@ 2020-02-18 18:02   ` Sami Tolvanen
  2020-02-18 18:05     ` Will Deacon
  1 sibling, 1 reply; 7+ messages in thread
From: Sami Tolvanen @ 2020-02-18 18:02 UTC (permalink / raw)
  To: Will Deacon
  Cc: Catalin Marinas, Will Deacon, clang-built-linux, amit.kachhap,
	Vincenzo Frascino, linux-arm-kernel

On Tue, Feb 18, 2020 at 8:54 AM Will Deacon <will@kernel.org> wrote:
> > -#define __LSE_PREAMBLE       ".arch armv8-a+lse\n"
> > +#define __LSE_PREAMBLE       ".arch_extension lse\n"
>
> I'm ok with this, but Sami assumedly changed this for a reason in
> e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated
> assembler").

Correct, I changed this because clang's integrated assembler wasn't
happy with .arch_extension lse at the time. However, it looks like
current versions of clang don't have this problem, so this change
looks good to me.

Tested-by: Sami Tolvanen <samitolvanen@google.com>

Sami

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: lse: Fix LSE atomics with LLVM
  2020-02-18 17:42   ` Vincenzo Frascino
@ 2020-02-18 18:03     ` Sami Tolvanen
  0 siblings, 0 replies; 7+ messages in thread
From: Sami Tolvanen @ 2020-02-18 18:03 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: Catalin Marinas, Will Deacon, clang-built-linux, amit.kachhap,
	Will Deacon, linux-arm-kernel

On Tue, Feb 18, 2020 at 9:43 AM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
> The integrated assembler as far as I am aware cannot assemble the kernel for
> reasons independent from lse (AS=clang generates a lot of errors). Not sure how
> Sami is testing it. I would be happy to learn it myself.

We use LTO in Android kernels, which flips on Clang's integrated
assembler for inline assembly only.

Sami

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: lse: Fix LSE atomics with LLVM
  2020-02-18 18:02   ` Sami Tolvanen
@ 2020-02-18 18:05     ` Will Deacon
  2020-02-18 18:11       ` Vincenzo Frascino
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2020-02-18 18:05 UTC (permalink / raw)
  To: Sami Tolvanen
  Cc: Catalin Marinas, Will Deacon, clang-built-linux, amit.kachhap,
	Vincenzo Frascino, linux-arm-kernel

On Tue, Feb 18, 2020 at 10:02:24AM -0800, Sami Tolvanen wrote:
> On Tue, Feb 18, 2020 at 8:54 AM Will Deacon <will@kernel.org> wrote:
> > > -#define __LSE_PREAMBLE       ".arch armv8-a+lse\n"
> > > +#define __LSE_PREAMBLE       ".arch_extension lse\n"
> >
> > I'm ok with this, but Sami assumedly changed this for a reason in
> > e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated
> > assembler").
> 
> Correct, I changed this because clang's integrated assembler wasn't
> happy with .arch_extension lse at the time. However, it looks like
> current versions of clang don't have this problem, so this change
> looks good to me.
> 
> Tested-by: Sami Tolvanen <samitolvanen@google.com>

Cheers, I'll queue this with your tag.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: lse: Fix LSE atomics with LLVM
  2020-02-18 18:05     ` Will Deacon
@ 2020-02-18 18:11       ` Vincenzo Frascino
  0 siblings, 0 replies; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-18 18:11 UTC (permalink / raw)
  To: Will Deacon, Sami Tolvanen
  Cc: amit.kachhap, clang-built-linux, Will Deacon, linux-arm-kernel,
	Catalin Marinas

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

Hi Will and Sami,

On 18/02/2020 18:05, Will Deacon wrote:
> On Tue, Feb 18, 2020 at 10:02:24AM -0800, Sami Tolvanen wrote:
>> On Tue, Feb 18, 2020 at 8:54 AM Will Deacon <will@kernel.org> wrote:
>>>> -#define __LSE_PREAMBLE       ".arch armv8-a+lse\n"
>>>> +#define __LSE_PREAMBLE       ".arch_extension lse\n"
>>>
>>> I'm ok with this, but Sami assumedly changed this for a reason in
>>> e0d5896bd356cd ("arm64: lse: fix LSE atomics with LLVM's integrated
>>> assembler").
>>
>> Correct, I changed this because clang's integrated assembler wasn't
>> happy with .arch_extension lse at the time. However, it looks like
>> current versions of clang don't have this problem, so this change
>> looks good to me.
>>
>> Tested-by: Sami Tolvanen <samitolvanen@google.com>
> 
> Cheers, I'll queue this with your tag.
> 
> Will
> 

Thank you for the quick turn around :)

-- 
Regards,
Vincenzo

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 14291 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-02-18 18:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 16:49 [PATCH] arm64: lse: Fix LSE atomics with LLVM Vincenzo Frascino
2020-02-18 16:54 ` Will Deacon
2020-02-18 17:42   ` Vincenzo Frascino
2020-02-18 18:03     ` Sami Tolvanen
2020-02-18 18:02   ` Sami Tolvanen
2020-02-18 18:05     ` Will Deacon
2020-02-18 18:11       ` Vincenzo Frascino

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.