Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Jisheng Zhang <jszhang@kernel.org>
Cc: Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Alexander Potapenko <glider@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	kasan-dev@googlegroups.com
Subject: Re: [PATCH v2 3/5] riscv: support early isa ext and use it to optimize pgtable_l4|l5_enabled
Date: Wed, 9 Sep 2026 12:49:09 +0100	[thread overview]
Message-ID: <aqFHr3BWR0XhxMsv@squawk> (raw)
In-Reply-To: <aqCeaXYJEdW78PMV@xhacker>


[-- Attachment #1.1: Type: text/plain, Size: 2278 bytes --]

On Wed, Sep 09, 2026 at 07:46:49AM +0800, Jisheng Zhang wrote:
> > > This assumes SV48 and SV57 are the only "early" users, but
> > > other ISA ext may also need "early", who knows. So if future some extensions
> > > need the "early", the code is ready, the author doesn't need to care about
> > > the isa filling at all.
> > > 
> > > So I prefer my patch as is. What's your opinion?
> > 
> > We're about decade into the port being merged and this is the only thing
> 
> but the isa extension alternative is not, it was introduced by me three
> years ago. But no matter how many years, 
> 
> > behaving in this way. I don't think the code in this patch is worth it on
> > the off chance that something else comes along. If it does, we can
> 
> this makes sense. Let me cook a new version
> 
> > always fish this implementation back up and use it.
> 
> > 
> > I'd also like to differentiate this code from "needing early", because
> > this is about populating the information early in the extension bitmap,
> > rather than about actually needing the information. There's no advantage
> 
> the code after arch/riscv/mm/init.c but before mmu on needs the
> bitmap informaion when pgtable_l5|l4_enabled() is called (w/o
> USE_EARLY_PGTABLE_LEVELS)

Oh, I must have missed something then, I didn't realise you were
patching the alternatives early - I thought you were skipping them until
the information became available at the normal time. Sorry bout that.

How bad is the damage btw, if you implement pgtable_l5_enabled() as

static __always_inline bool pgtable_l5_enabled(void)
{
	if (riscv_has_extension_likely(RISCV_ISA_EXT_SV57))
		return true;

	return _pgtable_l5_enabled;
}

? It shouldn't be too bad since it should get expanded to stuff like

	if (riscv_has_extension_likely(RISCV_ISA_EXT_SV57) || _pgtable_l5_enabled)

by the compiler. I wonder if you can do this and get rid of
USE_EARLY_PGTABLE_LEVELS entirely, since the unpatched alternative
should return false?

Cheers,
Conor.

(btw, I am kinda unavailable til the 22nd, so sorry if I take some time
to reply here or to a new revision)

> 
> > gained, as far as I can tell, by setting this early and it only makes
> > the code more complicated.
> > 
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-09-09 11:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 15:14 [PATCH v2 0/5] optimize pgtable_l4|l5_enabled Jisheng Zhang
2026-09-07 15:14 ` [PATCH v2 1/5] riscv: remove RISCV_ALTERNATIVE Kconfig option Jisheng Zhang
2026-09-07 15:14 ` [PATCH v2 2/5] riscv: convert pgtable_l4|l5_enabled to inline function Jisheng Zhang
2026-09-07 15:14 ` [PATCH v2 3/5] riscv: support early isa ext and use it to optimize pgtable_l4|l5_enabled Jisheng Zhang
2026-09-07 16:39   ` Conor Dooley
2026-09-08  3:43     ` Jisheng Zhang
2026-09-08 13:00       ` Conor Dooley
2026-09-08 23:46         ` Jisheng Zhang
2026-09-09 11:49           ` Conor Dooley [this message]
2026-09-09 15:01             ` Jisheng Zhang
2026-09-07 15:14 ` [PATCH v2 4/5] riscv: RISCV_ISA_SV48 and RISCV_ISA_SV57 under NONPORTABLE Jisheng Zhang
2026-09-07 16:21   ` Conor Dooley
2026-09-08  3:49     ` Jisheng Zhang
2026-09-08 13:07       ` Conor Dooley
2026-09-08 23:48         ` Jisheng Zhang
2026-09-09 11:08           ` Conor Dooley
2026-09-07 15:14 ` [PATCH v2 5/5] riscv: mm: unexport _pgtable_l4_enabled and _pgtable_l5_enabled Jisheng Zhang

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=aqFHr3BWR0XhxMsv@squawk \
    --to=conor@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=andreyknvl@gmail.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=jszhang@kernel.org \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=vincenzo.frascino@arm.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