[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8a3825e2-4e86-4570-94e7-362ec9dd55f8@linux.dev>
Date: Fri, 6 Feb 2026 10:50:43 +0800
From: Leon Hwang <leon.hwang@...ux.dev>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau
<martin.lau@...ux.dev>, Eduard Zingerman <eddyz87@...il.com>,
Song Liu <song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Shuah Khan <shuah@...nel.org>, Christian Brauner <brauner@...nel.org>,
Seth Forshee <sforshee@...nel.org>, Yuichiro Tsuji <yuichtsu@...zon.com>,
Andrey Albershteyn <aalbersh@...hat.com>,
Willem de Bruijn <willemb@...gle.com>, Jason Xing
<kerneljasonxing@...il.com>, Tao Chen <chen.dylane@...ux.dev>,
Mykyta Yatsenko <yatsenko@...a.com>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Anton Protopopov <a.s.protopopov@...il.com>, Amery Hung
<ameryhung@...il.com>, Rong Tao <rongtao@...tc.cn>,
LKML <linux-kernel@...r.kernel.org>, Linux API <linux-api@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>,
kernel-patches-bot@...com
Subject: Re: [PATCH bpf-next v9 9/9] selftests/bpf: Add tests to verify map
create failure log
On 6/2/26 07:18, Alexei Starovoitov wrote:
> On Wed, Feb 4, 2026 at 7:54 PM Leon Hwang <leon.hwang@...ux.dev> wrote:
>>
>>
>>
>> On 5/2/26 04:14, Alexei Starovoitov wrote:
>>> On Mon, Feb 2, 2026 at 6:43 AM Leon Hwang <leon.hwang@...ux.dev> wrote:
>>>>
>>>> +
>>>> +#define BPF_LOG_FIXED 8
>>>> +
>>>> +static void test_map_create(enum bpf_map_type map_type, const char *map_name,
>>>> + struct bpf_map_create_opts *opts, const char *exp_msg)
>>>> +{
>>>> + const int key_size = 4, value_size = 4, max_entries = 1;
>>>> + char log_buf[128];
>>>> + int fd;
>>>> + LIBBPF_OPTS(bpf_log_opts, log_opts);
>>>> +
>>>> + log_buf[0] = '\0';
>>>> + log_opts.log_buf = log_buf;
>>>> + log_opts.log_size = sizeof(log_buf);
>>>> + log_opts.log_level = BPF_LOG_FIXED;
>>>
>>> Why? Which part of the test needs the log with this flag?
>>
>> BPF_LOG_FIXED looks odd here.
>>
>> This test sets 'log_level = BPF_LOG_FIXED' to match the behavior of
>> bpf_vlog_init() as initialized by bpf_log_attr_create_vlog() in
>> patch #7. BPF_LOG_FIXED is intended to be the default log_level
>> there.
>
> I don't think you answered my question.
> bpf_vlog_init() is using whatever log_level user space provided.
> Why do you pass BPF_LOG_FIXED ?
>
The intention behind passing BPF_LOG_FIXED was to ensure the log used
the buffer in a fixed mode, since the allocated buffer was large enough
to hold the full log message from the kernel. It was not intended to
test against log_level itself.
After reviewing commit 121664093803 ("bpf: Switch BPF verifier log to be
a rotating log by default"), I realized that BPF_LOG_FIXED was
introduced specifically to disable the rotating log behavior. In this
test case, that distinction is not relevant, so BPF_LOG_FIXED is indeed
unnecessary.
I tested with 'log_level is 0' and 'log_level is non-zero'. The tests
fail when log_level is 0, and pass when log_level is non-zero. So I will
switch to using 'log_level = 1' in the next revision.
Thanks,
Leon
Powered by blists - more mailing lists