Patch "libbpf: Skip base btf sanity checks" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    libbpf: Skip base btf sanity checks

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     libbpf-skip-base-btf-sanity-checks.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6a5097d0cc78d09427f154c1462870f3faca13ac
Author: Antoine Tenart <atenart@xxxxxxxxxx>
Date:   Mon Jun 24 11:09:07 2024 +0200

    libbpf: Skip base btf sanity checks
    
    [ Upstream commit c73a9683cb21012b6c0f14217974837151c527a8 ]
    
    When upgrading to libbpf 1.3 we noticed a big performance hit while
    loading programs using CORE on non base-BTF symbols. This was tracked
    down to the new BTF sanity check logic. The issue is the base BTF
    definitions are checked first for the base BTF and then again for every
    module BTF.
    
    Loading 5 dummy programs (using libbpf-rs) that are using CORE on a
    non-base BTF symbol on my system:
    - Before this fix: 3s.
    - With this fix: 0.1s.
    
    Fix this by only checking the types starting at the BTF start id. This
    should ensure the base BTF is still checked as expected but only once
    (btf->start_id == 1 when creating the base BTF), and then only
    additional types are checked for each module BTF.
    
    Fixes: 3903802bb99a ("libbpf: Add basic BTF sanity validation")
    Signed-off-by: Antoine Tenart <atenart@xxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Reviewed-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20240624090908.171231-1-atenart@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 2d0840ef599af..142060bbce0a0 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -598,7 +598,7 @@ static int btf_sanity_check(const struct btf *btf)
 	__u32 i, n = btf__type_cnt(btf);
 	int err;
 
-	for (i = 1; i < n; i++) {
+	for (i = btf->start_id; i < n; i++) {
 		t = btf_type_by_id(btf, i);
 		err = btf_validate_type(btf, t, i);
 		if (err)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux