BPF List
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Lorenz Bauer <lmb@isovalent.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Alan Maguire <alan.maguire@oracle.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	bpf@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: BTF loading failing on perf
Date: Fri, 6 Jun 2025 17:14:06 +0100	[thread overview]
Message-ID: <20250606161406.GH8020@e132581.arm.com> (raw)
In-Reply-To: <aEMLU2li1x2bAO4w@x1>

Hi Arnaldo,

On Fri, Jun 06, 2025 at 12:37:55PM -0300, Arnaldo Carvalho de Melo wrote:
> root@number:~# perf trace -e openat --max-events=1
> libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV
> libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV
>      0.000 ( 0.016 ms): ptyxis-agent/4375 openat(dfd: CWD, filename: "/proc/6593/cmdline", flags: RDONLY|CLOEXEC) = 13
> root@number:~#
> 
> openat(AT_FDCWD, "/sys/kernel/btf/vmlinux", O_RDONLY) = 258
> mmap(NULL, 6519699, PROT_READ, MAP_PRIVATE, 258, 0) = -1 ENODEV (No such device)
> libbpf: failed to read kernel BTF from '/sys/kernel/btf/vmlinux': -ENODEV

Have you included the commit below in the kernel side?

commit a539e2a6d51d1c12d89eec149ccc72ec561639bc
Author: Lorenz Bauer <lmb@isovalent.com>
Date:   Tue May 20 14:01:17 2025 +0100

    btf: Allow mmap of vmlinux btf
    
    User space needs access to kernel BTF for many modern features of BPF.
    Right now each process needs to read the BTF blob either in pieces or
    as a whole. Allow mmaping the sysfs file so that processes can directly
    access the memory allocated for it in the kernel.
    
    remap_pfn_range is used instead of vm_insert_page due to aarch64
    compatibility issues.
    
    Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Tested-by: Alan Maguire <alan.maguire@oracle.com>
    Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
    Link: https://lore.kernel.org/bpf/20250520-vmlinux-mmap-v5-1-e8c941acc414@isovalent.com

Thanks,
Leo

  reply	other threads:[~2025-06-06 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 15:37 BTF loading failing on perf Arnaldo Carvalho de Melo
2025-06-06 16:14 ` Leo Yan [this message]
2025-06-06 16:20   ` Andrii Nakryiko
2025-06-06 20:05     ` Arnaldo Carvalho de Melo
2025-06-06 20:22       ` Andrii Nakryiko
2025-06-10 20:27       ` Arnaldo Carvalho de Melo
2025-06-10 23:12         ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250606161406.GH8020@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=lmb@isovalent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox