8000 Libbpf sync 2025-04-01T22:47:55.839Z by mykyta5 · Pull Request #897 · libbpf/libbpf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Libbpf sync 2025-04-01T22:47:55.839Z #897

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 14 commits into from
Apr 2, 2025

Conversation

mykyta5
Copy link
Contributor
@mykyta5 mykyta5 commented Apr 2, 2025
Dumping existing libbpf commit signatures...
WORKDIR:          /home/yatsenko/git/libbpf
LINUX REPO:       /home/yatsenko/git/linux
LIBBPF REPO:      /home/yatsenko/git/libbpf
TEMP DIR:         /tmp/tmp.pM8j1ESk7B
SUFFIX:           2025-04-01T22-47-55.839Z
BASE 
10000
COMMIT:      '488a8544f839 ("Merge branch 'bpf-introduce-helper-for-populating-bpf_cpumask'")'
TIP COMMIT:       '25601e85441d ("Merge tag 'char-misc-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc")'
BPF BASE COMMIT:  '46e88299d196 ("xsk: Fix __xsk_generic_xmit() error code when cq is full")'
BPF TIP COMMIT:   '0c2623cef4f4 ("selftests/bpf: Fix verifier_private_stack test failure")'
SQUASH COMMIT:    32a8dc7e44cf6f5a5d99cf8403872076e830147d
BASELINE TAG:     libbpf-baseline-2025-04-01T22-47-55.839Z
TIP TAG:          libbpf-tip-2025-04-01T22-47-55.839Z
BPF BASELINE TAG: libbpf-bpf-baseline-2025-04-01T22-47-55.839Z
BPF TIP TAG:      libbpf-bpf-tip-2025-04-01T22-47-55.839Z
SQUASH BASE TAG:  libbpf-squash-base-2025-04-01T22-47-55.839Z
SQUASH TIP TAG:   libbpf-squash-tip-2025-04-01T22-47-55.839Z
VIEW TAG:         libbpf-view-2025-04-01T22-47-55.839Z
LIBBPF SYNC TAG:  libbpf-sync-2025-04-01T22-47-55.839Z
PATCHES:          /tmp/tmp.pM8j1ESk7B/patches
Updating files: 100% (11539/11539), done.
Switched to a new branch 'libbpf-squash-tip-2025-04-01T22-47-55.839Z'
Picking 'c53e14f1ea4a ("perf: Extend per event callchain limit to branch stack")'...
Picking 'dcc0113acd3b ("netdev: add io_uring memory provider info")'...
Picking 'df524c8f5771 ("netdev-genl: Add an XSK attribute to queues")'...
Warning! Cherry-picking 'df524c8f5771 ("netdev-genl: Add an XSK attribute to queues") failed, checking if it's non-libbpf files causing problems...
Looks like only non-libbpf files have conflicts, ignoring...
Success! All cherry-pick conflicts were resolved for 'df524c8f5771 ("netdev-genl: Add an XSK attribute to queues")'!
Picking '24e82b7c045b ("bpf: Add networking timestamping support to bpf_get/setsockopt()")'...
Picking '6b98ec7e882a ("bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback")'...
Warning! Cherry-picking '6b98ec7e882a ("bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback") failed, checking if it's non-libbpf files causing problems...
Looks like only non-libbpf files have conflicts, ignoring...
Success! All cherry-pick conflicts were resolved for '6b98ec7e882a ("bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback")'!
Picking 'ecebb17ad818 ("bpf: Add BPF_SOCK_OPS_TSTAMP_SND_SW_CB callback")'...
Picking '2deaf7f42b8c ("bpf: Add BPF_SOCK_OPS_TSTAMP_SND_HW_CB callback")'...
Picking 'b3b81e6b009d ("bpf: Add BPF_SOCK_OPS_TSTAMP_ACK_CB callback")'...
Picking 'c9525d240c81 ("bpf: Add BPF_SOCK_OPS_TSTAMP_SENDMSG_CB callback")'...
Picking 'ca4419f15abd ("xsk: Add launch time hardware offload support to XDP Tx metadata")'...
Picking '0de445d18e36 ("bpf: BPF token support for BPF_BTF_GET_FD_BY_ID")'...
Picking '974ef9f0d23e ("libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID")'...
Picking '307ef667e945 ("libbpf: Add namespace for errstr making it libbpf_errstr")'...
Rewrite 5b47c6a4009d65d44154301298146b90d55496e2 (14/14) (20 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/libbpf-squash-tip-2025-04-01T22-47-55.839Z' was rewritten
Ref 'refs/heads/libbpf-squash-base-2025-04-01T22-47-55.839Z' was rewritten
Rewrite 15978241251335547e19dd0a4af370397229193e (12/14) (1 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/libbpf-squash-tip-2025-04-01T22-47-55.839Z' was rewritten
Ref 'refs/heads/libbpf-squash-base-2025-04-01T22-47-55.839Z' was rewritten
/tmp/tmp.pM8j1ESk7B/patches/0000-cover-letter.patch
/tmp/tmp.pM8j1ESk7B/patches/0001-perf-Extend-per-event-callchain-limit-to-branch-stac.patch
/tmp/tmp.pM8j1ESk7B/patches/0002-netdev-add-io_uring-memory-provider-info.patch
/tmp/tmp.pM8j1ESk7B/patches/0003-netdev-genl-Add-an-XSK-attribute-to-queues.patch
/tmp/tmp.pM8j1ESk7B/patches/0004-bpf-Add-networking-timestamping-support-to-bpf_get-s.patch
/tmp/tmp.pM8j1ESk7B/patches/0005-bpf-Add-BPF_SOCK_OPS_TSTAMP_SCHED_CB-callback.patch
/tmp/tmp.pM8j1ESk7B/patches/0006-bpf-Add-BPF_SOCK_OPS_TSTAMP_SND_SW_CB-callback.patch
/tmp/tmp.pM8j1ESk7B/patches/0007-bpf-Add-BPF_SOCK_OPS_TSTAMP_SND_HW_CB-callback.patch
/tmp/tmp.pM8j1ESk7B/patches/0008-bpf-Add-BPF_SOCK_OPS_TSTAMP_ACK_CB-callback.patch
/tmp/tmp.pM8j1ESk7B/patches/0009-bpf-Add-BPF_SOCK_OPS_TSTAMP_SENDMSG_CB-callback.patch
/tmp/tmp.pM8j1ESk7B/patches/0010-xsk-Add-launch-time-hardware-offload-support-to-XDP-.patch
/tmp/tmp.pM8j1ESk7B/patches/0011-bpf-BPF-token-support-for-BPF_BTF_GET_FD_BY_ID.patch
/tmp/tmp.pM8j1ESk7B/patches/0012-libbpf-Pass-BPF-token-from-find_prog_btf_id-to-BPF_B.patch
/tmp/tmp.pM8j1ESk7B/patches/0013-libbpf-Add-namespace-for-errstr-making-it-libbpf_err.patch
Switched to a new branch 'libbpf-sync-2025-04-01T22-47-55.839Z'
Applying: perf: Extend per event callchain limit to branch stack
Applying: netdev: add io_uring memory provider info
Applying: netdev-genl: Add an XSK attribute to queues
Applying: bpf: Add networking timestamping support to bpf_get/setsockopt()
Applying: bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback
Applying: bpf: Add BPF_SOCK_OPS_TSTAMP_SND_SW_CB callback
Applying: bpf: Add BPF_SOCK_OPS_TSTAMP_SND_HW_CB callback
Applying: bpf: Add BPF_SOCK_OPS_TSTAMP_ACK_CB callback
Applying: bpf: Add BPF_SOCK_OPS_TSTAMP_SENDMSG_CB callback
Applying: xsk: Add launch time hardware offload support to XDP Tx metadata
Applying: bpf: BPF token support for BPF_BTF_GET_FD_BY_ID
Applying: libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID
Applying: libbpf: Add namespace for errstr making it libbpf_errstr
Updating files: 100% (88855/88855), done.
Switched to branch 'libbpf-tip-2025-04-01T22-47-55.839Z'
Regenerating .mailmap...
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
[libbpf-sync-2025-04-01T22-47-55.839Z 64ab00aa7fdb] sync: latest libbpf changes from kernel
 2 files changed, 2 insertions(+), 2 deletions(-)
SUCCESS! 13 commits synced.
Verifying Linux's and Github's libbpf state
Switched to a new branch 'libbpf-view-2025-04-01T22-47-55.839Z'
Rewrite 25601e85441dd91cf7973b002f27af4c5b8691ea (302/302) (338 seconds passed, remaining 0 predicted)      
Ref 'refs/heads/libbpf-view-2025-04-01T22-47-55.839Z' was rewritten
Rewrite f8124c5576d4a01c77e0a00ab4c01f5fa125c7d8 (13/14) (1 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/libbpf-view-2025-04-01T22-47-55.839Z' was rewritten
Comparing list of files...
Comparing file contents...
Great! Content is identical!
Cleaning up...
Updating files: 100% (88855/88855), done.
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Deleted branch libbpf-baseline-2025-04-01T22-47-55.839Z (was 488a8544f839).
Deleted branch libbpf-tip-2025-04-01T22-47-55.839Z (was 25601e85441d).
Deleted branch libbpf-bpf-baseline-2025-04-01T22-47-55.839Z (was 46e88299d196).
Deleted branch libbpf-bpf-tip-2025-04-01T22-47-55.839Z (was 0c2623cef4f4).
Deleted branch libbpf-squash-base-2025-04-01T22-47-55.839Z (was 7e90a69b49a3).
Deleted branch libbpf-squash-tip-2025-04-01T22-47-55.839Z (was 895d980cc261).
Deleted branch libbpf-view-2025-04-01T22-47-55.839Z (was b30183378f2d).
DONE.

Kan Liang and others added 14 commits April 2, 2025 19:37
The commit 97c79a38cd45 ("perf core: Per event callchain limit")
introduced a per-event term to allow finer tuning of the depth of
callchains to save space.

It should be applied to the branch stack as well. For example, autoFDO
collections require maximum LBR entries. In the meantime, other
system-wide LBR users may only be interested in the latest a few number
of LBRs. A per-event LBR depth would save the perf output buffer.

The patch simply drops the uninterested branches, but HW still collects
the maximum branches. There may be a model-specific optimization that
can reduce the HW depth for some cases to reduce the overhead further.
But it isn't included in the patch set. Because it's not useful for all
cases. For example, ARCH LBR can utilize the PEBS and XSAVE to collect
LBRs. The depth should have less impact on the collecting overhead.
The model-specific optimization may be implemented later separately.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250310181536.3645382-1-kan.liang@linux.intel.com
Add a nested attribute for io_uring memory provider info. For now it is
empty and its presence indicates that a particular page pool or queue
has an io_uring memory provider attached.

$ ./cli.py --spec netlink/specs/netdev.yaml --dump page-pool-get
[{'id': 80,
  'ifindex': 2,
  'inflight': 64,
  'inflight-mem': 262144,
  'napi-id': 525},
 {'id': 79,
  'ifindex': 2,
  'inflight': 320,
  'inflight-mem': 1310720,
  'io_uring': {},
  'napi-id': 525},
...

$ ./cli.py --spec netlink/specs/netdev.yaml --dump queue-get
[{'id': 0, 'ifindex': 1, 'type': 'rx'},
 {'id': 0, 'ifindex': 1, 'type': 'tx'},
 {'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'rx'},
 {'id': 1, 'ifindex': 2, 'napi-id': 514, 'type': 'rx'},
...
 {'id': 12, 'ifindex': 2, 'io_uring': {}, 'napi-id': 525, 'type': 'rx'},
...

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: David Wei <dw@davidwei.uk>
Link: https://patch.msgid.link/20250204215622.695511-6-dw@davidwei.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Expose a new per-queue nest attribute, xsk, which will be present for
queues that are being used for AF_XDP. If the queue is not being used for
AF_XDP, the nest will not be present.

In the future, this attribute can be extended to include more data about
XSK as it is needed.

Signed-off-by: Joe Damato <jdamato@fastly.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20250214211255.14194-3-jdamato@fastly.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
The new SK_BPF_CB_FLAGS and new SK_BPF_CB_TX_TIMESTAMPING are
added to bpf_get/setsockopt. The later patches will implement the
BPF networking timestamping. The BPF program will use
bpf_setsockopt(SK_BPF_CB_FLAGS, SK_BPF_CB_TX_TIMESTAMPING) to
enable the BPF networking timestamping on a socket.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250220072940.99994-2-kerneljasonxing@gmail.com
Support SCM_TSTAMP_SCHED case for bpf timestamping.

Add a new sock_ops callback, BPF_SOCK_OPS_TSTAMP_SCHED_CB. This
callback will occur at the same timestamping point as the user
space's SCM_TSTAMP_SCHED. The BPF program can use it to get the
same SCM_TSTAMP_SCHED timestamp without modifying the user-space
application.

A new SKBTX_BPF flag is added to mark skb_shinfo(skb)->tx_flags,
ensuring that the new BPF timestamping and the current user
space's SO_TIMESTAMPING do not interfere with each other.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250220072940.99994-7-kerneljasonxing@gmail.com
Support sw SCM_TSTAMP_SND case for bpf timestamping.

Add a new sock_ops callback, BPF_SOCK_OPS_TSTAMP_SND_SW_CB. This
callback will occur at the same timestamping point as the user
space's software SCM_TSTAMP_SND. The BPF program can use it to
get the same SCM_TSTAMP_SND timestamp without modifying the
user-space application.

Based on this patch, BPF program will get the software
timestamp when the driver is ready to send the skb. In the
sebsequent patch, the hardware timestamp will be supported.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250220072940.99994-8-kerneljasonxing@gmail.com
Support hw SCM_TSTAMP_SND case for bpf timestamping.

Add a new sock_ops callback, BPF_SOCK_OPS_TSTAMP_SND_HW_CB. This
callback will occur at the same timestamping point as the user
space's hardware SCM_TSTAMP_SND. The BPF program can use it to
get the same SCM_TSTAMP_SND timestamp without modifying the
user-space application.

To avoid increasing the code complexity, replace SKBTX_HW_TSTAMP
with SKBTX_HW_TSTAMP_NOBPF instead of changing numerous callers
from driver side using SKBTX_HW_TSTAMP. The new definition of
SKBTX_HW_TSTAMP means the combination tests of socket timestamping
and bpf timestamping. After this patch, drivers can work under the
bpf timestamping.

Considering some drivers don't assign the skb with hardware
timestamp, this patch does the assignment and then BPF program
can acquire the hwstamp from skb directly.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250220072940.99994-9-kerneljasonxing@gmail.com
Support the ACK case for bpf timestamping.

Add a new sock_ops callback, BPF_SOCK_OPS_TSTAMP_ACK_CB. This
callback will occur at the same timestamping point as the user
space's SCM_TSTAMP_ACK. The BPF program can use it to get the
same SCM_TSTAMP_ACK timestamp without modifying the user-space
application.

This patch extends txstamp_ack to two bits: 1 stands for
SO_TIMESTAMPING mode, 2 bpf extension.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250220072940.99994-10-kerneljasonxing@gmail.com
This patch introduces a new callback in tcp_tx_timestamp() to correlate
tcp_sendmsg timestamp with timestamps from other tx timestamping
callbacks (e.g., SND/SW/ACK).

Without this patch, BPF program wouldn't know which timestamps belong
to which flow because of no socket lock protection. This new callback
is inserted in tcp_tx_timestamp() to address this issue because
tcp_tx_timestamp() still owns the same socket lock with
tcp_sendmsg_locked() in the meanwhile tcp_tx_timestamp() initializes
the timestamping related fields for the skb, especially tskey. The
tskey is the bridge to do the correlation.

For TCP, BPF program hooks the beginning of tcp_sendmsg_locked() and
then stores the sendmsg timestamp at the bpf_sk_storage, correlating
this timestamp with its tskey that are later used in other sending
timestamping callbacks.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250220072940.99994-11-kerneljasonxing@gmail.com
Extend the XDP Tx metadata framework so that user can requests launch time
hardware offload, where the Ethernet device will schedule the packet for
transmission at a pre-determined time called launch time. The value of
launch time is communicated from user space to Ethernet driver via
launch_time field of struct xsk_tx_metadata.

Suggested-by: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Song Yoong Siang <yoong.siang.song@intel.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20250216093430.957880-2-yoong.siang.song@intel.com
Currently BPF_BTF_GET_FD_BY_ID requires CAP_SYS_ADMIN, which does not
allow running it from user namespace. This creates a problem when
freplace program running from user namespace needs to query target
program BTF.
This patch relaxes capable check from CAP_SYS_ADMIN to CAP_BPF and adds
support for BPF token that can be passed in attributes to syscall.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250317174039.161275-2-mykyta.yatsenko5@gmail.com
Pass BPF token from bpf_program__set_attach_target to
BPF_BTF_GET_FD_BY_ID bpf command.
When freplace program attaches to target program, it needs to look up
for BTF of the target, this may require BPF token, if, for example,
running from user namespace.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20250317174039.161275-4-mykyta.yatsenko5@gmail.com
When statically linking symbols can be replaced with those from other
statically linked libraries depending on the link order and the hoped
for "multiple definition" error may not appear. To avoid conflicts it
is good practice to namespace symbols, this change renames errstr to
libbpf_errstr. To avoid churn a #define is used to turn use of
errstr(err) to libbpf_errstr(err).

Fixes: 1633a83bf993 ("libbpf: Introduce errstr() for stringifying errno")
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250320222439.1350187-1-irogers@google.com
Syncing latest libbpf commits from kernel repository.
Baseline bpf-next commit:   488a8544f839048064ea0647596af2aaca7ecc25
Checkpoint bpf-next commit: 25601e85441dd91cf7973b002f27af4c5b8691ea
Baseline bpf commit:        46e88299d19695c2b21e245c52a86ed26ed5cfee
Checkpoint bpf commit:      0c2623cef4f49e1ef6a908a389eea86130d11057

David Wei (1):
  netdev: add io_uring memory provider info

Ian Rogers (1):
  libbpf: Add namespace for errstr making it libbpf_errstr

Jason Xing (6):
  bpf: Add networking timestamping support to bpf_get/setsockopt()
  bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback
  bpf: Add BPF_SOCK_OPS_TSTAMP_SND_SW_CB callback
  bpf: Add BPF_SOCK_OPS_TSTAMP_SND_HW_CB callback
  bpf: Add BPF_SOCK_OPS_TSTAMP_ACK_CB callback
  bpf: Ad
8243
d BPF_SOCK_OPS_TSTAMP_SENDMSG_CB callback

Joe Damato (1):
  netdev-genl: Add an XSK attribute to queues

Kan Liang (1):
  perf: Extend per event callchain limit to branch stack

Mykyta Yatsenko (2):
  bpf: BPF token support for BPF_BTF_GET_FD_BY_ID
  libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID

Song Yoong Siang (1):
  xsk: Add launch time hardware offload support to XDP Tx metadata

 include/uapi/linux/bpf.h        | 31 +++++++++++++++++++++++++++++++
 include/uapi/linux/if_xdp.h     | 10 ++++++++++
 include/uapi/linux/netdev.h     | 16 ++++++++++++++++
 include/uapi/linux/perf_event.h |  2 ++
 src/bpf.c                       |  3 ++-
 src/bpf.h                       |  3 ++-
 src/btf.c                       | 15 +++++++++++++--
 src/libbpf.c                    | 10 +++++-----
 src/libbpf_internal.h           |  1 +
 src/str_error.c                 |  2 +-
 src/str_error.h                 |  7 +++++--
 11 files changed, 88 insertions(+), 12 deletions(-)

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
@mykyta5 mykyta5 marked this pull request as ready for review April 2, 2025 19:46
@anakryiko anakryiko merged commit 4659eaa into libbpf:master Apr 2, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0