Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Magnus Lindholm" <linmag7@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v4 02/10] sparc64: honor queued spinlock layout in secondary startup
Date: Sun, 18 Oct 2026 14:01:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-176175@kernel.org> (raw)
In-Reply-To: <20261018134738.1016106-3-linmag7@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] sparc64: invalid [%g2 + %lo(prom_entry_lock) + 3] operand in trampoline_64.S
--

commit 3122e42ebc7be814860c71cd7ad49ac4a1876063
Author: Magnus Lindholm <linmag7@gmail.com>

sparc64: honor queued spinlock layout in secondary startup

This commit updates secondary CPU startup in arch/sparc/kernel/trampoline_64.S
to acquire prom_entry_lock as a 32-bit word with CASA and release byte offset 3
with STB to match the big-endian queued spinlock layout.

> diff --git a/arch/sparc/kernel/trampoline_64.S b/arch/sparc/kernel/trampoline_64.S
> index 51bf1eb92a36e..4473347301229 100644
> --- a/arch/sparc/kernel/trampoline_64.S
> +++ b/arch/sparc/kernel/trampoline_64.S

[ ... ]

> @@ -212,7 +222,13 @@ startup_continue:
>  	 nop
>  
>  	sethi		%hi(prom_entry_lock), %g2
> -	stb		%g0, [%g2 + %lo(prom_entry_lock)]
> +	/*
> +	 * Retain explicit assembly release ordering; C unlock relies on TSO.
> +	 * The predicted branch protects Spitfire erratum 51.
> +	 */
> +	ba,pt		%xcc, 2f
> +	 membar		#StoreStore | #LoadStore
> +2:	stb		%g0, [%g2 + %lo(prom_entry_lock) + 3]
>  
>  	ba,pt		%xcc, after_lock_tlb
>  	 nop

[ ... ]

> @@ -389,7 +415,13 @@ after_lock_tlb:
>  	 add		%sp, (2047 + 128), %o0
>  
>  3:	sethi		%hi(prom_entry_lock), %g2
> -	stb		%g0, [%g2 + %lo(prom_entry_lock)]
> +	/*
> +	 * Retain explicit assembly release ordering; C unlock relies on TSO.
> +	 * The predicted branch protects Spitfire erratum 51.
> +	 */
> +	ba,pt		%xcc, 2f
> +	 membar		#StoreStore | #LoadStore
> +2:	stb		%g0, [%g2 + %lo(prom_entry_lock) + 3]

[Severity: Low]
Does this assemble on SPARC64 SMP builds (CONFIG_SPARC64=y && CONFIG_SMP=y)?

In both startup_continue and after_lock_tlb in
arch/sparc/kernel/trampoline_64.S, the unlock sequences use:

    stb %g0, [%g2 + %lo(prom_entry_lock) + 3]

In SPARC assembly syntax (both GNU as and LLVM's SparcAsmParser), %lo(...) is
parsed as the single immediate operand in [rs1 + simm13] and does not accept a
trailing "+ 3" after the closing parenthesis, which causes the assembler to
reject the instruction with "Error: Illegal operands".

Should the byte offset be placed inside the relocation modifier as
[%g2 + %lo(prom_entry_lock + 3)], or should %g2 first be formed with
"or %g2, %lo(prom_entry_lock), %g2" followed by "stb %g0, [%g2 + 3]"?

>  
>  	ldx		[%l0], %g6
>  	ldx		[%g6 + TI_TASK], %g4

титься

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261018134738.1016106-1-linmag7@gmail.com?part=2

  reply	other threads:[~2026-10-18 14:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 13:45 [PATCH v4 00/10] sparc64: add Fujitsu M3000 support Magnus Lindholm
2026-10-18 13:45 ` [PATCH v4 01/10] sparc64: return from the generic clear_page implementation Magnus Lindholm
2026-10-18 13:52   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 02/10] sparc64: honor queued spinlock layout in secondary startup Magnus Lindholm
2026-10-18 14:01   ` sashiko-bot [this message]
2026-10-18 13:45 ` [PATCH v4 03/10] sparc64: avoid huge kernel PUD mappings with small hardware pages Magnus Lindholm
2026-10-18 13:53   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 04/10] sparc64: stop IRQ setup when descriptor allocation fails Magnus Lindholm
2026-10-18 13:52   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 05/10] sparc64: validate Fire register properties before initialization Magnus Lindholm
2026-10-18 13:52   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 06/10] sparc64: retain the DMA segment start across SG entries Magnus Lindholm
2026-10-18 13:52   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 07/10] sparc64: zero newly allocated IOMMU page tables Magnus Lindholm
2026-10-18 13:52   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 08/10] sparc64: add SPARC64 VII CPU, MMU and SMP support Magnus Lindholm
2026-10-18 14:22   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 09/10] sparc64: add M3000 Oberon PCIe support Magnus Lindholm
2026-10-18 13:57   ` sashiko-bot
2026-10-18 13:45 ` [PATCH v4 10/10] hvc: add an M3000 firmware console backend Magnus Lindholm
2026-10-18 14:09   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-176175@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linmag7@gmail.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox