[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjiJvGW70_A93oN_f48J0pn4MeVbWVmBPBiTh2XiSpwpg@mail.gmail.com>
Date: Sat, 8 Jun 2024 13:55:04 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, linux-arch <linux-arch@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] x86: add 'runtime constant' infrastructure
On Sat, 8 Jun 2024 at 12:43, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> Needs more comments and testing, but it works, and has a generic
> fallback for architectures that don't support it.
.. and here is the TOTALLY UNTESTED patch to implement the arm64
version of runtime constants.
It almost certainly does not work. I'm too scared to test it. I may
start to recognize arm64 instructions, but rewriting them on the fly
is another thing entirely, and I'm fairly sure this needs an I$ sync
and probably modifying the instructions using another address even
during early boot.
So this is a "throw it over the fence to the actually competent arm64
people" patch.
Catalin, Will? This depends on the infrastructure that I added in
https://lore.kernel.org/all/20240608193504.429644-2-torvalds@linux-foundation.org/
which is actually tested on the x86-64 side.
I did test that the code generation looks superficially sane, and this generates
mov x1, #0xcdef
movk x1, #0x89ab, lsl #16
movk x1, #0x4567, lsl #32
movk x1, #0x123, lsl #48
...
lsr w0, w25, #12
ldr x0, [x1, x0, lsl #3]
for the dcache hash lookup (those constants are obviously the ones
that get rewritten after the hash table has been allocated and the
size becomes fixed).
And honestly, I may have gotten even the simple part of instruction
rewriting wrong (ie maybe I'm filling in the wrong bit locations - I'm
reading the architecture manual, not actually *testing* anything).
Think of this patch mostly as a "look, adding another architecture
isn't *that* hard - even if the constant value is spread out in the
instructions".
Linus
View attachment "0001-arm64-add-runtime-const-support.patch" of type "text/x-patch" (3122 bytes)
Powered by blists - more mailing lists