Re: [PATCH bpf-next v9 22/23] selftests/bpf: Add BPF linked list API tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/17/22 6:05 PM, Alexei Starovoitov wrote:
> On Thu, Nov 17, 2022 at 2:56 PM Kumar Kartikeya Dwivedi
> <memxor@xxxxxxxxx> 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@xxxxxxxxx>
>> ---

[...]

>> 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.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux