Skip to content

bpftool: Allow to select sections and filter probes #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions tools/bpf/bpftool/Documentation/bpftool-feature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,42 @@ SYNOPSIS
FEATURE COMMANDS
================

| **bpftool** **feature probe** [*COMPONENT*] [**macros** [**prefix** *PREFIX*]]
| **bpftool** **feature probe** [*COMPONENT*] [**section** [*SECTION*]] [**filter_in** *PATTERN*] [**filter_out** *PATTERN*] [**macros** [**prefix** *PREFIX*]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If section is passed, then SECTION is not optional. We should have [**section** *SECTION*] instead of [**section** [*SECTION*]] I think? (Here and below)

| **bpftool** **feature help**
|
| *COMPONENT* := { **kernel** | **dev** *NAME* }
| *SECTION* := { **system_config** | **syscall_config** | **program_types** | **map_types** | **helpers** | **misc** }

DESCRIPTION
===========
**bpftool feature probe** [**kernel**] [**macros** [**prefix** *PREFIX*]]
**bpftool feature probe** [**kernel**] [**section** [*SECTION*]] [**filter_in** *PATTERN*] [**filter_out** *PATTERN*] [**macros** [**prefix** *PREFIX*]]
Probe the running kernel and dump a number of eBPF-related
parameters, such as availability of the **bpf()** system call,
JIT status, eBPF program types availability, eBPF helper
functions availability, and more.

If the **section** keyword is passed, only the specified
probes section will be checked and printed. The only section
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/section whis is probed/probe which is performed/ ?

which is always going to be probed is **syscall_config**,
but if the other section was provided as an argument,
**syscall_config** check will perform silently without
printing the result and bpftool will exit if the bpf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/bpf()/**bpf()**/

(here and below)

syscall is not abailable (because in that case performing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/abailable/available/

other checks relying on the bpf() system call does not make
sense).

If the **filter_in** keyword is passed, only checks with
names matching the given *PATTERN* are going the be printed
and performed.

If the **filter_out** keyword is passed, checks with names
matching the given *PATTERN* are not going to be printed and
performed.

**filter_in** is executed before **filter_out** which means
that **filter_out** is always applied only on probes
selected by **filter_in** if both arguments are used together.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to the **regex**\ (7) man page for details on the syntax for *PATTERN*.


If the **macros** keyword (but not the **-j** option) is
passed, a subset of the output is dumped as a list of
**#define** macros that are ready to be included in a C
Expand All @@ -48,12 +71,13 @@ DESCRIPTION
**bpf_trace_printk**\ () or **bpf_probe_write_user**\ ()) may
print warnings to kernel logs.

**bpftool feature probe dev** *NAME* [**macros** [**prefix** *PREFIX*]]
**bpftool feature probe dev** *NAME* [**section** [*SECTION*]] [**filter_in** *PATTERN*] [**filter_out** *PATTERN*] [**macros** [**prefix** *PREFIX*]]
Probe network device for supported eBPF features and dump
results to the console.

The two keywords **macros** and **prefix** have the same
role as when probing the kernel.
The keywords **section**, **filter_in**, **filter_out**,
**macros** and **prefix** have the same role as when probing
the kernel.

**bpftool feature help**
Print short help message.
Expand Down
Loading