mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aleksa Paunovic <aleksa.paunovic@htecgroup.com>
To: "kmehltretter@gmail.com" <kmehltretter@gmail.com>
Cc: Aleksa Paunovic <aleksa.paunovic@htecgroup.com>,
	"alex@ghiti.fr" <alex@ghiti.fr>,
	"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
	"arikalo@gmail.com" <arikalo@gmail.com>,
	Djordje Todorovic <Djordje.Todorovic@htecgroup.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"mikey@neuling.org" <mikey@neuling.org>,
	"palmer@dabbelt.com" <palmer@dabbelt.com>,
	"pjw@kernel.org" <pjw@kernel.org>,
	"rvishwanathan@mips.com" <rvishwanathan@mips.com>
Subject: Re: [RFT PATCH] riscv: errata: mips: Skip vendor extension lookup during early alternatives
Date: Mon, 19 Oct 2026 13:30:59 +0000	[thread overview]
Message-ID: <98bc2e3f-0cc6-4fed-a7cd-50895552131a@htecgroup.com> (raw)
In-Reply-To: <20261016203052.2026-1-kmehltretter@gmail.com>

Hi Karl,

Thanks for the fix!

On 10/16/26 22:30, Karl Mehltretter wrote:
> When an enabled erratum selects RISCV_ALTERNATIVE_EARLY,
> apply_early_boot_alternatives() calls the MIPS errata callback from
> setup_vm() with the MMU disabled. Each enabled P8700 probe calls
> riscv_isa_vendor_extension_available() before rejecting
> RISCV_ALTERNATIVES_EARLY_BOOT, although neither workaround is applied in
> that stage.
>
> KASAN instrumentation in __riscv_isa_vendor_extension_available() reads
> shadow memory with satp=0. On QEMU's mips-p8700 model this raises a load
> access fault, and the temporary trap vector parks the boot hart. The guest
> prints nothing after the OpenSBI handoff.
>
> Move the existing early-stage rejection before the extension lookup in both
> probes. All later stages retain their existing lookup and patch selection.
>
> Fixes: 0b0ca959d206 ("riscv: errata: Fix the PAUSE Opcode for MIPS P8700")
> Fixes: 2cf0b2992203 ("riscv: Add ERRATA_MIPS_P8700_WFI to replace WFI with mips.pause")
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> Based on RISC-V for-next commit a5ae1bf65cee.
>
> Tested with QEMU 11.0.2, virt/mips-p8700, four harts, and generic KASAN:
>
> - The parent reached the OpenSBI handoff but produced no Linux output in
>   120 seconds.
> - The patched kernel initialized KASAN, brought all four harts online, and
>   powered off cleanly.
> - With a DTB advertising xmipsexectl, all 414 PAUSE and 6 WFI sites in live
>   kernel text contained mips.pause.
>
> QEMU does not model the physical WFI translation erratum or P8700 PAUSE
> behavior. This was not tested on P8700 hardware. Please test with KASAN and
> both P8700 errata enabled.
I tested this on a Boston board configured with a single-core MIPS P8700 CPU. 
The kernel was built with KASAN_INLINE enabled. Reproduced the bug and confirmed
that your fix works. FWIW, I was not able to reproduce it with KASAN_OUTLINE.

Tested-by: Aleksa Paunovic <aleksa.paunovic@htecgroup.com>

Best regards,
Aleksa

      reply	other threads:[~2026-10-19 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 20:30 Karl Mehltretter
2026-10-19 13:30 ` Aleksa Paunovic [this message]

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=98bc2e3f-0cc6-4fed-a7cd-50895552131a@htecgroup.com \
    --to=aleksa.paunovic@htecgroup.com \
    --cc=Djordje.Todorovic@htecgroup.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=arikalo@gmail.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mikey@neuling.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rvishwanathan@mips.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

all inboxes | Powered by JetHome®