From: Martin KaFai Lau <martin.lau@linux.dev>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
kernel-team@meta.com, "Jose E. Marchesi" <jemarch@gnu.org>,
David Faust <david.faust@oracle.com>
Subject: Re: [PATCH v3 bpf-next 5/5] selftests/bpf: Add bench for task storage creation
Date: Wed, 29 Mar 2023 10:02:55 -0700 [thread overview]
Message-ID: <456bcd47-efa2-7e3d-78c0-5f41ecba477c@linux.dev> (raw)
In-Reply-To: <CADvTj4rP3kPODxARVTEs2HsNFOof-BZtr8OsEKdjgcGVOTqKaA@mail.gmail.com>
On 3/27/23 8:51 PM, James Hilliard wrote:
>> diff --git a/tools/testing/selftests/bpf/progs/bench_local_storage_create.c b/tools/testing/selftests/bpf/progs/bench_local_storage_create.c
>> index 2814bab54d28..7c851c9d5e47 100644
>> --- a/tools/testing/selftests/bpf/progs/bench_local_storage_create.c
>> +++ b/tools/testing/selftests/bpf/progs/bench_local_storage_create.c
>> @@ -22,6 +22,13 @@ struct {
>> __type(value, struct storage);
>> } sk_storage_map SEC(".maps");
>>
>> +struct {
>> + __uint(type, BPF_MAP_TYPE_TASK_STORAGE);
>> + __uint(map_flags, BPF_F_NO_PREALLOC);
>> + __type(key, int);
>> + __type(value, struct storage);
>> +} task_storage_map SEC(".maps");
>> +
>> SEC("raw_tp/kmalloc")
>> int BPF_PROG(kmalloc, unsigned long call_site, const void *ptr,
>> size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags,
>> @@ -32,6 +39,24 @@ int BPF_PROG(kmalloc, unsigned long call_site, const void *ptr,
>> return 0;
>> }
>>
>> +SEC("tp_btf/sched_process_fork")
>> +int BPF_PROG(fork, struct task_struct *parent, struct task_struct *child)
>
> Apparently fork is a built-in function in bpf-gcc:
It is also failing in a plain C program
#> gcc -Werror=builtin-declaration-mismatch -o test test.c
test.c:14:35: error: conflicting types for built-in function ‘fork’; expected
‘int(void)’ [-Werror=builtin-declaration-mismatch]
14 | int __attribute__((__noinline__)) fork(long x, long y)
| ^~~~
cc1: some warnings being treated as errors
#> clang -o test test.c
succeed
I am not too attached to the name but it seems something should be addressed in
the gcc instead.
>
> In file included from progs/bench_local_storage_create.c:6:
> progs/bench_local_storage_create.c:43:14: error: conflicting types for
> built-in function 'fork'; expected 'int(void)'
> [-Werror=builtin-declaration-mismatch]
> 43 | int BPF_PROG(fork, struct task_struct *parent, struct
> task_struct *child)
> | ^~~~
>
> I haven't been able to find this documented anywhere however.
next prev parent reply other threads:[~2023-03-29 17:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 21:52 [PATCH v3 bpf-next 0/5] bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 1/5] bpf: Add a few bpf mem allocator functions Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 2/5] bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage_elem Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 3/5] bpf: Use bpf_mem_cache_alloc/free for bpf_local_storage Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 4/5] selftests/bpf: Test task storage when local_storage->smap is NULL Martin KaFai Lau
2023-03-22 21:52 ` [PATCH v3 bpf-next 5/5] selftests/bpf: Add bench for task storage creation Martin KaFai Lau
2023-03-28 3:51 ` James Hilliard
2023-03-29 17:02 ` Martin KaFai Lau [this message]
2023-03-29 19:12 ` James Hilliard
2023-03-29 19:59 ` Martin KaFai Lau
2023-03-29 20:03 ` James Hilliard
2023-03-29 20:07 ` Martin KaFai Lau
2023-03-30 7:51 ` James Hilliard
2023-03-30 18:12 ` Martin KaFai Lau
2023-03-26 3:12 ` [PATCH v3 bpf-next 0/5] bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage patchwork-bot+netdevbpf
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=456bcd47-efa2-7e3d-78c0-5f41ecba477c@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=david.faust@oracle.com \
--cc=james.hilliard1@gmail.com \
--cc=jemarch@gnu.org \
--cc=kernel-team@meta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.