c35b7fa52c
Pull in BTF writer APIs. Committer testing: $ rm -rf build $ mkdir build $ cd build $ cmake .. -- The C compiler identification is GNU 10.2.1 -- Check for working C compiler: /usr/lib64/ccache/cc -- Check for working C compiler: /usr/lib64/ccache/cc - works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Checking availability of DWARF and ELF development libraries -- Looking for dwfl_module_build_id in elf -- Looking for dwfl_module_build_id in elf - found -- Found dwarf.h header: /usr/include -- Found elfutils/libdw.h header: /usr/include -- Found libdw library: /usr/lib64/libdw.so -- Found libelf library: /usr/lib64/libelf.so -- Checking availability of DWARF and ELF development libraries - done -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11") -- Submodule update From https://github.com/libbpf/libbpf * [new branch] libbpf-0.1.1-xdp-bug-fix -> origin/libbpf-0.1.1-xdp-bug-fix 583bddce6b93bafa..b6dd2f2b7df4d3bd master -> origin/master * [new tag] v0.1.1 -> v0.1.1 * [new tag] v0.0.8 -> v0.0.8 * [new tag] v0.0.9 -> v0.0.9 * [new tag] v0.1.0 -> v0.1.0 Submodule path 'lib/bpf': checked out 'ff797cc905d9c5fe9acab92d2da127342b20f80f' -- Submodule update - done -- Performing Test HAVE_REALLOCARRAY_SUPPORT -- Performing Test HAVE_REALLOCARRAY_SUPPORT - Success -- Configuring done -- Generating done -- Build files have been written to: /home/acme/git/pahole/build $ $ cd .. $ ./btfdiff vmlinux $ $ cat fullcircle #!/bin/bash # SPDX-License-Identifier: GPL-2.0-only # Copyright © 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> # Use pfunct to produce compilable output from a object, then do a codiff -s # To see if the type information generated from source code generated # from type information in a file compiled from the original source code matches. if [ $# -eq 0 ] ; then echo "Usage: fullcircle <filename_with_type_info>" exit 1 fi file=$1 nr_cus=$(readelf -wi ${file} | grep DW_TAG_compile_unit | wc -l) if [ $nr_cus -gt 1 ]; then exit 0 fi c_output=$(mktemp /tmp/fullcircle.XXXXXX.c) o_output=$(mktemp /tmp/fullcircle.XXXXXX.o) pfunct_bin=${PFUNCT-"pfunct"} codiff_bin=${CODIFF-"codiff"} # See how your DW_AT_producer looks like and find the # right regexp to get after the GCC version string, this one # seems good enough for Red Hat/Fedora/CentOS that look like: # # DW_AT_producer : (indirect string, offset: 0x3583): GNU C89 8.2.1 20181215 (Red Hat 8.2.1-6) -mno-sse -mno-mmx # # So we need from -mno-sse onwards CFLAGS=$(readelf -wi $file | grep -w DW_AT_producer | sed -r 's/.*\)( -[[:alnum:]]+.*)+/\1/g') # Check if we managed to do the sed or if this is something like GNU AS [ "${CFLAGS/DW_AT_producer/}" != "${CFLAGS}" ] && exit ${pfunct_bin} --compile $file > $c_output gcc $CFLAGS -c -g $c_output -o $o_output ${codiff_bin} -q -s $file $o_output rm -f $c_output $o_output exit 0 [acme@five pahole]$ cp ~/git/build/bpf-next-v5.9.0-rc8+/net/ipv4/tcp_ipv4.o . [acme@five pahole]$ readelf -SW tcp_ipv4.o | grep BTF [acme@five pahole]$ pahole -J tcp_ipv4.o [acme@five pahole]$ readelf -SW tcp_ipv4.o | grep BTF [105] .BTF PROGBITS 0000000000000000 0fcf68 03ff6e 00 0 0 1 [acme@five pahole]$ ./fullcircle tcp_ipv4.o [acme@five pahole]$ pahole -F btf -C tcp_sock tcp_ipv4.o struct tcp_sock { struct inet_connection_sock inet_conn; /* 0 1376 */ /* --- cacheline 21 boundary (1344 bytes) was 32 bytes ago --- */ u16 tcp_header_len; /* 1376 2 */ u16 gso_segs; /* 1378 2 */ __be32 pred_flags; /* 1380 4 */ u64 bytes_received; /* 1384 8 */ u32 segs_in; /* 1392 4 */ u32 data_segs_in; /* 1396 4 */ u32 rcv_nxt; /* 1400 4 */ u32 copied_seq; /* 1404 4 */ /* --- cacheline 22 boundary (1408 bytes) --- */ u32 rcv_wup; /* 1408 4 */ u32 snd_nxt; /* 1412 4 */ u32 segs_out; /* 1416 4 */ u32 data_segs_out; /* 1420 4 */ u64 bytes_sent; /* 1424 8 */ u64 bytes_acked; /* 1432 8 */ u32 dsack_dups; /* 1440 4 */ u32 snd_una; /* 1444 4 */ u32 snd_sml; /* 1448 4 */ u32 rcv_tstamp; /* 1452 4 */ u32 lsndtime; /* 1456 4 */ u32 last_oow_ack_time; /* 1460 4 */ u32 compressed_ack_rcv_nxt; /* 1464 4 */ u32 tsoffset; /* 1468 4 */ /* --- cacheline 23 boundary (1472 bytes) --- */ struct list_head tsq_node; /* 1472 16 */ struct list_head tsorted_sent_queue; /* 1488 16 */ u32 snd_wl1; /* 1504 4 */ u32 snd_wnd; /* 1508 4 */ u32 max_window; /* 1512 4 */ u32 mss_cache; /* 1516 4 */ u32 window_clamp; /* 1520 4 */ u32 rcv_ssthresh; /* 1524 4 */ struct tcp_rack rack; /* 1528 24 */ /* XXX last struct has 2 bytes of padding */ /* --- cacheline 24 boundary (1536 bytes) was 16 bytes ago --- */ u16 advmss; /* 1552 2 */ u8 compressed_ack; /* 1554 1 */ u8 dup_ack_counter:2; /* 1555: 0 1 */ u8 tlp_retrans:1; /* 1555: 2 1 */ u8 unused:5; /* 1555: 3 1 */ u32 chrono_start; /* 1556 4 */ u32 chrono_stat[3]; /* 1560 12 */ u8 chrono_type:2; /* 1572: 0 1 */ u8 rate_app_limited:1; /* 1572: 2 1 */ u8 fastopen_connect:1; /* 1572: 3 1 */ u8 fastopen_no_cookie:1; /* 1572: 4 1 */ u8 is_sack_reneg:1; /* 1572: 5 1 */ u8 fastopen_client_fail:2; /* 1572: 6 1 */ u8 nonagle:4; /* 1573: 0 1 */ u8 thin_lto:1; /* 1573: 4 1 */ u8 recvmsg_inq:1; /* 1573: 5 1 */ u8 repair:1; /* 1573: 6 1 */ u8 frto:1; /* 1573: 7 1 */ u8 repair_queue; /* 1574 1 */ u8 save_syn:2; /* 1575: 0 1 */ u8 syn_data:1; /* 1575: 2 1 */ u8 syn_fastopen:1; /* 1575: 3 1 */ u8 syn_fastopen_exp:1; /* 1575: 4 1 */ u8 syn_fastopen_ch:1; /* 1575: 5 1 */ u8 syn_data_acked:1; /* 1575: 6 1 */ u8 is_cwnd_limited:1; /* 1575: 7 1 */ u32 tlp_high_seq; /* 1576 4 */ u32 tcp_tx_delay; /* 1580 4 */ u64 tcp_wstamp_ns; /* 1584 8 */ u64 tcp_clock_cache; /* 1592 8 */ /* --- cacheline 25 boundary (1600 bytes) --- */ u64 tcp_mstamp; /* 1600 8 */ u32 srtt_us; /* 1608 4 */ u32 mdev_us; /* 1612 4 */ u32 mdev_max_us; /* 1616 4 */ u32 rttvar_us; /* 1620 4 */ u32 rtt_seq; /* 1624 4 */ struct minmax rtt_min; /* 1628 24 */ u32 packets_out; /* 1652 4 */ u32 retrans_out; /* 1656 4 */ u32 max_packets_out; /* 1660 4 */ /* --- cacheline 26 boundary (1664 bytes) --- */ u32 max_packets_seq; /* 1664 4 */ u16 urg_data; /* 1668 2 */ u8 ecn_flags; /* 1670 1 */ u8 keepalive_probes; /* 1671 1 */ u32 reordering; /* 1672 4 */ u32 reord_seen; /* 1676 4 */ u32 snd_up; /* 1680 4 */ struct tcp_options_received rx_opt; /* 1684 24 */ u32 snd_ssthresh; /* 1708 4 */ u32 snd_cwnd; /* 1712 4 */ u32 snd_cwnd_cnt; /* 1716 4 */ u32 snd_cwnd_clamp; /* 1720 4 */ u32 snd_cwnd_used; /* 1724 4 */ /* --- cacheline 27 boundary (1728 bytes) --- */ u32 snd_cwnd_stamp; /* 1728 4 */ u32 prior_cwnd; /* 1732 4 */ u32 prr_delivered; /* 1736 4 */ u32 prr_out; /* 1740 4 */ u32 delivered; /* 1744 4 */ u32 delivered_ce; /* 1748 4 */ u32 lost; /* 1752 4 */ u32 app_limited; /* 1756 4 */ u64 first_tx_mstamp; /* 1760 8 */ u64 delivered_mstamp; /* 1768 8 */ u32 rate_delivered; /* 1776 4 */ u32 rate_interval_us; /* 1780 4 */ u32 rcv_wnd; /* 1784 4 */ u32 write_seq; /* 1788 4 */ /* --- cacheline 28 boundary (1792 bytes) --- */ u32 notsent_lowat; /* 1792 4 */ u32 pushed_seq; /* 1796 4 */ u32 lost_out; /* 1800 4 */ u32 sacked_out; /* 1804 4 */ struct hrtimer pacing_timer; /* 1808 64 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 29 boundary (1856 bytes) was 16 bytes ago --- */ struct hrtimer compressed_ack_timer; /* 1872 64 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 30 boundary (1920 bytes) was 16 bytes ago --- */ struct sk_buff * lost_skb_hint; /* 1936 8 */ struct sk_buff * retransmit_skb_hint; /* 1944 8 */ struct rb_root out_of_order_queue; /* 1952 8 */ struct sk_buff * ooo_last_skb; /* 1960 8 */ struct tcp_sack_block duplicate_sack[1]; /* 1968 8 */ struct tcp_sack_block selective_acks[4]; /* 1976 32 */ /* --- cacheline 31 boundary (1984 bytes) was 24 bytes ago --- */ struct tcp_sack_block recv_sack_cache[4]; /* 2008 32 */ struct sk_buff * highest_sack; /* 2040 8 */ /* --- cacheline 32 boundary (2048 bytes) --- */ int lost_cnt_hint; /* 2048 4 */ u32 prior_ssthresh; /* 2052 4 */ u32 high_seq; /* 2056 4 */ u32 retrans_stamp; /* 2060 4 */ u32 undo_marker; /* 2064 4 */ int undo_retrans; /* 2068 4 */ u64 bytes_retrans; /* 2072 8 */ u32 total_retrans; /* 2080 4 */ u32 urg_seq; /* 2084 4 */ unsigned int keepalive_time; /* 2088 4 */ unsigned int keepalive_intvl; /* 2092 4 */ int linger2; /* 2096 4 */ u8 bpf_sock_ops_cb_flags; /* 2100 1 */ /* XXX 1 byte hole, try to pack */ u16 timeout_rehash; /* 2102 2 */ u32 rcv_ooopack; /* 2104 4 */ u32 rcv_rtt_last_tsecr; /* 2108 4 */ /* --- cacheline 33 boundary (2112 bytes) --- */ struct { u32 rtt_us; /* 2112 4 */ u32 seq; /* 2116 4 */ u64 time; /* 2120 8 */ } rcv_rtt_est; /* 2112 16 */ struct { u32 space; /* 2128 4 */ u32 seq; /* 2132 4 */ u64 time; /* 2136 8 */ } rcvq_space; /* 2128 16 */ struct { u32 probe_seq_start; /* 2144 4 */ u32 probe_seq_end; /* 2148 4 */ } mtu_probe; /* 2144 8 */ u32 mtu_info; /* 2152 4 */ bool is_mptcp; /* 2156 1 */ bool syn_smc; /* 2157 1 */ /* XXX 2 bytes hole, try to pack */ const struct tcp_sock_af_ops * af_specific; /* 2160 8 */ struct tcp_md5sig_info * md5sig_info; /* 2168 8 */ /* --- cacheline 34 boundary (2176 bytes) --- */ struct tcp_fastopen_request * fastopen_req; /* 2176 8 */ struct request_sock * fastopen_rsk; /* 2184 8 */ struct saved_syn * saved_syn; /* 2192 8 */ /* size: 2200, cachelines: 35, members: 140 */ /* sum members: 2193, holes: 2, sum holes: 3 */ /* sum bitfield members: 32 bits (4 bytes) */ /* paddings: 3, sum paddings: 10 */ /* last cacheline: 24 bytes */ }; $ pahole -F btf -C tcp_sock tcp_ipv4.o > tcp_sock.o.before $ Signed-off-by: Andrii Nakryiko <andriin@fb.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: bpf@vger.kernel.org Cc: dwarves@vger.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> |
||
---|---|---|
.. | ||
bpf@ff797cc905 | ||
ctracer_relay.c | ||
ctracer_relay.h | ||
linux.blacklist.cu | ||
Makefile |