BPF List
 help / color / mirror / Atom feed
From: Dave Marchevsky <davemarchevsky@meta.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH bpf-next v9 22/23] selftests/bpf: Add BPF linked list API tests
Date: Thu, 17 Nov 2022 18:27:50 -0500	[thread overview]
Message-ID: <e3b2d51e-22ae-b6b3-b618-b410dbdf89ce@meta.com> (raw)
In-Reply-To: <CAADnVQKHibbQUNkwvd0g3YDK8n7k6g21=_TFd1=ccRFYJWrsOA@mail.gmail.com>

On 11/17/22 6:05 PM, Alexei Starovoitov wrote:
> On Thu, Nov 17, 2022 at 2:56 PM Kumar Kartikeya Dwivedi
> <memxor@gmail.com> wrote:
>>
>> Include various tests covering the success and failure cases. Also, run
>> the success cases at runtime to verify correctness of linked list
>> manipulation routines, in addition to ensuring successful verification.
>>
>> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
>> ---

[...]

>> diff --git a/tools/testing/selftests/bpf/progs/linked_list.h b/tools/testing/selftests/bpf/progs/linked_list.h
>> new file mode 100644
>> index 000000000000..8db80ed64db1
>> --- /dev/null
>> +++ b/tools/testing/selftests/bpf/progs/linked_list.h
>> @@ -0,0 +1,56 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +#ifndef LINKED_LIST_H
>> +#define LINKED_LIST_H
>> +
>> +#include <vmlinux.h>
>> +#include <bpf/bpf_helpers.h>
>> +#include "bpf_experimental.h"
>> +
>> +struct bar {
>> +       struct bpf_list_node node;
>> +       int data;
>> +};
>> +
>> +struct foo {
>> +       struct bpf_list_node node;
>> +       struct bpf_list_head head __contains(bar, node);
>> +       struct bpf_spin_lock lock;
>> +       int data;
>> +       struct bpf_list_node node2;
>> +};
>> +
>> +struct map_value {
>> +       struct bpf_spin_lock lock;
>> +       int data;
>> +       struct bpf_list_head head __contains(foo, node);
>> +};
>> +
>> +struct array_map {
>> +       __uint(type, BPF_MAP_TYPE_ARRAY);
>> +       __type(key, int);
>> +       __type(value, struct map_value);
>> +       __uint(max_entries, 1);
>> +};
>> +
>> +struct array_map array_map SEC(".maps");
>> +struct array_map inner_map SEC(".maps");
>> +
>> +struct {
>> +       __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
>> +       __uint(max_entries, 1);
>> +       __type(key, int);
>> +       __type(value, int);
>> +       __array(values, struct array_map);
>> +} map_of_maps SEC(".maps") = {
>> +       .values = {
>> +               [0] = &inner_map,
>> +       },
>> +};
>> +
>> +#define private(name) SEC(".data." #name) __hidden __attribute__((aligned(8)))
>> +
>> +private(A) struct bpf_spin_lock glock;
>> +private(A) struct bpf_list_head ghead __contains(foo, node);
>> +private(B) struct bpf_spin_lock glock2;
> 
> The latest llvm crashes with a bug here:
> 
> fatal error: error in backend: unable to write nop sequence of 4 bytes
> 
> Please see BPF CI.
> 
> So far I wasn't able to find a manual workaround :(
> Please give it a shot too.
> 
> Or disable the test for this case for now?

I noticed this in an earlier version of the series.
Will be submitting a fix to LLVM upstream today.

Until that's settled, reverting commit 463da422f019 ("MC: make section classification a bit more thorough")
in LLVM will fix the issue.

  reply	other threads:[~2022-11-17 23:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 22:54 [PATCH bpf-next v9 00/23] Allocated objects, BPF linked lists Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 01/23] bpf: Fix early return in map_check_btf Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 02/23] bpf: Do btf_record_free outside map_free callback Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 03/23] bpf: Free inner_map_meta when btf_record_dup fails Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 04/23] bpf: Populate field_offs for inner_map_meta Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 05/23] bpf: Introduce allocated objects support Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 06/23] bpf: Recognize lock and list fields in allocated objects Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 07/23] bpf: Verify ownership relationships for user BTF types Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 08/23] bpf: Allow locking bpf_spin_lock in allocated objects Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 09/23] bpf: Allow locking bpf_spin_lock global variables Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 10/23] bpf: Allow locking bpf_spin_lock in inner map values Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 11/23] bpf: Rewrite kfunc argument handling Kumar Kartikeya Dwivedi
2022-11-17 22:54 ` [PATCH bpf-next v9 12/23] bpf: Support constant scalar arguments for kfuncs Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 13/23] bpf: Introduce bpf_obj_new Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 14/23] bpf: Introduce bpf_obj_drop Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 15/23] bpf: Permit NULL checking pointer with non-zero fixed offset Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 16/23] bpf: Introduce single ownership BPF linked list API Kumar Kartikeya Dwivedi
2022-11-18  0:12   ` Alexei Starovoitov
2022-11-17 22:55 ` [PATCH bpf-next v9 17/23] bpf: Add 'release on unlock' logic for bpf_list_push_{front,back} Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 18/23] bpf: Add comments for map BTF matching requirement for bpf_list_head Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 19/23] selftests/bpf: Add __contains macro to bpf_experimental.h Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 20/23] selftests/bpf: Update spinlock selftest Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 21/23] selftests/bpf: Add failure test cases for spin lock pairing Kumar Kartikeya Dwivedi
2022-11-17 22:55 ` [PATCH bpf-next v9 22/23] selftests/bpf: Add BPF linked list API tests Kumar Kartikeya Dwivedi
2022-11-17 23:05   ` Alexei Starovoitov
2022-11-17 23:27     ` Dave Marchevsky [this message]
2022-11-17 23:58       ` Kumar Kartikeya Dwivedi
2022-11-18  0:05         ` Alexei Starovoitov
2022-11-17 23:29     ` Yonghong Song
2022-11-17 22:55 ` [PATCH bpf-next v9 23/23] selftests/bpf: Add BTF sanity tests Kumar Kartikeya Dwivedi

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=e3b2d51e-22ae-b6b3-b618-b410dbdf89ce@meta.com \
    --to=davemarchevsky@meta.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.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