Re: [patch] perf_event_open.2: Document the PERF_EVENT_IOC_QUERY_BPF ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 7/10/18 10:14 AM, Vince Weaver wrote:

The PERF_EVENT_IOC_QUERY_BPF ioctl was introduced in Linux 4.16.

Signed-off-by: Vince Weaver <vincent.weaver@xxxxxxxxx>

diff --git a/man2/perf_event_open.2 b/man2/perf_event_open.2
index b598acf17..a464e95a2 100644
--- a/man2/perf_event_open.2
+++ b/man2/perf_event_open.2
@@ -2945,6 +2945,47 @@ even though the ring-buffer remains empty.
  The argument is an unsigned 32-bit integer.
  A nonzero value pauses the ring-buffer, while a
  zero value resumes the ring-buffer.
+.TP
+.BR PERF_EVENT_IOC_QUERY_BPF " (since Linux 4.16)"
+.\" commit f371b304f12e31fe30207c41ca7754564e0ea4dc
+This allows querying which Berkeley Packet Filter (BPF)
+programs are attached to an existing kprobe tracepoint.

The query is not limited to kprobe tracepoint. It can be done
on ukprobe, tracepoint and syscall trace event. The underlying
PMU are "tracepoint", "kprobe" and "uprobe".

So, maybe "kprobe tracepoint" => "kprobe, uprobe, or tracepoint"?

+You can only attach one BPF program per event, but you can
+have multiple events attached to a tracepoint.
+Querying this value on one tracepoint event returns the id
+of all BPF programs in all events attached to the tracepoint.
+You need
+.B CAP_SYS_ADMIN
+privileges to use this ioctl.
+.IP
+The argument is a pointer to a structure
+.in +4n
+.EX
+struct perf_event_query_bpf {
+    __u32    ids_len;
+    __u32    prog_cnt;
+    __u32    ids[0];
+};
+.EE
+.IP
+The
+.I ids_len
+field indicates the number of ids that can fit in the provided
+.I ids
+array.
+The
+.I prog_cnt
+value is filled in by the kernel with the number of attached
+BPF programs.
+The
+.I ids
+array is filled with the id of each attached BPF program.
+If there are more programs than will fit in the array, then the
+kernel will return
+.B ENOSPC
+and
+.I ids_len
+will indicate the number of program IDs that were successfully copied.
  .SS Using prctl(2)
  A process can enable or disable all currently open event groups
  using the

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux