18c2ecf20Sopenharmony_ci================
28c2ecf20Sopenharmony_cibpftool-prog
38c2ecf20Sopenharmony_ci================
48c2ecf20Sopenharmony_ci-------------------------------------------------------------------------------
58c2ecf20Sopenharmony_citool for inspection and simple manipulation of eBPF progs
68c2ecf20Sopenharmony_ci-------------------------------------------------------------------------------
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci:Manual section: 8
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciSYNOPSIS
118c2ecf20Sopenharmony_ci========
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci	**bpftool** [*OPTIONS*] **prog** *COMMAND*
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci	*OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-f** | **--bpffs** } }
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	*COMMANDS* :=
188c2ecf20Sopenharmony_ci	{ **show** | **list** | **dump xlated** | **dump jited** | **pin** | **load**
198c2ecf20Sopenharmony_ci	| **loadall** | **help** }
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciPROG COMMANDS
228c2ecf20Sopenharmony_ci=============
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci|	**bpftool** **prog** { **show** | **list** } [*PROG*]
258c2ecf20Sopenharmony_ci|	**bpftool** **prog dump xlated** *PROG* [{**file** *FILE* | **opcodes** | **visual** | **linum**}]
268c2ecf20Sopenharmony_ci|	**bpftool** **prog dump jited**  *PROG* [{**file** *FILE* | **opcodes** | **linum**}]
278c2ecf20Sopenharmony_ci|	**bpftool** **prog pin** *PROG* *FILE*
288c2ecf20Sopenharmony_ci|	**bpftool** **prog** { **load** | **loadall** } *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*]
298c2ecf20Sopenharmony_ci|	**bpftool** **prog attach** *PROG* *ATTACH_TYPE* [*MAP*]
308c2ecf20Sopenharmony_ci|	**bpftool** **prog detach** *PROG* *ATTACH_TYPE* [*MAP*]
318c2ecf20Sopenharmony_ci|	**bpftool** **prog tracelog**
328c2ecf20Sopenharmony_ci|	**bpftool** **prog run** *PROG* **data_in** *FILE* [**data_out** *FILE* [**data_size_out** *L*]] [**ctx_in** *FILE* [**ctx_out** *FILE* [**ctx_size_out** *M*]]] [**repeat** *N*]
338c2ecf20Sopenharmony_ci|	**bpftool** **prog profile** *PROG* [**duration** *DURATION*] *METRICs*
348c2ecf20Sopenharmony_ci|	**bpftool** **prog help**
358c2ecf20Sopenharmony_ci|
368c2ecf20Sopenharmony_ci|	*MAP* := { **id** *MAP_ID* | **pinned** *FILE* }
378c2ecf20Sopenharmony_ci|	*PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* | **name** *PROG_NAME* }
388c2ecf20Sopenharmony_ci|	*TYPE* := {
398c2ecf20Sopenharmony_ci|		**socket** | **kprobe** | **kretprobe** | **classifier** | **action** |
408c2ecf20Sopenharmony_ci|		**tracepoint** | **raw_tracepoint** | **xdp** | **perf_event** | **cgroup/skb** |
418c2ecf20Sopenharmony_ci|		**cgroup/sock** | **cgroup/dev** | **lwt_in** | **lwt_out** | **lwt_xmit** |
428c2ecf20Sopenharmony_ci|		**lwt_seg6local** | **sockops** | **sk_skb** | **sk_msg** | **lirc_mode2** |
438c2ecf20Sopenharmony_ci|		**cgroup/bind4** | **cgroup/bind6** | **cgroup/post_bind4** | **cgroup/post_bind6** |
448c2ecf20Sopenharmony_ci|		**cgroup/connect4** | **cgroup/connect6** | **cgroup/getpeername4** | **cgroup/getpeername6** |
458c2ecf20Sopenharmony_ci|               **cgroup/getsockname4** | **cgroup/getsockname6** | **cgroup/sendmsg4** | **cgroup/sendmsg6** |
468c2ecf20Sopenharmony_ci|		**cgroup/recvmsg4** | **cgroup/recvmsg6** | **cgroup/sysctl** |
478c2ecf20Sopenharmony_ci|		**cgroup/getsockopt** | **cgroup/setsockopt** | **cgroup/sock_release** |
488c2ecf20Sopenharmony_ci|		**struct_ops** | **fentry** | **fexit** | **freplace** | **sk_lookup**
498c2ecf20Sopenharmony_ci|	}
508c2ecf20Sopenharmony_ci|       *ATTACH_TYPE* := {
518c2ecf20Sopenharmony_ci|		**msg_verdict** | **stream_verdict** | **stream_parser** | **flow_dissector**
528c2ecf20Sopenharmony_ci|	}
538c2ecf20Sopenharmony_ci|	*METRICs* := {
548c2ecf20Sopenharmony_ci|		**cycles** | **instructions** | **l1d_loads** | **llc_misses**
558c2ecf20Sopenharmony_ci|	}
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciDESCRIPTION
598c2ecf20Sopenharmony_ci===========
608c2ecf20Sopenharmony_ci	**bpftool prog { show | list }** [*PROG*]
618c2ecf20Sopenharmony_ci		  Show information about loaded programs.  If *PROG* is
628c2ecf20Sopenharmony_ci		  specified show information only about given programs,
638c2ecf20Sopenharmony_ci		  otherwise list all programs currently loaded on the system.
648c2ecf20Sopenharmony_ci		  In case of **tag** or **name**, *PROG* may match several
658c2ecf20Sopenharmony_ci		  programs which will all be shown.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci		  Output will start with program ID followed by program type and
688c2ecf20Sopenharmony_ci		  zero or more named attributes (depending on kernel version).
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci		  Since Linux 5.1 the kernel can collect statistics on BPF
718c2ecf20Sopenharmony_ci		  programs (such as the total time spent running the program,
728c2ecf20Sopenharmony_ci		  and the number of times it was run). If available, bpftool
738c2ecf20Sopenharmony_ci		  shows such statistics. However, the kernel does not collect
748c2ecf20Sopenharmony_ci		  them by defaults, as it slightly impacts performance on each
758c2ecf20Sopenharmony_ci		  program run. Activation or deactivation of the feature is
768c2ecf20Sopenharmony_ci		  performed via the **kernel.bpf_stats_enabled** sysctl knob.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci		  Since Linux 5.8 bpftool is able to discover information about
798c2ecf20Sopenharmony_ci		  processes that hold open file descriptors (FDs) against BPF
808c2ecf20Sopenharmony_ci		  programs. On such kernels bpftool will automatically emit this
818c2ecf20Sopenharmony_ci		  information as well.
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	**bpftool prog dump xlated** *PROG* [{ **file** *FILE* | **opcodes** | **visual** | **linum** }]
848c2ecf20Sopenharmony_ci		  Dump eBPF instructions of the programs from the kernel. By
858c2ecf20Sopenharmony_ci		  default, eBPF will be disassembled and printed to standard
868c2ecf20Sopenharmony_ci		  output in human-readable format. In this case, **opcodes**
878c2ecf20Sopenharmony_ci		  controls if raw opcodes should be printed as well.
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci		  In case of **tag** or **name**, *PROG* may match several
908c2ecf20Sopenharmony_ci		  programs which will all be dumped.  However, if **file** or
918c2ecf20Sopenharmony_ci		  **visual** is specified, *PROG* must match a single program.
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci		  If **file** is specified, the binary image will instead be
948c2ecf20Sopenharmony_ci		  written to *FILE*.
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci		  If **visual** is specified, control flow graph (CFG) will be
978c2ecf20Sopenharmony_ci		  built instead, and eBPF instructions will be presented with
988c2ecf20Sopenharmony_ci		  CFG in DOT format, on standard output.
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci		  If the programs have line_info available, the source line will
1018c2ecf20Sopenharmony_ci		  be displayed by default.  If **linum** is specified,
1028c2ecf20Sopenharmony_ci		  the filename, line number and line column will also be
1038c2ecf20Sopenharmony_ci		  displayed on top of the source line.
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	**bpftool prog dump jited**  *PROG* [{ **file** *FILE* | **opcodes** | **linum** }]
1068c2ecf20Sopenharmony_ci		  Dump jited image (host machine code) of the program.
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci		  If *FILE* is specified image will be written to a file,
1098c2ecf20Sopenharmony_ci		  otherwise it will be disassembled and printed to stdout.
1108c2ecf20Sopenharmony_ci		  *PROG* must match a single program when **file** is specified.
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci		  **opcodes** controls if raw opcodes will be printed.
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci		  If the prog has line_info available, the source line will
1158c2ecf20Sopenharmony_ci		  be displayed by default.  If **linum** is specified,
1168c2ecf20Sopenharmony_ci		  the filename, line number and line column will also be
1178c2ecf20Sopenharmony_ci		  displayed on top of the source line.
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	**bpftool prog pin** *PROG* *FILE*
1208c2ecf20Sopenharmony_ci		  Pin program *PROG* as *FILE*.
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci		  Note: *FILE* must be located in *bpffs* mount. It must not
1238c2ecf20Sopenharmony_ci		  contain a dot character ('.'), which is reserved for future
1248c2ecf20Sopenharmony_ci		  extensions of *bpffs*.
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	**bpftool prog { load | loadall }** *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*]
1278c2ecf20Sopenharmony_ci		  Load bpf program(s) from binary *OBJ* and pin as *PATH*.
1288c2ecf20Sopenharmony_ci		  **bpftool prog load** pins only the first program from the
1298c2ecf20Sopenharmony_ci		  *OBJ* as *PATH*. **bpftool prog loadall** pins all programs
1308c2ecf20Sopenharmony_ci		  from the *OBJ* under *PATH* directory.
1318c2ecf20Sopenharmony_ci		  **type** is optional, if not specified program type will be
1328c2ecf20Sopenharmony_ci		  inferred from section names.
1338c2ecf20Sopenharmony_ci		  By default bpftool will create new maps as declared in the ELF
1348c2ecf20Sopenharmony_ci		  object being loaded.  **map** parameter allows for the reuse
1358c2ecf20Sopenharmony_ci		  of existing maps.  It can be specified multiple times, each
1368c2ecf20Sopenharmony_ci		  time for a different map.  *IDX* refers to index of the map
1378c2ecf20Sopenharmony_ci		  to be replaced in the ELF file counting from 0, while *NAME*
1388c2ecf20Sopenharmony_ci		  allows to replace a map by name.  *MAP* specifies the map to
1398c2ecf20Sopenharmony_ci		  use, referring to it by **id** or through a **pinned** file.
1408c2ecf20Sopenharmony_ci		  If **dev** *NAME* is specified program will be loaded onto
1418c2ecf20Sopenharmony_ci		  given networking device (offload).
1428c2ecf20Sopenharmony_ci		  Optional **pinmaps** argument can be provided to pin all
1438c2ecf20Sopenharmony_ci		  maps under *MAP_DIR* directory.
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci		  Note: *PATH* must be located in *bpffs* mount. It must not
1468c2ecf20Sopenharmony_ci		  contain a dot character ('.'), which is reserved for future
1478c2ecf20Sopenharmony_ci		  extensions of *bpffs*.
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci	**bpftool prog attach** *PROG* *ATTACH_TYPE* [*MAP*]
1508c2ecf20Sopenharmony_ci		  Attach bpf program *PROG* (with type specified by
1518c2ecf20Sopenharmony_ci		  *ATTACH_TYPE*). Most *ATTACH_TYPEs* require a *MAP*
1528c2ecf20Sopenharmony_ci		  parameter, with the exception of *flow_dissector* which is
1538c2ecf20Sopenharmony_ci		  attached to current networking name space.
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	**bpftool prog detach** *PROG* *ATTACH_TYPE* [*MAP*]
1568c2ecf20Sopenharmony_ci		  Detach bpf program *PROG* (with type specified by
1578c2ecf20Sopenharmony_ci		  *ATTACH_TYPE*). Most *ATTACH_TYPEs* require a *MAP*
1588c2ecf20Sopenharmony_ci		  parameter, with the exception of *flow_dissector* which is
1598c2ecf20Sopenharmony_ci		  detached from the current networking name space.
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	**bpftool prog tracelog**
1628c2ecf20Sopenharmony_ci		  Dump the trace pipe of the system to the console (stdout).
1638c2ecf20Sopenharmony_ci		  Hit <Ctrl+C> to stop printing. BPF programs can write to this
1648c2ecf20Sopenharmony_ci		  trace pipe at runtime with the **bpf_trace_printk**\ () helper.
1658c2ecf20Sopenharmony_ci		  This should be used only for debugging purposes. For
1668c2ecf20Sopenharmony_ci		  streaming data from BPF programs to user space, one can use
1678c2ecf20Sopenharmony_ci		  perf events (see also **bpftool-map**\ (8)).
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci	**bpftool prog run** *PROG* **data_in** *FILE* [**data_out** *FILE* [**data_size_out** *L*]] [**ctx_in** *FILE* [**ctx_out** *FILE* [**ctx_size_out** *M*]]] [**repeat** *N*]
1708c2ecf20Sopenharmony_ci		  Run BPF program *PROG* in the kernel testing infrastructure
1718c2ecf20Sopenharmony_ci		  for BPF, meaning that the program works on the data and
1728c2ecf20Sopenharmony_ci		  context provided by the user, and not on actual packets or
1738c2ecf20Sopenharmony_ci		  monitored functions etc. Return value and duration for the
1748c2ecf20Sopenharmony_ci		  test run are printed out to the console.
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci		  Input data is read from the *FILE* passed with **data_in**.
1778c2ecf20Sopenharmony_ci		  If this *FILE* is "**-**", input data is read from standard
1788c2ecf20Sopenharmony_ci		  input. Input context, if any, is read from *FILE* passed with
1798c2ecf20Sopenharmony_ci		  **ctx_in**. Again, "**-**" can be used to read from standard
1808c2ecf20Sopenharmony_ci		  input, but only if standard input is not already in use for
1818c2ecf20Sopenharmony_ci		  input data. If a *FILE* is passed with **data_out**, output
1828c2ecf20Sopenharmony_ci		  data is written to that file. Similarly, output context is
1838c2ecf20Sopenharmony_ci		  written to the *FILE* passed with **ctx_out**. For both
1848c2ecf20Sopenharmony_ci		  output flows, "**-**" can be used to print to the standard
1858c2ecf20Sopenharmony_ci		  output (as plain text, or JSON if relevant option was
1868c2ecf20Sopenharmony_ci		  passed). If output keywords are omitted, output data and
1878c2ecf20Sopenharmony_ci		  context are discarded. Keywords **data_size_out** and
1888c2ecf20Sopenharmony_ci		  **ctx_size_out** are used to pass the size (in bytes) for the
1898c2ecf20Sopenharmony_ci		  output buffers to the kernel, although the default of 32 kB
1908c2ecf20Sopenharmony_ci		  should be more than enough for most cases.
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci		  Keyword **repeat** is used to indicate the number of
1938c2ecf20Sopenharmony_ci		  consecutive runs to perform. Note that output data and
1948c2ecf20Sopenharmony_ci		  context printed to files correspond to the last of those
1958c2ecf20Sopenharmony_ci		  runs. The duration printed out at the end of the runs is an
1968c2ecf20Sopenharmony_ci		  average over all runs performed by the command.
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci		  Not all program types support test run. Among those which do,
1998c2ecf20Sopenharmony_ci		  not all of them can take the **ctx_in**/**ctx_out**
2008c2ecf20Sopenharmony_ci		  arguments. bpftool does not perform checks on program types.
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci	**bpftool prog profile** *PROG* [**duration** *DURATION*] *METRICs*
2038c2ecf20Sopenharmony_ci		  Profile *METRICs* for bpf program *PROG* for *DURATION*
2048c2ecf20Sopenharmony_ci		  seconds or until user hits <Ctrl+C>. *DURATION* is optional.
2058c2ecf20Sopenharmony_ci		  If *DURATION* is not specified, the profiling will run up to
2068c2ecf20Sopenharmony_ci		  **UINT_MAX** seconds.
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci	**bpftool prog help**
2098c2ecf20Sopenharmony_ci		  Print short help message.
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ciOPTIONS
2128c2ecf20Sopenharmony_ci=======
2138c2ecf20Sopenharmony_ci	.. include:: common_options.rst
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	-f, --bpffs
2168c2ecf20Sopenharmony_ci		  When showing BPF programs, show file names of pinned
2178c2ecf20Sopenharmony_ci		  programs.
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	-m, --mapcompat
2208c2ecf20Sopenharmony_ci		  Allow loading maps with unknown map definitions.
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	-n, --nomount
2238c2ecf20Sopenharmony_ci		  Do not automatically attempt to mount any virtual file system
2248c2ecf20Sopenharmony_ci		  (such as tracefs or BPF virtual file system) when necessary.
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ciEXAMPLES
2278c2ecf20Sopenharmony_ci========
2288c2ecf20Sopenharmony_ci**# bpftool prog show**
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci::
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci    10: xdp  name some_prog  tag 005a3d2123620c8b  gpl run_time_ns 81632 run_cnt 10
2338c2ecf20Sopenharmony_ci            loaded_at 2017-09-29T20:11:00+0000  uid 0
2348c2ecf20Sopenharmony_ci            xlated 528B  jited 370B  memlock 4096B  map_ids 10
2358c2ecf20Sopenharmony_ci            pids systemd(1)
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci**# bpftool --json --pretty prog show**
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci::
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci    [{
2428c2ecf20Sopenharmony_ci            "id": 10,
2438c2ecf20Sopenharmony_ci            "type": "xdp",
2448c2ecf20Sopenharmony_ci            "tag": "005a3d2123620c8b",
2458c2ecf20Sopenharmony_ci            "gpl_compatible": true,
2468c2ecf20Sopenharmony_ci            "run_time_ns": 81632,
2478c2ecf20Sopenharmony_ci            "run_cnt": 10,
2488c2ecf20Sopenharmony_ci            "loaded_at": 1506715860,
2498c2ecf20Sopenharmony_ci            "uid": 0,
2508c2ecf20Sopenharmony_ci            "bytes_xlated": 528,
2518c2ecf20Sopenharmony_ci            "jited": true,
2528c2ecf20Sopenharmony_ci            "bytes_jited": 370,
2538c2ecf20Sopenharmony_ci            "bytes_memlock": 4096,
2548c2ecf20Sopenharmony_ci            "map_ids": [10
2558c2ecf20Sopenharmony_ci            ],
2568c2ecf20Sopenharmony_ci            "pids": [{
2578c2ecf20Sopenharmony_ci                    "pid": 1,
2588c2ecf20Sopenharmony_ci                    "comm": "systemd"
2598c2ecf20Sopenharmony_ci                }
2608c2ecf20Sopenharmony_ci            ]
2618c2ecf20Sopenharmony_ci        }
2628c2ecf20Sopenharmony_ci    ]
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci|
2658c2ecf20Sopenharmony_ci| **# bpftool prog dump xlated id 10 file /tmp/t**
2668c2ecf20Sopenharmony_ci| **$ ls -l /tmp/t**
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci::
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci    -rw------- 1 root root 560 Jul 22 01:42 /tmp/t
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci**# bpftool prog dump jited tag 005a3d2123620c8b**
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci::
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci    0:   push   %rbp
2778c2ecf20Sopenharmony_ci    1:   mov    %rsp,%rbp
2788c2ecf20Sopenharmony_ci    2:   sub    $0x228,%rsp
2798c2ecf20Sopenharmony_ci    3:   sub    $0x28,%rbp
2808c2ecf20Sopenharmony_ci    4:   mov    %rbx,0x0(%rbp)
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci|
2838c2ecf20Sopenharmony_ci| **# mount -t bpf none /sys/fs/bpf/**
2848c2ecf20Sopenharmony_ci| **# bpftool prog pin id 10 /sys/fs/bpf/prog**
2858c2ecf20Sopenharmony_ci| **# bpftool prog load ./my_prog.o /sys/fs/bpf/prog2**
2868c2ecf20Sopenharmony_ci| **# ls -l /sys/fs/bpf/**
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci::
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci    -rw------- 1 root root 0 Jul 22 01:43 prog
2918c2ecf20Sopenharmony_ci    -rw------- 1 root root 0 Jul 22 01:44 prog2
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci**# bpftool prog dump jited pinned /sys/fs/bpf/prog opcodes**
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci::
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci   0:   push   %rbp
2988c2ecf20Sopenharmony_ci        55
2998c2ecf20Sopenharmony_ci   1:   mov    %rsp,%rbp
3008c2ecf20Sopenharmony_ci        48 89 e5
3018c2ecf20Sopenharmony_ci   4:   sub    $0x228,%rsp
3028c2ecf20Sopenharmony_ci        48 81 ec 28 02 00 00
3038c2ecf20Sopenharmony_ci   b:   sub    $0x28,%rbp
3048c2ecf20Sopenharmony_ci        48 83 ed 28
3058c2ecf20Sopenharmony_ci   f:   mov    %rbx,0x0(%rbp)
3068c2ecf20Sopenharmony_ci        48 89 5d 00
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci|
3098c2ecf20Sopenharmony_ci| **# bpftool prog load xdp1_kern.o /sys/fs/bpf/xdp1 type xdp map name rxcnt id 7**
3108c2ecf20Sopenharmony_ci| **# bpftool prog show pinned /sys/fs/bpf/xdp1**
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci::
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci    9: xdp  name xdp_prog1  tag 539ec6ce11b52f98  gpl
3158c2ecf20Sopenharmony_ci            loaded_at 2018-06-25T16:17:31-0700  uid 0
3168c2ecf20Sopenharmony_ci            xlated 488B  jited 336B  memlock 4096B  map_ids 7
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci**# rm /sys/fs/bpf/xdp1**
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci|
3218c2ecf20Sopenharmony_ci| **# bpftool prog profile id 337 duration 10 cycles instructions llc_misses**
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci::
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci         51397 run_cnt
3268c2ecf20Sopenharmony_ci      40176203 cycles                                                 (83.05%)
3278c2ecf20Sopenharmony_ci      42518139 instructions    #   1.06 insns per cycle               (83.39%)
3288c2ecf20Sopenharmony_ci           123 llc_misses      #   2.89 LLC misses per million insns  (83.15%)
329