From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Alexei Starovoitov <ast-uqk4Ao+rVK5Wk0Htik3J/w@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Silvan Jegen <s.jegen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Daniel Borkmann <daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>,
Walter Harms <wharms-fPG8STNUNVg@public.gmane.org>
Subject: Re: Edited draft of bpf(2) man page for review/enhancement
Date: Wed, 22 Jul 2015 19:59:12 +0200 [thread overview]
Message-ID: <55AFD9F0.8030404@gmail.com> (raw)
In-Reply-To: <55AFD64E.9040105-uqk4Ao+rVK5Wk0Htik3J/w@public.gmane.org>
On 07/22/2015 07:43 PM, Alexei Starovoitov wrote:
> On 7/22/15 7:52 AM, Michael Kerrisk (man-pages) wrote:
>>> As Daniel said there is no spec for this C. It's a normal C where
>>> things like loops, global variables, vararg, floating point,
>>> struct passing and bunch of other things are not supported.
>>
>> I assume we're talking about the LLVM front-end, right?
>
> yes. clang.
> There is a bpf backend for gcc, but it's bit rotting now.
Okay.
>> Am I correct that these kernel source files are examples of this restricted C:
>>
>> samples/bpf/tcbpf1_kern.c
>> samples/bpf/tracex2_kern.c
>> samples/bpf/tracex4_kern.c
>> samples/bpf/tracex1_kern.c
>> samples/bpf/tracex3_kern.c
>> samples/bpf/sockex1_kern.c
>> samples/bpf/sockex2_kern.c
>
> yes.
Thanks.
>> And samples/bpf/Makefile shows the necessary LLVM incantation
>> to produce the BPF binaries, right?
>
> yes.
> Now with llvm 3.7 coming out soon it's even simpler. Just:
> clang -O2 -target bpf -c file.c
Okay.
>> Anyway, I added the following text in NOTES:
>>
>> eBPF objects (maps and programs) can be shared between pro‐
>> cesses. For example, after fork(2), the child inherits file
>> descriptors referring to the same eBPF objects. In addition,
>> file descriptors referring to eBPF objects can be transferred
>> over UNIX domain sockets. File descriptors referring to eBPF
>> objects can be duplicated in the usual way, using dup(2) and
>> similar calls. An eBPF object is deallocated only after all
>> file descriptors referring to the object have been closed.
>>
>> Is the above all correct?
>
> yes. all correct.
Thanks.
>> This makes me curious: why was the BPF functionality not designed as
>> a *set* of system calls (as per these wrappers), rather than the existing
>> multiplexed call?
>
> because new commands are much easier to add to existing syscall
> instead of adding new syscall for every new command.
>
>> [[
>> If
>> .I key
>> is found, the operation returns zero and sets the
>> .I next_key
>> pointer to the key of the next element.
>> ]]
>>
>> right?
>
> yes.
Thanks.
>>>> BPF_MOV64_IMM(BPF_REG_1, 1), /* r1 = 1 */
>>>> BPF_XADD(BPF_DW, BPF_REG_0, BPF_REG_1, 0, 0),
>>>> .\" FIXME What does 'lock' in the line below mean?
>>>> /* lock *(u64 *) r0 += r1 */
>>>
>>> it means that it's 'lock xadd' equivalent.
>>
>> Sorry -- you've assumed I'm cleverer than I am... :-}
>> I'm not wiser after that comment. What is 'lock xadd'?
>
> I meant that it is == atomic64_add
Okay.
>> If you might have a chance to look at my questions above and
>> let me know your thoughts, then I could further edit the page
>> before sending out the next draft.
>
> I think would be great to get some form of the man page out and
> work on it incrementally. Quite a few folks have asked for it.
I think another pass would be best done first. I'll try to be quicker.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Alexei Starovoitov <ast@plumgrid.com>
Cc: mtk.manpages@gmail.com, Silvan Jegen <s.jegen@gmail.com>,
linux-man@vger.kernel.org, linux-kernel@vger.kernel.org,
Daniel Borkmann <daniel@iogearbox.net>,
Walter Harms <wharms@bfs.de>
Subject: Re: Edited draft of bpf(2) man page for review/enhancement
Date: Wed, 22 Jul 2015 19:59:12 +0200 [thread overview]
Message-ID: <55AFD9F0.8030404@gmail.com> (raw)
In-Reply-To: <55AFD64E.9040105@plumgrid.com>
On 07/22/2015 07:43 PM, Alexei Starovoitov wrote:
> On 7/22/15 7:52 AM, Michael Kerrisk (man-pages) wrote:
>>> As Daniel said there is no spec for this C. It's a normal C where
>>> things like loops, global variables, vararg, floating point,
>>> struct passing and bunch of other things are not supported.
>>
>> I assume we're talking about the LLVM front-end, right?
>
> yes. clang.
> There is a bpf backend for gcc, but it's bit rotting now.
Okay.
>> Am I correct that these kernel source files are examples of this restricted C:
>>
>> samples/bpf/tcbpf1_kern.c
>> samples/bpf/tracex2_kern.c
>> samples/bpf/tracex4_kern.c
>> samples/bpf/tracex1_kern.c
>> samples/bpf/tracex3_kern.c
>> samples/bpf/sockex1_kern.c
>> samples/bpf/sockex2_kern.c
>
> yes.
Thanks.
>> And samples/bpf/Makefile shows the necessary LLVM incantation
>> to produce the BPF binaries, right?
>
> yes.
> Now with llvm 3.7 coming out soon it's even simpler. Just:
> clang -O2 -target bpf -c file.c
Okay.
>> Anyway, I added the following text in NOTES:
>>
>> eBPF objects (maps and programs) can be shared between pro‐
>> cesses. For example, after fork(2), the child inherits file
>> descriptors referring to the same eBPF objects. In addition,
>> file descriptors referring to eBPF objects can be transferred
>> over UNIX domain sockets. File descriptors referring to eBPF
>> objects can be duplicated in the usual way, using dup(2) and
>> similar calls. An eBPF object is deallocated only after all
>> file descriptors referring to the object have been closed.
>>
>> Is the above all correct?
>
> yes. all correct.
Thanks.
>> This makes me curious: why was the BPF functionality not designed as
>> a *set* of system calls (as per these wrappers), rather than the existing
>> multiplexed call?
>
> because new commands are much easier to add to existing syscall
> instead of adding new syscall for every new command.
>
>> [[
>> If
>> .I key
>> is found, the operation returns zero and sets the
>> .I next_key
>> pointer to the key of the next element.
>> ]]
>>
>> right?
>
> yes.
Thanks.
>>>> BPF_MOV64_IMM(BPF_REG_1, 1), /* r1 = 1 */
>>>> BPF_XADD(BPF_DW, BPF_REG_0, BPF_REG_1, 0, 0),
>>>> .\" FIXME What does 'lock' in the line below mean?
>>>> /* lock *(u64 *) r0 += r1 */
>>>
>>> it means that it's 'lock xadd' equivalent.
>>
>> Sorry -- you've assumed I'm cleverer than I am... :-}
>> I'm not wiser after that comment. What is 'lock xadd'?
>
> I meant that it is == atomic64_add
Okay.
>> If you might have a chance to look at my questions above and
>> let me know your thoughts, then I could further edit the page
>> before sending out the next draft.
>
> I think would be great to get some form of the man page out and
> work on it incrementally. Quite a few folks have asked for it.
I think another pass would be best done first. I'll try to be quicker.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
next prev parent reply other threads:[~2015-07-22 17:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-27 8:43 Edited draft of bpf(2) man page for review/enhancement Michael Kerrisk (man-pages)
[not found] ` <556583B4.4000607-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-27 9:26 ` Daniel Borkmann
2015-05-27 9:26 ` Daniel Borkmann
[not found] ` <55658DB4.6000106-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>
2015-07-22 14:49 ` Michael Kerrisk (man-pages)
2015-07-22 14:49 ` Michael Kerrisk (man-pages)
[not found] ` <55AFAD7A.6090009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-22 15:12 ` Daniel Borkmann
2015-07-22 15:12 ` Daniel Borkmann
[not found] ` <55AFB2E0.5060307-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>
2015-07-22 15:58 ` Michael Kerrisk (man-pages)
2015-07-22 15:58 ` Michael Kerrisk (man-pages)
2015-05-28 4:49 ` Alexei Starovoitov
2015-05-28 4:49 ` Alexei Starovoitov
2015-07-21 9:43 ` Daniel Borkmann
[not found] ` <55669E44.6050907-uqk4Ao+rVK5Wk0Htik3J/w@public.gmane.org>
2015-07-22 14:52 ` Michael Kerrisk (man-pages)
2015-07-22 14:52 ` Michael Kerrisk (man-pages)
[not found] ` <55AFAE47.70209-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-22 17:43 ` Alexei Starovoitov
2015-07-22 17:43 ` Alexei Starovoitov
[not found] ` <55AFD64E.9040105-uqk4Ao+rVK5Wk0Htik3J/w@public.gmane.org>
2015-07-22 17:59 ` Michael Kerrisk (man-pages) [this message]
2015-07-22 17:59 ` Michael Kerrisk (man-pages)
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=55AFD9F0.8030404@gmail.com \
--to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=ast-uqk4Ao+rVK5Wk0Htik3J/w@public.gmane.org \
--cc=daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=s.jegen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wharms-fPG8STNUNVg@public.gmane.org \
/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.