Thread (8 messages) 8 messages, 2 authors, 2021-03-26

Re: bpf selftests and page size

From: Andrii Nakryiko <hidden>
Date: 2021-03-04 20:53:11

On Thu, Mar 4, 2021 at 12:35 PM Yauheni Kaliuta
[off-list ref] wrote:
Hi!

On Wed, Mar 3, 2021 at 7:30 PM Andrii Nakryiko
[off-list ref] wrote:
quoted
On Wed, Mar 3, 2021 at 2:40 AM Yauheni Kaliuta
[off-list ref] wrote:
quoted
Hi!

On Tue, Mar 2, 2021 at 7:08 AM Andrii Nakryiko
[off-list ref] wrote:
quoted
On Mon, Mar 1, 2021 at 1:02 AM Yauheni Kaliuta
[off-list ref] wrote:
quoted
Bunch of bpf selftests actually depends of page size and has it
hardcoded to 4K. That causes failures if page shift is configured
to values other than 12. It looks as a known issue since for the
userspace parts sysconf(_SC_PAGE_SIZE) is used, but what would be
the correct way to export it to bpf programs?
Given PAGE_SIZE and PAGE_SHIFT are just #defines, the only way seems
to be to pass it from the user-space as a read-only variable.
Compile-time? Just to make sure we are on the same page, the tests may look like
https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/map_ptr_kern.c#L638
Oh, if it's about ringbuf, then why not just bump its size to 64KB or
something even bigger.
It will work for me in this, but sounds as workaround since the value
depends of actual page size.
Not at all a work around. ringbuf needs to have the size which is a
multiple of PAGE_SIZE.
quoted
I thought that you were referring to some BPF code that needs to do some calculations based on PAGE_SIZE in runtime.
Do you mean, like that
https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/sockopt_sk.c#L12
?
yeah, here we'll need to pass actual page_size from the user-space
using global variable
There are such tests as well  :)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help