summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.com>2025-09-19 17:08:20 +0200
committerJiri Kosina <jkosina@suse.com>2025-09-19 17:08:36 +0200
commit71b28769d708f20046fc6f853cf93fb88a8b6e11 (patch)
treee579afda01909585ed70bb477233b0f4f72dabac /tools/lib/bpf/libbpf.c
parent1860b13beca829c056179c63530eebfec9a3efb4 (diff)
parent02d6eeedbc36d4b309d5518778071a749ef79c4e (diff)
Merge remote-tracking branch 'origin' into for-6.18/intel-thc-hid
Needed as a basisi for followup support for quicki2c advanced BIOS features. Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r--tools/lib/bpf/libbpf.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e067cb5776bd..8f5a81b672e1 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -10096,7 +10096,7 @@ static int find_kernel_btf_id(struct bpf_object *obj, const char *attach_name,
enum bpf_attach_type attach_type,
int *btf_obj_fd, int *btf_type_id)
{
- int ret, i, mod_len;
+ int ret, i, mod_len = 0;
const char *fn_name, *mod_name = NULL;
fn_name = strchr(attach_name, ':');
@@ -10965,11 +10965,14 @@ struct bpf_link *bpf_program__attach_perf_event_opts(const struct bpf_program *p
}
link->link.fd = pfd;
}
- if (ioctl(pfd, PERF_EVENT_IOC_ENABLE, 0) < 0) {
- err = -errno;
- pr_warn("prog '%s': failed to enable perf_event FD %d: %s\n",
- prog->name, pfd, errstr(err));
- goto err_out;
+
+ if (!OPTS_GET(opts, dont_enable, false)) {
+ if (ioctl(pfd, PERF_EVENT_IOC_ENABLE, 0) < 0) {
+ err = -errno;
+ pr_warn("prog '%s': failed to enable perf_event FD %d: %s\n",
+ prog->name, pfd, errstr(err));
+ goto err_out;
+ }
}
return &link->link;