Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@kernel.org>
To: "Akari Tsuyukusa" <akkun11.open@gmail.com>
Cc: "Nick Desaulniers" <ndesaulniers@google.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	"Yingjoe Chen" <yingjoe.chen@mediatek.com>,
	"moderated list:ARM SUB-ARCHITECTURES"
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/Mediatek SoC support"
	<linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	"open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b"
	<llvm@lists.linux.dev>,
	stable@vger.kernel.org, "Ard Biesheuvel" <ardb@google.com>
Subject: Re: [PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang
Date: Sun, 26 Jul 2026 22:00:35 +0200	[thread overview]
Message-ID: <c4e9a566-baf7-4df6-b874-30c68a5c67f6@app.fastmail.com> (raw)
In-Reply-To: <amWfjDyn0jrnIf63@buffalo-ssd>

On Sun, Jul 26, 2026, at 08:08, Akari Tsuyukusa wrote:
> On Thu, Jul 23, 2026 at 11:53:14AM +0200, Arnd Bergmann wrote:
>> On Thu, Jul 23, 2026, at 11:15, Akari Tsuyukusa wrote:
>> > Can you send your fix as PATCH?
>> > I think your approach is better than mine.
>> 
>> I think we should wait for the llvm issue to be resolved first, to
>> document whether this is considered a bug in the kernel or the
>> assembler, and to see if any other kernel code may be affected
>> by the same thing.
>> 
>> Looking around other .S files, I see the same
>> pattern in stext(), cpu_resume_arm(), mcpm_entry_point(),
>> all of which start in arm mode but end in thumb.
>
> It's a LLVM bug.
> The LLVM assembler source code explicitly mentions this limitation:
>
>   ///
>   /// FIXME: there is a corner case where the state is changed in between the
>   /// label definition and the .type directive. This is not expected to occur
>   /// in practice, and handling it would require the backend to track IsThumb
>   /// for every label.
>   ///
>
> https://github.com/llvm/llvm-project/pull/211641/changes
>
> However, it will take some time for an LLVM release with this fix to
> become available. Since LLVM (>=15.0.0) is an officially supported
> toolchain, leaving the kernel with bug(s?) on supported LLVM versions
> isn't ideal.
> I think we should apply a workaround in the kernel for now.

Working around it in the kernel is fine, but I'd prefer to wait for
the fix to first get merged into llvm so we can reference the
bugfix in the kernel commit.

A trivial workaround would be to have a dependency in
CONFIG_THUMB2_KERNEL for !AS_IS_LLVM||CLANG_VERSION>=24
(or whatever version), though fixing the .S code in all known
instances is probably better if we want to ever have a chance
to require IAS on all architectures.

     Arnd


  reply	other threads:[~2026-07-26 20:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 17:24 [PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang Akari Tsuyukusa
2026-07-22 21:03 ` Nick Desaulniers
2026-07-23  4:45   ` Roman Vivchar
2026-07-23  9:15   ` Akari Tsuyukusa
2026-07-23  9:53     ` Arnd Bergmann
2026-07-26  6:08       ` Akari Tsuyukusa
2026-07-26 20:00         ` Arnd Bergmann [this message]
2026-08-07 18:52           ` Nathan Chancellor

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=c4e9a566-baf7-4df6-b874-30c68a5c67f6@app.fastmail.com \
    --to=arnd@kernel.org \
    --cc=akkun11.open@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=ardb@google.com \
    --cc=justinstitt@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=llvm@lists.linux.dev \
    --cc=matthias.bgg@gmail.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=stable@vger.kernel.org \
    --cc=yingjoe.chen@mediatek.com \
    /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