Thread (16 messages) 16 messages, 2 authors, 1h ago

Re: [PATCH bpf-next v4 07/12] bpf: keep module BTF until the vmlinux BTF is available

From: bot+bpf-ci@kernel.org
Date: 2026-10-01 23:46:01
Also in: bpf, linux-doc, linux-kbuild, linux-kselftest, linux-modules, linux-perf-users, linux-trace-kernel, lkml, rust-for-linux, sched-ext

bpf: keep module BTF until the vmlinux BTF is available
TL;DR: Nits only: in kernel/bpf/btf.c, btf_drop_deferred_vmlinux_regs() could
reuse the new btf_free_deferred_regs() helper, and the module and vmlinux
apply loops look duplicated. No bug.
quoted hunk ↗ jump to hunk
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 96241dc62dc3..4d51fb212218 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -10967,6 +11252,16 @@ static void btf_apply_deferred_regs(struct btf *btf, struct list_head *regs)
 	}
 }

+static void btf_free_deferred_regs(struct list_head *regs)
+{
+	struct btf_deferred_reg *reg, *tmp;
+
+	list_for_each_entry_safe(reg, tmp, regs, list) {
+		list_del(&reg->list);
+		btf_free_deferred_reg(reg);
+	}
+}
+
This isn't a bug, but could btf_drop_deferred_vmlinux_regs() call the new
btf_free_deferred_regs(&regs) instead of keeping its own copy of the loop?

The tail of btf_drop_deferred_vmlinux_regs() still open-codes the same
thing on its local list:

    list_for_each_entry_safe(reg, tmp, &regs, list) {
        list_del(&reg->list);
        btf_free_deferred_reg(reg);
    }

The splice / unlock / apply / relock loop in btf_module_apply_regs() is
also the same as the one in btf_apply_deferred_vmlinux_regs(), just with a
different mutex.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/36938681172
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help