* [PATCH 4.18] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
@ 2018-10-16 21:51 Maciej W. Rozycki
2018-11-11 2:00 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Maciej W. Rozycki @ 2018-10-16 21:51 UTC (permalink / raw)
To: stable; +Cc: Ralf Baechle, Paul Burton
Fix a commit 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for
small_memset") regression and remove assembly warnings:
arch/mips/lib/memset.S: Assembler messages:
arch/mips/lib/memset.S:243: Warning: Macro instruction expanded into multiple instructions in a branch delay slot
triggering with the CPU_DADDI_WORKAROUNDS option set and this code:
PTR_SUBU a2, t1, a0
jr ra
PTR_ADDIU a2, 1
This is because with that option in place the DADDIU instruction, which
the PTR_ADDIU CPP macro expands to, becomes a GAS macro, which in turn
expands to an LI/DADDU (or actually ADDIU/DADDU) sequence:
13c: 01a4302f dsubu a2,t1,a0
140: 03e00008 jr ra
144: 24010001 li at,1
148: 00c1302d daddu a2,a2,at
...
Correct this by switching off the `noreorder' assembly mode and letting
GAS schedule this jump's delay slot, as there is nothing special about
it that would require manual scheduling. With this change in place
correct code is produced:
13c: 01a4302f dsubu a2,t1,a0
140: 24010001 li at,1
144: 03e00008 jr ra
148: 00c1302d daddu a2,a2,at
...
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Fixes: 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for small_memset")
Cc: stable@vger.kernel.org # 4.17+
---
Hi,
This is a version (one I originally made actually) of commit 148b9aba99e0
for 4.18-stable and before. No functional changes. Please apply.
Maciej
---
arch/mips/lib/memset.S | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
linux-mips-memset-jr-ra-nodaddi-fix.patch
Index: linux-20180812-4maxp64-defconfig/arch/mips/lib/memset.S
===================================================================
--- linux-20180812-4maxp64-defconfig.orig/arch/mips/lib/memset.S
+++ linux-20180812-4maxp64-defconfig/arch/mips/lib/memset.S
@@ -261,9 +261,11 @@
nop
.Lsmall_fixup\@:
+ .set reorder
PTR_SUBU a2, t1, a0
+ PTR_ADDIU a2, 1
jr ra
- PTR_ADDIU a2, 1
+ .set noreorder
.endm
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 4.18] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
2018-10-16 21:51 [PATCH 4.18] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression Maciej W. Rozycki
@ 2018-11-11 2:00 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2018-11-11 2:00 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: stable, Ralf Baechle, Paul Burton
On Tue, Oct 16, 2018 at 10:51:10PM +0100, Maciej W. Rozycki wrote:
> Fix a commit 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for
> small_memset") regression and remove assembly warnings:
>
> arch/mips/lib/memset.S: Assembler messages:
> arch/mips/lib/memset.S:243: Warning: Macro instruction expanded into multiple instructions in a branch delay slot
>
> triggering with the CPU_DADDI_WORKAROUNDS option set and this code:
>
> PTR_SUBU a2, t1, a0
> jr ra
> PTR_ADDIU a2, 1
>
> This is because with that option in place the DADDIU instruction, which
> the PTR_ADDIU CPP macro expands to, becomes a GAS macro, which in turn
> expands to an LI/DADDU (or actually ADDIU/DADDU) sequence:
>
> 13c: 01a4302f dsubu a2,t1,a0
> 140: 03e00008 jr ra
> 144: 24010001 li at,1
> 148: 00c1302d daddu a2,a2,at
> ...
>
> Correct this by switching off the `noreorder' assembly mode and letting
> GAS schedule this jump's delay slot, as there is nothing special about
> it that would require manual scheduling. With this change in place
> correct code is produced:
>
> 13c: 01a4302f dsubu a2,t1,a0
> 140: 24010001 li at,1
> 144: 03e00008 jr ra
> 148: 00c1302d daddu a2,a2,at
> ...
>
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> Fixes: 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for small_memset")
> Cc: stable@vger.kernel.org # 4.17+
> ---
> Hi,
>
> This is a version (one I originally made actually) of commit 148b9aba99e0
> for 4.18-stable and before. No functional changes. Please apply.
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-11 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-16 21:51 [PATCH 4.18] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression Maciej W. Rozycki
2018-11-11 2:00 ` Greg KH
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.