linux/Documentation/hid
Benjamin Tissoires 4b9a3f49f0 HID: bpf: rework how programs are attached and stored in the kernel
Previously, HID-BPF was relying on a bpf tracing program to be notified
when a program was released from userspace. This is error prone, as
LLVM sometimes inline the function and sometimes not.

So instead of messing up with the bpf prog ref count, we can use the
bpf_link concept which actually matches exactly what we want:
- a bpf_link represents the fact that a given program is attached to a
  given HID device
- as long as the bpf_link has fd opened (either by the userspace program
  still being around or by pinning the bpf object in the bpffs), the
  program stays attached to the HID device
- once every user has closed the fd, we get called by
  hid_bpf_link_release() that we no longer have any users, and we can
  disconnect the program to the device in 2 passes: first atomically clear
  the bit saying that the link is active, and then calling release_work in
  a scheduled work item.

This solves entirely the problems of BPF tracing not showing up and is
definitely cleaner.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-18 22:08:38 +01:00
..
amd-sfh-hid.rst Documentation: HID: amd-sfh-hid editing & corrections 2021-01-04 11:50:38 +01:00
hid-alps.rst Documentation: HID: hid-alps editing & corrections 2021-01-04 11:50:38 +01:00
hid-bpf.rst HID: bpf: rework how programs are attached and stored in the kernel 2023-01-18 22:08:38 +01:00
hid-sensor.rst Documentation: HID: hid-sensor editing & corrections 2021-01-04 11:50:38 +01:00
hid-transport.rst Documentation: HID: hid-transport editing & corrections 2021-01-04 11:50:39 +01:00
hiddev.rst Documentation: HID: hiddev editing & corrections 2021-01-04 11:50:38 +01:00
hidraw.rst Documentation: HID: hidraw editing & corrections 2021-01-04 11:50:38 +01:00
index.rst Documentation: add HID-BPF docs 2022-11-15 16:28:40 +01:00
intel-ish-hid.rst Documentation: Add leading slash to some paths 2021-03-31 13:49:19 -06:00
uhid.rst Documentation: HID: uhid editing & corrections 2021-01-04 11:50:39 +01:00