bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KP Singh <kpsingh@kernel.org>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Luigi Rizzo <rizzo@iet.unipi.it>, bpf <bpf@vger.kernel.org>,
	will@kernel.org
Subject: Re: arch_prepare_bpf_trampoline() for arm ?
Date: Wed, 24 Feb 2021 22:30:18 +0100	[thread overview]
Message-ID: <CACYkzJ52rAyOWQsKXOOej1=Wh_Fw_S0yBROK7POwbnnccqdvQA@mail.gmail.com> (raw)
In-Reply-To: <6af0ab27-48f1-e389-d2f4-41b3c1db4a18@iogearbox.net>

I checked with Will about it and learnt that ARM64 does support
patching certain instructions (e.g. branch, brk, nops) using
aarch64_insn_patch_text_nosync, it's used in ftrace:

https://elixir.bootlin.com/linux/latest/source/arch/arm64/kernel/ftrace.c#L24

But one has to tolerate that not all CPUs will execute these
instructions until a context synchronization happens due to an
exception or an ISB instruction. But I think we can start
with the same thing that FTrace does?

- KP

On Wed, Feb 24, 2021 at 10:01 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
>
> On 2/24/21 8:54 PM, Luigi Rizzo wrote:
> > I prepared a BPF version of kstats[1]
> > https://github.com/luigirizzo/lr-cstats
> > that uses fentry/fexit hooks to monitor the execution time
> > of a kernel function.
> >
> > I hoped to have it working on ARM64 too, but it looks like
> > arch_prepare_bpf_trampoline() only exists for x86.
> >
> > Is there any outstanding patch for this function on ARM64,
> > or any similar function I could look at to implement it myself ?
>
> Not that I'm currently aware of, arm64 support would definitely be great
> to have. From x86 side, the underlying arch dependency was basically on
> text_poke_bp() to patch instructions on a live kernel. Haven't checked
> recently whether an equivalent exists on arm64 yet, but perhaps Will
> might know.
>
> > [1] kstats is an in-kernel also in the above repo and previously
> > discussed at https://lwn.net/Articles/813303/
>

  parent reply	other threads:[~2021-02-24 21:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 19:54 arch_prepare_bpf_trampoline() for arm ? Luigi Rizzo
2021-02-24 21:01 ` Daniel Borkmann
2021-02-24 21:25   ` Toke Høiland-Jørgensen
2021-02-25  7:59     ` Jean-Philippe Brucker
2021-02-24 21:30   ` KP Singh [this message]
2021-02-24 22:27     ` Daniel Borkmann

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='CACYkzJ52rAyOWQsKXOOej1=Wh_Fw_S0yBROK7POwbnnccqdvQA@mail.gmail.com' \
    --to=kpsingh@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=rizzo@iet.unipi.it \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).