From: Matt Turner <mattst88@gmail.com>
To: Magnus Lindholm <linmag7@gmail.com>
Cc: richard.henderson@linaro.org, linux-kernel@vger.kernel.org,
linux-alpha@vger.kernel.org, skhan@linuxfoundation.org,
chenmiao.ku@gmail.com, shorne@gmail.com, corbet@lwn.net,
glaubitz@physik.fu-berlin.de, macro@orcam.me.uk,
macro@redhat.com, mcree@orcon.net.nz, ink@unseen.parts
Subject: Re: [PATCH v2 1/1] alpha: Add support for HAVE_ARCH_JUMP_LABEL
Date: Thu, 8 Oct 2026 16:49:12 -0400 [thread overview]
Message-ID: <CAEdQ38F7RstggOKabd80tr2gofrMMAT0N1agN-RBeybxxJWDVw@mail.gmail.com> (raw)
In-Reply-To: <20260225110548.31431-2-linmag7@gmail.com>
On Wed, Feb 25, 2026 at 12:02 PM Magnus Lindholm <linmag7@gmail.com> wrote:
> Implement static key (jump label) support for Alpha.
Sorry for the slow review. This looks correct to me. I applied it to
your for-next (the arch/alpha/Kconfig hunk needs a trivial rebase) and
it builds cleanly with W=1, CONFIG_JUMP_LABEL=y and
CONFIG_STATIC_KEYS_SELFTEST=y. I have not booted it. A few comments,
none of them blocking:
> + select HAVE_ARCH_JUMP_LABEL
Please keep the select list sorted.
> +static inline void alpha_patch_text(u32 *site, u32 insn)
> +{
> + WRITE_ONCE(*site, insn);
> + flush_icache_range((unsigned long)site, (unsigned long)site + sizeof(*site));
On SMP flush_icache_range() is smp_imb(), so this is one
on_each_cpu() IPI round per patched site. A key with many sites, or
a module load, turns into that many broadcasts. That is fine as a
first version, but it would be worth a follow-up that implements
arch_jump_label_transform_queue()/_apply() (HAVE_JUMP_LABEL_BATCH)
so that a key update does a single imb at the end.
> + if (disp < -(1L << 20) || disp > ((1L << 20) - 1)) {
> + WARN_ON_ONCE(1);
> + disp = 0;
> + }
With disp = 0 we write a branch to the next instruction, so the site
silently behaves as a NOP. I would rather return without patching (or
BUG) than install something that looks valid. The comment about what
other architectures do can go.
> +struct jump_entry {
> + jump_label_t code;
> + jump_label_t target;
> + jump_label_t key;
> +};
Optional: HAVE_ARCH_JUMP_LABEL_RELATIVE would shrink this from 24 to
16 bytes per entry, and the module loader already handles
R_ALPHA_SREL32 and R_ALPHA_SREL64. Fine to leave for later.
Small things:
- <linux/mutex.h> is unused in jump_label.c.
- JUMP_LABEL_NOP_SIZE is unused.
- ALPHA_INSN_NOP has two trailing comments.
- There is a stray double blank line before the include guard.
- The commit message could note that this relies on kernel and
module text being writable (no STRICT_KERNEL_RWX on alpha).
Did you run CONFIG_STATIC_KEYS_SELFTEST, and load and unload a module
that carries static keys?
Reviewed-by: Matt Turner <mattst88@gmail.com>
prev parent reply other threads:[~2026-10-08 20:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 11:02 [PATCH v2 0/1] " Magnus Lindholm
2026-02-25 11:02 ` [PATCH v2 1/1] " Magnus Lindholm
2026-10-08 20:49 ` Matt Turner [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=CAEdQ38F7RstggOKabd80tr2gofrMMAT0N1agN-RBeybxxJWDVw@mail.gmail.com \
--to=mattst88@gmail.com \
--cc=chenmiao.ku@gmail.com \
--cc=corbet@lwn.net \
--cc=glaubitz@physik.fu-berlin.de \
--cc=ink@unseen.parts \
--cc=linmag7@gmail.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=macro@redhat.com \
--cc=mcree@orcon.net.nz \
--cc=richard.henderson@linaro.org \
--cc=shorne@gmail.com \
--cc=skhan@linuxfoundation.org \
/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®