linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.19 ONLY v4] arm64: vdso: remove commas between macro name and arguments
@ 2021-05-06  1:25 Jian Cai
  2021-05-06 17:43 ` Nathan Chancellor
  2021-05-10  8:28 ` Patch "arm64: vdso: remove commas between macro name and arguments" has been added to the 4.19-stable tree gregkh
  0 siblings, 2 replies; 4+ messages in thread
From: Jian Cai @ 2021-05-06  1:25 UTC (permalink / raw)
  To: gregkh, sashal, will, catalin.marinas, nathan
  Cc: stable, ndesaulniers, manojgupta, llozano, clang-built-linux,
	Jian Cai, Will Deacon, linux-arm-kernel, linux-kernel

LLVM's integrated assembler appears to assume an argument with default
value is passed whenever it sees a comma right after the macro name.
It will be fine if the number of following arguments is one less than
the number of parameters specified in the macro definition. Otherwise,
it fails. For example, the following code works:

$ cat foo.s
.macro  foo arg1=2, arg2=4
        ldr r0, [r1, #\arg1]
        ldr r0, [r1, #\arg2]
.endm

foo, arg2=8

$ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
arm-linux-gnueabihf-objdump -dr ias.o

ias.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0: e5910001 ldr r0, [r1, #2]
   4: e5910003 ldr r0, [r1, #8]

While the the following code would fail:

$ cat foo.s
.macro  foo arg1=2, arg2=4
        ldr r0, [r1, #\arg1]
        ldr r0, [r1, #\arg2]
.endm

foo, arg1=2, arg2=8

$ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
foo.s:6:14: error: too many positional arguments
foo, arg1=2, arg2=8

This causes build failures as follows:

arch/arm64/kernel/vdso/gettimeofday.S:230:24: error: too many positional
arguments
 clock_gettime_return, shift=1
                       ^
arch/arm64/kernel/vdso/gettimeofday.S:253:24: error: too many positional
arguments
 clock_gettime_return, shift=1
                       ^
arch/arm64/kernel/vdso/gettimeofday.S:274:24: error: too many positional
arguments
 clock_gettime_return, shift=1

This error is not in mainline because commit 28b1a824a4f4 ("arm64: vdso:
Substitute gettimeofday() with C implementation") rewrote this assembler
file in C as part of a 25 patch series that is unsuitable for stable.
Just remove the comma in the clock_gettime_return invocations in 4.19 so
that GNU as and LLVM's integrated assembler work the same.

Link:
https://github.com/ClangBuiltLinux/linux/issues/1349

Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jian Cai <jiancai@google.com>
---
Changes v1 -> v2:
  Keep the comma in the macro definition to be consistent with other
  definitions.

Changes v2 -> v3:
  Edit tags.

Changes v3 -> v4:
  Update the commit message based on Nathan's comments.

 arch/arm64/kernel/vdso/gettimeofday.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S
index 856fee6d3512..b6faf8b5d1fe 100644
--- a/arch/arm64/kernel/vdso/gettimeofday.S
+++ b/arch/arm64/kernel/vdso/gettimeofday.S
@@ -227,7 +227,7 @@ realtime:
 	seqcnt_check fail=realtime
 	get_ts_realtime res_sec=x10, res_nsec=x11, \
 		clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
-	clock_gettime_return, shift=1
+	clock_gettime_return shift=1
 
 	ALIGN
 monotonic:
@@ -250,7 +250,7 @@ monotonic:
 		clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
 
 	add_ts sec=x10, nsec=x11, ts_sec=x3, ts_nsec=x4, nsec_to_sec=x9
-	clock_gettime_return, shift=1
+	clock_gettime_return shift=1
 
 	ALIGN
 monotonic_raw:
@@ -271,7 +271,7 @@ monotonic_raw:
 		clock_nsec=x15, nsec_to_sec=x9
 
 	add_ts sec=x10, nsec=x11, ts_sec=x13, ts_nsec=x14, nsec_to_sec=x9
-	clock_gettime_return, shift=1
+	clock_gettime_return shift=1
 
 	ALIGN
 realtime_coarse:
-- 
2.31.1.607.g51e8a6a459-goog


_______________________________________________
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] 4+ messages in thread

* Re: [PATCH 4.19 ONLY v4] arm64: vdso: remove commas between macro name and arguments
  2021-05-06  1:25 [PATCH 4.19 ONLY v4] arm64: vdso: remove commas between macro name and arguments Jian Cai
@ 2021-05-06 17:43 ` Nathan Chancellor
  2021-05-10  8:03   ` Greg KH
  2021-05-10  8:28 ` Patch "arm64: vdso: remove commas between macro name and arguments" has been added to the 4.19-stable tree gregkh
  1 sibling, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2021-05-06 17:43 UTC (permalink / raw)
  To: Jian Cai, gregkh, sashal, will, catalin.marinas
  Cc: stable, ndesaulniers, manojgupta, llozano, clang-built-linux,
	Will Deacon, linux-arm-kernel, linux-kernel

On 5/5/2021 6:25 PM, Jian Cai wrote:
> LLVM's integrated assembler appears to assume an argument with default
> value is passed whenever it sees a comma right after the macro name.
> It will be fine if the number of following arguments is one less than
> the number of parameters specified in the macro definition. Otherwise,
> it fails. For example, the following code works:
> 
> $ cat foo.s
> .macro  foo arg1=2, arg2=4
>          ldr r0, [r1, #\arg1]
>          ldr r0, [r1, #\arg2]
> .endm
> 
> foo, arg2=8
> 
> $ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
> arm-linux-gnueabihf-objdump -dr ias.o
> 
> ias.o:     file format elf32-littlearm
> 
> Disassembly of section .text:
> 
> 00000000 <.text>:
>     0: e5910001 ldr r0, [r1, #2]
>     4: e5910003 ldr r0, [r1, #8]
> 
> While the the following code would fail:
> 
> $ cat foo.s
> .macro  foo arg1=2, arg2=4
>          ldr r0, [r1, #\arg1]
>          ldr r0, [r1, #\arg2]
> .endm
> 
> foo, arg1=2, arg2=8
> 
> $ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
> foo.s:6:14: error: too many positional arguments
> foo, arg1=2, arg2=8
> 
> This causes build failures as follows:
> 
> arch/arm64/kernel/vdso/gettimeofday.S:230:24: error: too many positional
> arguments
>   clock_gettime_return, shift=1
>                         ^
> arch/arm64/kernel/vdso/gettimeofday.S:253:24: error: too many positional
> arguments
>   clock_gettime_return, shift=1
>                         ^
> arch/arm64/kernel/vdso/gettimeofday.S:274:24: error: too many positional
> arguments
>   clock_gettime_return, shift=1
> 
> This error is not in mainline because commit 28b1a824a4f4 ("arm64: vdso:
> Substitute gettimeofday() with C implementation") rewrote this assembler
> file in C as part of a 25 patch series that is unsuitable for stable.
> Just remove the comma in the clock_gettime_return invocations in 4.19 so
> that GNU as and LLVM's integrated assembler work the same.
> 
> Link:
> https://github.com/ClangBuiltLinux/linux/issues/1349
> 
> Suggested-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Jian Cai <jiancai@google.com>

Thanks for the updated example and explanation, this looks good to me now.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> Changes v1 -> v2:
>    Keep the comma in the macro definition to be consistent with other
>    definitions.
> 
> Changes v2 -> v3:
>    Edit tags.
> 
> Changes v3 -> v4:
>    Update the commit message based on Nathan's comments.
> 
>   arch/arm64/kernel/vdso/gettimeofday.S | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S
> index 856fee6d3512..b6faf8b5d1fe 100644
> --- a/arch/arm64/kernel/vdso/gettimeofday.S
> +++ b/arch/arm64/kernel/vdso/gettimeofday.S
> @@ -227,7 +227,7 @@ realtime:
>   	seqcnt_check fail=realtime
>   	get_ts_realtime res_sec=x10, res_nsec=x11, \
>   		clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
> -	clock_gettime_return, shift=1
> +	clock_gettime_return shift=1
>   
>   	ALIGN
>   monotonic:
> @@ -250,7 +250,7 @@ monotonic:
>   		clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
>   
>   	add_ts sec=x10, nsec=x11, ts_sec=x3, ts_nsec=x4, nsec_to_sec=x9
> -	clock_gettime_return, shift=1
> +	clock_gettime_return shift=1
>   
>   	ALIGN
>   monotonic_raw:
> @@ -271,7 +271,7 @@ monotonic_raw:
>   		clock_nsec=x15, nsec_to_sec=x9
>   
>   	add_ts sec=x10, nsec=x11, ts_sec=x13, ts_nsec=x14, nsec_to_sec=x9
> -	clock_gettime_return, shift=1
> +	clock_gettime_return shift=1
>   
>   	ALIGN
>   realtime_coarse:
> 


_______________________________________________
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] 4+ messages in thread

* Re: [PATCH 4.19 ONLY v4] arm64: vdso: remove commas between macro name and arguments
  2021-05-06 17:43 ` Nathan Chancellor
@ 2021-05-10  8:03   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2021-05-10  8:03 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Jian Cai, sashal, will, catalin.marinas, stable, ndesaulniers,
	manojgupta, llozano, clang-built-linux, Will Deacon,
	linux-arm-kernel, linux-kernel

On Thu, May 06, 2021 at 10:43:33AM -0700, Nathan Chancellor wrote:
> On 5/5/2021 6:25 PM, Jian Cai wrote:
> > LLVM's integrated assembler appears to assume an argument with default
> > value is passed whenever it sees a comma right after the macro name.
> > It will be fine if the number of following arguments is one less than
> > the number of parameters specified in the macro definition. Otherwise,
> > it fails. For example, the following code works:
> > 
> > $ cat foo.s
> > .macro  foo arg1=2, arg2=4
> >          ldr r0, [r1, #\arg1]
> >          ldr r0, [r1, #\arg2]
> > .endm
> > 
> > foo, arg2=8
> > 
> > $ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
> > arm-linux-gnueabihf-objdump -dr ias.o
> > 
> > ias.o:     file format elf32-littlearm
> > 
> > Disassembly of section .text:
> > 
> > 00000000 <.text>:
> >     0: e5910001 ldr r0, [r1, #2]
> >     4: e5910003 ldr r0, [r1, #8]
> > 
> > While the the following code would fail:
> > 
> > $ cat foo.s
> > .macro  foo arg1=2, arg2=4
> >          ldr r0, [r1, #\arg1]
> >          ldr r0, [r1, #\arg2]
> > .endm
> > 
> > foo, arg1=2, arg2=8
> > 
> > $ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
> > foo.s:6:14: error: too many positional arguments
> > foo, arg1=2, arg2=8
> > 
> > This causes build failures as follows:
> > 
> > arch/arm64/kernel/vdso/gettimeofday.S:230:24: error: too many positional
> > arguments
> >   clock_gettime_return, shift=1
> >                         ^
> > arch/arm64/kernel/vdso/gettimeofday.S:253:24: error: too many positional
> > arguments
> >   clock_gettime_return, shift=1
> >                         ^
> > arch/arm64/kernel/vdso/gettimeofday.S:274:24: error: too many positional
> > arguments
> >   clock_gettime_return, shift=1
> > 
> > This error is not in mainline because commit 28b1a824a4f4 ("arm64: vdso:
> > Substitute gettimeofday() with C implementation") rewrote this assembler
> > file in C as part of a 25 patch series that is unsuitable for stable.
> > Just remove the comma in the clock_gettime_return invocations in 4.19 so
> > that GNU as and LLVM's integrated assembler work the same.
> > 
> > Link:
> > https://github.com/ClangBuiltLinux/linux/issues/1349
> > 
> > Suggested-by: Nathan Chancellor <nathan@kernel.org>
> > Signed-off-by: Jian Cai <jiancai@google.com>
> 
> Thanks for the updated example and explanation, this looks good to me now.
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Now queued up, thanks.

greg k-h

_______________________________________________
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] 4+ messages in thread

* Patch "arm64: vdso: remove commas between macro name and arguments" has been added to the 4.19-stable tree
  2021-05-06  1:25 [PATCH 4.19 ONLY v4] arm64: vdso: remove commas between macro name and arguments Jian Cai
  2021-05-06 17:43 ` Nathan Chancellor
@ 2021-05-10  8:28 ` gregkh
  1 sibling, 0 replies; 4+ messages in thread
From: gregkh @ 2021-05-10  8:28 UTC (permalink / raw)
  To: catalin.marinas, clang-built-linux, gregkh, jiancai,
	linux-arm-kernel, llozano, manojgupta, nathan, ndesaulniers,
	sashal, will.deacon, will
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: vdso: remove commas between macro name and arguments

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-vdso-remove-commas-between-macro-name-and-arguments.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From jiancai@google.com  Mon May 10 10:02:08 2021
From: Jian Cai <jiancai@google.com>
Date: Wed,  5 May 2021 18:25:08 -0700
Subject: arm64: vdso: remove commas between macro name and arguments
To: gregkh@linuxfoundation.org, sashal@kernel.org, will@kernel.org, catalin.marinas@arm.com, nathan@kernel.org
Cc: stable@vger.kernel.org, ndesaulniers@google.com, manojgupta@google.com, llozano@google.com, clang-built-linux@googlegroups.com, Jian Cai <jiancai@google.com>, Will Deacon <will.deacon@arm.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Message-ID: <20210506012508.3822221-1-jiancai@google.com>

From: Jian Cai <jiancai@google.com>

LLVM's integrated assembler appears to assume an argument with default
value is passed whenever it sees a comma right after the macro name.
It will be fine if the number of following arguments is one less than
the number of parameters specified in the macro definition. Otherwise,
it fails. For example, the following code works:

$ cat foo.s
.macro  foo arg1=2, arg2=4
        ldr r0, [r1, #\arg1]
        ldr r0, [r1, #\arg2]
.endm

foo, arg2=8

$ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
arm-linux-gnueabihf-objdump -dr ias.o

ias.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0: e5910001 ldr r0, [r1, #2]
   4: e5910003 ldr r0, [r1, #8]

While the the following code would fail:

$ cat foo.s
.macro  foo arg1=2, arg2=4
        ldr r0, [r1, #\arg1]
        ldr r0, [r1, #\arg2]
.endm

foo, arg1=2, arg2=8

$ llvm-mc -triple=armv7a -filetype=obj foo.s -o ias.o
foo.s:6:14: error: too many positional arguments
foo, arg1=2, arg2=8

This causes build failures as follows:

arch/arm64/kernel/vdso/gettimeofday.S:230:24: error: too many positional
arguments
 clock_gettime_return, shift=1
                       ^
arch/arm64/kernel/vdso/gettimeofday.S:253:24: error: too many positional
arguments
 clock_gettime_return, shift=1
                       ^
arch/arm64/kernel/vdso/gettimeofday.S:274:24: error: too many positional
arguments
 clock_gettime_return, shift=1

This error is not in mainline because commit 28b1a824a4f4 ("arm64: vdso:
Substitute gettimeofday() with C implementation") rewrote this assembler
file in C as part of a 25 patch series that is unsuitable for stable.
Just remove the comma in the clock_gettime_return invocations in 4.19 so
that GNU as and LLVM's integrated assembler work the same.

Link:
https://github.com/ClangBuiltLinux/linux/issues/1349

Suggested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jian Cai <jiancai@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Changes v1 -> v2:
  Keep the comma in the macro definition to be consistent with other
  definitions.

Changes v2 -> v3:
  Edit tags.

Changes v3 -> v4:
  Update the commit message based on Nathan's comments.

 arch/arm64/kernel/vdso/gettimeofday.S |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/arm64/kernel/vdso/gettimeofday.S
+++ b/arch/arm64/kernel/vdso/gettimeofday.S
@@ -227,7 +227,7 @@ realtime:
 	seqcnt_check fail=realtime
 	get_ts_realtime res_sec=x10, res_nsec=x11, \
 		clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
-	clock_gettime_return, shift=1
+	clock_gettime_return shift=1
 
 	ALIGN
 monotonic:
@@ -250,7 +250,7 @@ monotonic:
 		clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
 
 	add_ts sec=x10, nsec=x11, ts_sec=x3, ts_nsec=x4, nsec_to_sec=x9
-	clock_gettime_return, shift=1
+	clock_gettime_return shift=1
 
 	ALIGN
 monotonic_raw:
@@ -271,7 +271,7 @@ monotonic_raw:
 		clock_nsec=x15, nsec_to_sec=x9
 
 	add_ts sec=x10, nsec=x11, ts_sec=x13, ts_nsec=x14, nsec_to_sec=x9
-	clock_gettime_return, shift=1
+	clock_gettime_return shift=1
 
 	ALIGN
 realtime_coarse:


Patches currently in stable-queue which might be from jiancai@google.com are

queue-4.19/arm64-vdso-remove-commas-between-macro-name-and-arguments.patch

_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2021-05-10  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06  1:25 [PATCH 4.19 ONLY v4] arm64: vdso: remove commas between macro name and arguments Jian Cai
2021-05-06 17:43 ` Nathan Chancellor
2021-05-10  8:03   ` Greg KH
2021-05-10  8:28 ` Patch "arm64: vdso: remove commas between macro name and arguments" has been added to the 4.19-stable tree gregkh

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