* [PATCH v4] mips: Do not include hi and lo in clobber list for R6
@ 2021-04-20 21:12 Sudip Mukherjee
2021-04-23 11:51 ` Thomas Bogendoerfer
2021-04-25 8:44 ` Romain Naour
0 siblings, 2 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2021-04-20 21:12 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: linux-kernel, linux-mips, Romain Naour, Sudip Mukherjee
From: Romain Naour <romain.naour@gmail.com>
From [1]
"GCC 10 (PR 91233) won't silently allow registers that are not
architecturally available to be present in the clobber list anymore,
resulting in build failure for mips*r6 targets in form of:
...
.../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target
146 | __asm__ volatile ( \
| ^~~~~~~
This is because base R6 ISA doesn't define hi and lo registers w/o DSP
extension. This patch provides the alternative clobber list for r6 targets
that won't include those registers."
Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to
build for mips r6 cpus with gcc 10 for the same reason as glibc.
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8
[2] '24640f233b46 ("mips: Add support for generic vDSO")'
Signed-off-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
v4: [sudip] added macro VDSO_SYSCALL_CLOBBERS and fix checkpatch errors with commit message.
v3 Avoid duplicate code (Maciej W. Rozycki)
v2 use MIPS_ISA_REV instead of __mips_isa_rev (Alexander Lobakin)
I have reused the original patch by Romain and have retained his s-o-b
and author name as he is the original author of this patch. I have just
added the macro. Build tested with gcc-10.3.1 and gcc-9.3.0.
arch/mips/include/asm/vdso/gettimeofday.h | 26 ++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h
index 2203e2d0ae2a..44a45f3fa4b0 100644
--- a/arch/mips/include/asm/vdso/gettimeofday.h
+++ b/arch/mips/include/asm/vdso/gettimeofday.h
@@ -20,6 +20,12 @@
#define VDSO_HAS_CLOCK_GETRES 1
+#if MIPS_ISA_REV < 6
+#define VDSO_SYSCALL_CLOBBERS "hi", "lo",
+#else
+#define VDSO_SYSCALL_CLOBBERS
+#endif
+
static __always_inline long gettimeofday_fallback(
struct __kernel_old_timeval *_tv,
struct timezone *_tz)
@@ -35,7 +41,9 @@ static __always_inline long gettimeofday_fallback(
: "=r" (ret), "=r" (error)
: "r" (tv), "r" (tz), "r" (nr)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+ "$14", "$15", "$24", "$25",
+ VDSO_SYSCALL_CLOBBERS
+ "memory");
return error ? -ret : ret;
}
@@ -59,7 +67,9 @@ static __always_inline long clock_gettime_fallback(
: "=r" (ret), "=r" (error)
: "r" (clkid), "r" (ts), "r" (nr)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+ "$14", "$15", "$24", "$25",
+ VDSO_SYSCALL_CLOBBERS
+ "memory");
return error ? -ret : ret;
}
@@ -83,7 +93,9 @@ static __always_inline int clock_getres_fallback(
: "=r" (ret), "=r" (error)
: "r" (clkid), "r" (ts), "r" (nr)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+ "$14", "$15", "$24", "$25",
+ VDSO_SYSCALL_CLOBBERS
+ "memory");
return error ? -ret : ret;
}
@@ -105,7 +117,9 @@ static __always_inline long clock_gettime32_fallback(
: "=r" (ret), "=r" (error)
: "r" (clkid), "r" (ts), "r" (nr)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+ "$14", "$15", "$24", "$25",
+ VDSO_SYSCALL_CLOBBERS
+ "memory");
return error ? -ret : ret;
}
@@ -125,7 +139,9 @@ static __always_inline int clock_getres32_fallback(
: "=r" (ret), "=r" (error)
: "r" (clkid), "r" (ts), "r" (nr)
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+ "$14", "$15", "$24", "$25",
+ VDSO_SYSCALL_CLOBBERS
+ "memory");
return error ? -ret : ret;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4] mips: Do not include hi and lo in clobber list for R6
2021-04-20 21:12 [PATCH v4] mips: Do not include hi and lo in clobber list for R6 Sudip Mukherjee
@ 2021-04-23 11:51 ` Thomas Bogendoerfer
2021-04-25 8:44 ` Romain Naour
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2021-04-23 11:51 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: linux-kernel, linux-mips, Romain Naour
On Tue, Apr 20, 2021 at 10:12:10PM +0100, Sudip Mukherjee wrote:
> From: Romain Naour <romain.naour@gmail.com>
>
> >From [1]
> "GCC 10 (PR 91233) won't silently allow registers that are not
> architecturally available to be present in the clobber list anymore,
> resulting in build failure for mips*r6 targets in form of:
> ...
> .../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target
> 146 | __asm__ volatile ( \
> | ^~~~~~~
>
> This is because base R6 ISA doesn't define hi and lo registers w/o DSP
> extension. This patch provides the alternative clobber list for r6 targets
> that won't include those registers."
>
> Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to
> build for mips r6 cpus with gcc 10 for the same reason as glibc.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8
> [2] '24640f233b46 ("mips: Add support for generic vDSO")'
>
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>
> v4: [sudip] added macro VDSO_SYSCALL_CLOBBERS and fix checkpatch errors with commit message.
> v3 Avoid duplicate code (Maciej W. Rozycki)
> v2 use MIPS_ISA_REV instead of __mips_isa_rev (Alexander Lobakin)
>
> I have reused the original patch by Romain and have retained his s-o-b
> and author name as he is the original author of this patch. I have just
> added the macro. Build tested with gcc-10.3.1 and gcc-9.3.0.
>
> arch/mips/include/asm/vdso/gettimeofday.h | 26 ++++++++++++++++++-----
> 1 file changed, 21 insertions(+), 5 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4] mips: Do not include hi and lo in clobber list for R6
2021-04-20 21:12 [PATCH v4] mips: Do not include hi and lo in clobber list for R6 Sudip Mukherjee
2021-04-23 11:51 ` Thomas Bogendoerfer
@ 2021-04-25 8:44 ` Romain Naour
1 sibling, 0 replies; 3+ messages in thread
From: Romain Naour @ 2021-04-25 8:44 UTC (permalink / raw)
To: Sudip Mukherjee, Thomas Bogendoerfer; +Cc: linux-kernel, linux-mips
Hi Sudip, All,
Le 20/04/2021 à 23:12, Sudip Mukherjee a écrit :
> From: Romain Naour <romain.naour@gmail.com>
>
> From [1]
> "GCC 10 (PR 91233) won't silently allow registers that are not
> architecturally available to be present in the clobber list anymore,
> resulting in build failure for mips*r6 targets in form of:
> ...
> .../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target
> 146 | __asm__ volatile ( \
> | ^~~~~~~
>
> This is because base R6 ISA doesn't define hi and lo registers w/o DSP
> extension. This patch provides the alternative clobber list for r6 targets
> that won't include those registers."
>
> Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to
> build for mips r6 cpus with gcc 10 for the same reason as glibc.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8
> [2] '24640f233b46 ("mips: Add support for generic vDSO")'
>
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>
> v4: [sudip] added macro VDSO_SYSCALL_CLOBBERS and fix checkpatch errors with commit message.
> v3 Avoid duplicate code (Maciej W. Rozycki)
> v2 use MIPS_ISA_REV instead of __mips_isa_rev (Alexander Lobakin)
>
> I have reused the original patch by Romain and have retained his s-o-b
> and author name as he is the original author of this patch. I have just
> added the macro. Build tested with gcc-10.3.1 and gcc-9.3.0.
>
Thanks for the rework!
Best regards,
Romain
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-25 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-20 21:12 [PATCH v4] mips: Do not include hi and lo in clobber list for R6 Sudip Mukherjee
2021-04-23 11:51 ` Thomas Bogendoerfer
2021-04-25 8:44 ` Romain Naour
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox