Skip to content

bpf: Introduce bpf_in_interrupt kfunc

Leon Hwang bpf 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 9 repliesIn review
  2. v12 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* Fix a build error reported by test bot.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: Introduce bpf_in_interrupt kfunckernel/bpf/helpers.c kernel/bpf/verifier.c+20 -06 replies
2/2selftests/bpf: Add case to test bpf_in_interrupt kfunctools/testing/selftests/bpf/progs/irq.c+7 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/2] bpf: Introduce bpf_in_interrupt kfunc

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