From: Leon Hwang <leon.hwang@linux.dev>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, leon.hwang@linux.dev,
kernel-patches-bot@fb.com
Subject: [PATCH bpf-next v2 0/2] bpf: Introduce bpf_in_interrupt kfunc
Date: Mon, 25 Aug 2025 21:14:59 +0800 [thread overview]
Message-ID: <20250825131502.54269-1-leon.hwang@linux.dev> (raw)
Filtering pid_tgid is meaningless when the current task is preempted by
an interrupt.
To address this, introduce the bpf_in_interrupt kfunc, which allows BPF
programs to determine whether they are executing in interrupt context.
Internally, bpf_in_interrupt() is a thin wrapper around in_interrupt().
It is marked as fastcall function.
On x86_64, it is inlined for efficiency.
Changes:
v1 -> v2:
* Fix a build error reported by test bot.
Leon Hwang (2):
bpf: Introduce bpf_in_interrupt kfunc
selftests/bpf: Add case to test bpf_in_interrupt kfunc
kernel/bpf/helpers.c | 9 +++++++++
kernel/bpf/verifier.c | 11 +++++++++++
tools/testing/selftests/bpf/progs/irq.c | 7 +++++++
3 files changed, 27 insertions(+)
--
2.50.1
next reply other threads:[~2025-08-25 13:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 13:14 Leon Hwang [this message]
2025-08-25 13:15 ` [PATCH bpf-next v2 1/2] bpf: Introduce bpf_in_interrupt kfunc Leon Hwang
2025-08-25 15:17 ` Alexei Starovoitov
2025-08-26 3:00 ` Leon Hwang
2025-08-26 22:18 ` Alexei Starovoitov
2025-09-01 15:12 ` Leon Hwang
2025-09-02 2:29 ` Alexei Starovoitov
2025-09-03 5:22 ` Leon Hwang
2025-08-25 13:15 ` [PATCH bpf-next v2 2/2] selftests/bpf: Add case to test " Leon Hwang
2025-08-25 17:26 ` Eduard Zingerman
2025-08-26 3:05 ` Leon Hwang
2025-08-26 22:31 ` Eduard Zingerman
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=20250825131502.54269-1-leon.hwang@linux.dev \
--to=leon.hwang@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-patches-bot@fb.com \
--cc=martin.lau@linux.dev \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.