All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: Introduce bpf_in_interrupt kfunc
@ 2025-08-22 14:17 Leon Hwang
  2025-08-22 14:17 ` [PATCH bpf-next 1/2] " Leon Hwang
  2025-08-22 14:17 ` [PATCH bpf-next 2/2] selftests/bpf: Add case to test " Leon Hwang
  0 siblings, 2 replies; 4+ messages in thread
From: Leon Hwang @ 2025-08-22 14:17 UTC (permalink / raw)
  To: bpf
  Cc: ast, andrii, daniel, martin.lau, eddyz87, song, yonghong.song,
	leon.hwang, kernel-patches-bot

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.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-23  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 14:17 [PATCH bpf-next 0/2] bpf: Introduce bpf_in_interrupt kfunc Leon Hwang
2025-08-22 14:17 ` [PATCH bpf-next 1/2] " Leon Hwang
2025-08-23  8:24   ` kernel test robot
2025-08-22 14:17 ` [PATCH bpf-next 2/2] selftests/bpf: Add case to test " Leon Hwang

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.