summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorJisheng Zhang <jszhang@kernel.org>2026-10-08 23:00:43 +0800
committerPaul Walmsley <pjw@kernel.org>2026-10-08 15:38:58 -0600
commit267bb2b528b574a7f400bf66bb12b11940f26b1d (patch)
tree6da0e60bd54ecff811d441b9cc7ff97eab5916ac /tools/lib/python
parent79113093e9dc3330a05cfd9b9bca1294bc8d2fa8 (diff)
downloadlinux-next-267bb2b528b574a7f400bf66bb12b11940f26b1d.tar.gz
linux-next-267bb2b528b574a7f400bf66bb12b11940f26b1d.zip
riscv: support early isa ext and use it to optimize pgtable_l4|l5_enabled
The pgtable_l4|[l5]_enabled check sits at hot code path, performance is impacted a lot. Since pgtable_l4|[l5]_enabled isn't changed after boot, we can use alternative mechanism to optimize them. So the question is whether we can add RISCV_ISA_EXT_SV48/SV57 and use riscv_has_extension_*() or not. Per [1] and [2], SV48 and SV57 are ISA exensions too. From another side, riscv_has_extension_[un]likely() and other related functions report whether the extension is supported and enabled on the platform. So SV48 and SV57 can be supported with current isa extension alternative mechanism. However, to use it to optimize pgtable_l4|l5_enabled, we have to support the "early" characteristic, I.E besides risc_isa bitmap setting, we need to support appling alternative early before MMU on. After that, use it to optimize pgtable_l4|l5_enabled. For the typical access_ok(addr, 1); before the patch: ... auipc a5,0xb43 lbu a5,100(a5) # ffffffff80b51f68 <pgtable_l5_enabled> bnez a5,ffffffff8000ef46 <foo+0x56> auipc a5,0xb43 lbu a5,91(a5) # ffffffff80b51f69 <pgtable_l4_enabled> beqz a5,ffffffff8000ef5a <foo+0x6a> ... after the patch: These memory load and test branch instructions are replaced with only two j or nop instructions. Initial test lmbench's lat_syscall write on TH1520 platforms shows that the write syscall latency is reduced by about 2.38%. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://github.com/riscv/riscv-isa-manual/blob/main/src/profiles/profiles.adoc [1] Link: https://riscv.atlassian.net/wiki/spaces/HOME/pages/16154732/Ratified+ISA+Extensions [2] Link: https://patch.msgid.link/20261008150045.28905-4-jszhang@kernel.org [pjw@kernel.org: updated to apply] Signed-off-by: Paul Walmsley <pjw@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions