aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/uapi/linux
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2018-04-29 01:28:12 -0400
committerAlexei Starovoitov <ast@kernel.org>2018-04-29 11:45:53 -0400
commitde2ff05f48afcde816ff4edb217417f62f624ab5 (patch)
treed67117e42ddcdc0da2e91ea8949bc489f0553cef /tools/include/uapi/linux
parent9cbe1f5a32dcd6d0508326f7d9098e5bc380a4fe (diff)
tools/bpf: add bpf_get_stack helper to tools headers
The tools header file bpf.h is synced with kernel uapi bpf.h. The new helper is also added to bpf_helpers.h. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/include/uapi/linux')
-rw-r--r--tools/include/uapi/linux/bpf.h42
1 files changed, 40 insertions, 2 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index da77a9388947..1afb606a18b9 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -1767,6 +1767,40 @@ union bpf_attr {
1767 * **CONFIG_XFRM** configuration option. 1767 * **CONFIG_XFRM** configuration option.
1768 * Return 1768 * Return
1769 * 0 on success, or a negative error in case of failure. 1769 * 0 on success, or a negative error in case of failure.
1770 *
1771 * int bpf_get_stack(struct pt_regs *regs, void *buf, u32 size, u64 flags)
1772 * Description
1773 * Return a user or a kernel stack in bpf program provided buffer.
1774 * To achieve this, the helper needs *ctx*, which is a pointer
1775 * to the context on which the tracing program is executed.
1776 * To store the stacktrace, the bpf program provides *buf* with
1777 * a nonnegative *size*.
1778 *
1779 * The last argument, *flags*, holds the number of stack frames to
1780 * skip (from 0 to 255), masked with
1781 * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set
1782 * the following flags:
1783 *
1784 * **BPF_F_USER_STACK**
1785 * Collect a user space stack instead of a kernel stack.
1786 * **BPF_F_USER_BUILD_ID**
1787 * Collect buildid+offset instead of ips for user stack,
1788 * only valid if **BPF_F_USER_STACK** is also specified.
1789 *
1790 * **bpf_get_stack**\ () can collect up to
1791 * **PERF_MAX_STACK_DEPTH** both kernel and user frames, subject
1792 * to sufficient large buffer size. Note that
1793 * this limit can be controlled with the **sysctl** program, and
1794 * that it should be manually increased in order to profile long
1795 * user stacks (such as stacks for Java programs). To do so, use:
1796 *
1797 * ::
1798 *
1799 * # sysctl kernel.perf_event_max_stack=<new value>
1800 *
1801 * Return
1802 * a non-negative value equal to or less than size on success, or
1803 * a negative error in case of failure.
1770 */ 1804 */
1771#define __BPF_FUNC_MAPPER(FN) \ 1805#define __BPF_FUNC_MAPPER(FN) \
1772 FN(unspec), \ 1806 FN(unspec), \
@@ -1835,7 +1869,8 @@ union bpf_attr {
1835 FN(msg_pull_data), \ 1869 FN(msg_pull_data), \
1836 FN(bind), \ 1870 FN(bind), \
1837 FN(xdp_adjust_tail), \ 1871 FN(xdp_adjust_tail), \
1838 FN(skb_get_xfrm_state), 1872 FN(skb_get_xfrm_state), \
1873 FN(get_stack),
1839 1874
1840/* integer value in 'imm' field of BPF_CALL instruction selects which helper 1875/* integer value in 'imm' field of BPF_CALL instruction selects which helper
1841 * function eBPF program intends to call 1876 * function eBPF program intends to call
@@ -1869,11 +1904,14 @@ enum bpf_func_id {
1869/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ 1904/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */
1870#define BPF_F_TUNINFO_IPV6 (1ULL << 0) 1905#define BPF_F_TUNINFO_IPV6 (1ULL << 0)
1871 1906
1872/* BPF_FUNC_get_stackid flags. */ 1907/* flags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack. */
1873#define BPF_F_SKIP_FIELD_MASK 0xffULL 1908#define BPF_F_SKIP_FIELD_MASK 0xffULL
1874#define BPF_F_USER_STACK (1ULL << 8) 1909#define BPF_F_USER_STACK (1ULL << 8)
1910/* flags used by BPF_FUNC_get_stackid only. */
1875#define BPF_F_FAST_STACK_CMP (1ULL << 9) 1911#define BPF_F_FAST_STACK_CMP (1ULL << 9)
1876#define BPF_F_REUSE_STACKID (1ULL << 10) 1912#define BPF_F_REUSE_STACKID (1ULL << 10)
1913/* flags used by BPF_FUNC_get_stack only. */
1914#define BPF_F_USER_BUILD_ID (1ULL << 11)
1877 1915
1878/* BPF_FUNC_skb_set_tunnel_key flags. */ 1916/* BPF_FUNC_skb_set_tunnel_key flags. */
1879#define BPF_F_ZERO_CSUM_TX (1ULL << 1) 1917#define BPF_F_ZERO_CSUM_TX (1ULL << 1)