* [PATCH] MIPS: Ingenic: Allow assembler reordering in the XBurst secondary entry
@ 2026-11-20 5:08 Florian Fainelli
2026-11-20 14:06 ` Maciej W. Rozycki
2026-11-20 15:00 ` David Laight
0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2026-11-20 5:08 UTC (permalink / raw)
To: linux-mips
Cc: Florian Fainelli, Maciej W. Rozycki, Paul Cercueil,
Thomas Bogendoerfer, open list
Remove .set noreorder and the two explicit delay-slot nops from the
XBurst secondary CPU reset entry. GNU as emits identical reset-entry
instructions with reordering enabled in both the CI20 and generic
MIPS64r2 Ingenic SMP builds.
On CI20, two baseline and three updated cold boots brought both CPUs
online. Each boot passed the CPU affinity check and 100 cross-core
idle-wakeup round trips in each direction. Codex assisted with the
assembly comparison and hardware test campaign.
Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Thomas, feel free to fixup into "MIPS: Ingenic: Add XBurst SMP support"
if that is simpler. Thanks!
arch/mips/ingenic/ingenic-smp-entry.S | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/mips/ingenic/ingenic-smp-entry.S b/arch/mips/ingenic/ingenic-smp-entry.S
index 290e23c65707..d6aa4b4b1a17 100644
--- a/arch/mips/ingenic/ingenic-smp-entry.S
+++ b/arch/mips/ingenic/ingenic-smp-entry.S
@@ -16,7 +16,6 @@
/* The CP0 REIM register only stores the upper 16 address bits. */
.section .text.smp-entry, "ax"
.balign 0x10000
- .set noreorder
LEAF(xburst_secondary_cpu_entry)
mtc0 zero, CP0_CAUSE
li t0, ST0_CU0
@@ -32,7 +31,6 @@ LEAF(xburst_secondary_cpu_entry)
cache Index_Store_Tag_D, 0(t0)
addiu t0, t0, CACHE_LINESIZE
bne t0, t1, 1b
- nop
mfc0 t0, CP0_CONFIG
li t1, ~CONF_CM_CMASK
@@ -50,5 +48,4 @@ LEAF(xburst_secondary_cpu_entry)
PTR_LA t0, smp_bootstrap
jr t0
- nop
END(xburst_secondary_cpu_entry)
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Ingenic: Allow assembler reordering in the XBurst secondary entry
2026-11-20 5:08 [PATCH] MIPS: Ingenic: Allow assembler reordering in the XBurst secondary entry Florian Fainelli
@ 2026-11-20 14:06 ` Maciej W. Rozycki
2026-11-20 15:00 ` David Laight
1 sibling, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2026-11-20 14:06 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, Paul Cercueil, Thomas Bogendoerfer, open list
On Thu, 19 Nov 2026, Florian Fainelli wrote:
> Remove .set noreorder and the two explicit delay-slot nops from the
> XBurst secondary CPU reset entry. GNU as emits identical reset-entry
> instructions with reordering enabled in both the CI20 and generic
> MIPS64r2 Ingenic SMP builds.
>
> On CI20, two baseline and three updated cold boots brought both CPUs
> online. Each boot passed the CPU affinity check and 100 cross-core
> idle-wakeup round trips in each direction. Codex assisted with the
> assembly comparison and hardware test campaign.
>
> Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Thomas, feel free to fixup into "MIPS: Ingenic: Add XBurst SMP support"
> if that is simpler. Thanks!
Have you compared objects produced to be the same with and without the
change applied? If they are, then:
Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk>
Thanks for this follow-up cleanup.
Maciej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Ingenic: Allow assembler reordering in the XBurst secondary entry
2026-11-20 5:08 [PATCH] MIPS: Ingenic: Allow assembler reordering in the XBurst secondary entry Florian Fainelli
2026-11-20 14:06 ` Maciej W. Rozycki
@ 2026-11-20 15:00 ` David Laight
2026-11-20 16:14 ` Maciej W. Rozycki
1 sibling, 1 reply; 4+ messages in thread
From: David Laight @ 2026-11-20 15:00 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, Maciej W. Rozycki, Paul Cercueil, Thomas Bogendoerfer,
open list
On Thu, 19 Nov 2026 21:08:26 -0800
Florian Fainelli <f.fainelli@gmail.com> wrote:
> Remove .set noreorder and the two explicit delay-slot nops from the
> XBurst secondary CPU reset entry. GNU as emits identical reset-entry
> instructions with reordering enabled in both the CI20 and generic
> MIPS64r2 Ingenic SMP builds.
If the ordering actually mattered then the fact that the current toolchain
doesn't break thinks isn't enough to guarantee that a future version
won't find some way of generating invalid code.
The explicit nop in the delay slots might even be there because there
is another reason for the .set noreorder.
If nothing else the commit message is misleading.
David
>
> On CI20, two baseline and three updated cold boots brought both CPUs
> online. Each boot passed the CPU affinity check and 100 cross-core
> idle-wakeup round trips in each direction. Codex assisted with the
> assembly comparison and hardware test campaign.
>
> Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Thomas, feel free to fixup into "MIPS: Ingenic: Add XBurst SMP support"
> if that is simpler. Thanks!
>
> arch/mips/ingenic/ingenic-smp-entry.S | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/arch/mips/ingenic/ingenic-smp-entry.S b/arch/mips/ingenic/ingenic-smp-entry.S
> index 290e23c65707..d6aa4b4b1a17 100644
> --- a/arch/mips/ingenic/ingenic-smp-entry.S
> +++ b/arch/mips/ingenic/ingenic-smp-entry.S
> @@ -16,7 +16,6 @@
> /* The CP0 REIM register only stores the upper 16 address bits. */
> .section .text.smp-entry, "ax"
> .balign 0x10000
> - .set noreorder
> LEAF(xburst_secondary_cpu_entry)
> mtc0 zero, CP0_CAUSE
> li t0, ST0_CU0
> @@ -32,7 +31,6 @@ LEAF(xburst_secondary_cpu_entry)
> cache Index_Store_Tag_D, 0(t0)
> addiu t0, t0, CACHE_LINESIZE
> bne t0, t1, 1b
> - nop
>
> mfc0 t0, CP0_CONFIG
> li t1, ~CONF_CM_CMASK
> @@ -50,5 +48,4 @@ LEAF(xburst_secondary_cpu_entry)
>
> PTR_LA t0, smp_bootstrap
> jr t0
> - nop
> END(xburst_secondary_cpu_entry)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Ingenic: Allow assembler reordering in the XBurst secondary entry
2026-11-20 15:00 ` David Laight
@ 2026-11-20 16:14 ` Maciej W. Rozycki
0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2026-11-20 16:14 UTC (permalink / raw)
To: David Laight
Cc: Florian Fainelli, linux-mips, Paul Cercueil, Thomas Bogendoerfer,
open list
On Fri, 20 Nov 2026, David Laight wrote:
> > Remove .set noreorder and the two explicit delay-slot nops from the
> > XBurst secondary CPU reset entry. GNU as emits identical reset-entry
> > instructions with reordering enabled in both the CI20 and generic
> > MIPS64r2 Ingenic SMP builds.
>
> If the ordering actually mattered then the fact that the current toolchain
> doesn't break thinks isn't enough to guarantee that a future version
> won't find some way of generating invalid code.
Nope, unless there is an explicit need to prevent GAS from ensuring that
pipeline hazards are taken care of user code is expected to use the
standard `reorder' mode.
Legitimate examples are scheduling a branch delay slot when there is a
data dependency (the vast majority of cases, e.g. writing to a register
the branch reads from) or when you do want to exploit a pipeline hazard
for some reason (RFE in a branch delay slot comes to mind).
Otherwise the assembler ensures code semantics as written. If that is
not the case, then it is a bug in the tool that needs to be fixed. You
can't write code in a specific way "because there may be a bug in a future
version of a tool that could trigger if I wrote this differently," that's
ridiculous.
From experience people tend to use `noreorder' when there's a missed
optimisation opportunity and they can't be bothered to file a bug against
GAS. Or they take code produced by a compiler and tweak it by hand not
bothering to rewrite it for `reorder' mode. This has caused real damage
and hard to chase bugs.
> The explicit nop in the delay slots might even be there because there
> is another reason for the .set noreorder.
Then `noreorder' blocks are supposed to wrap actual instruction sequences
that require manual scheduling and not the whole function, and the reason
for the individual `noreorder' blocks needs to be documented within the
code.
Conversely I had to fix code many times when someone used `noreorder'
needlessly and didn't take pipeline hazards into account of processors
they didn't care of. That's just the wrong use of the tool.
And yes, I did put a lot of effort into GAS to get many missed scheduling
optimisations fixed. Most recently over the last weekend, concerning the
HI/LO accumulator registers. At worst you'll get an extraneous NOP or a
couple. In the vast majority of cases this is not a big deal and in all
cases it's better than an unsatisfied pipeline hazard.
Maciej
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-20 16:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 5:08 [PATCH] MIPS: Ingenic: Allow assembler reordering in the XBurst secondary entry Florian Fainelli
2026-11-20 14:06 ` Maciej W. Rozycki
2026-11-20 15:00 ` David Laight
2026-11-20 16:14 ` Maciej W. Rozycki
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.