From: Yonghong Song <yhs@fb.com>
To: Joe Stringer <joe@cilium.io>, <bpf@vger.kernel.org>
Cc: daniel@iogearbox.net, ast@kernel.org, linux-doc@vger.kernel.org,
linux-man@vger.kernel.org,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Quentin Monnet" <quentin@isovalent.com>,
"Michael Kerrisk" <mtk.manpages@gmail.com>
Subject: Re: [PATCHv2 bpf-next 01/15] bpf: Import syscall arg documentation
Date: Wed, 3 Mar 2021 12:20:00 -0800 [thread overview]
Message-ID: <9909f5ad-f532-646d-6282-73a2578dbc34@fb.com> (raw)
In-Reply-To: <f55e1371-bc0f-ba4b-3801-d0ad064cb490@fb.com>
On 3/3/21 11:38 AM, Yonghong Song wrote:
>
>
> On 3/2/21 9:19 AM, Joe Stringer wrote:
>> These descriptions are present in the man-pages project from the
>> original submissions around 2015-2016. Import them so that they can be
>> kept up to date as developers extend the bpf syscall commands.
>>
>> These descriptions follow the pattern used by scripts/bpf_helpers_doc.py
>> so that we can take advantage of the parser to generate more up-to-date
>> man page writing based upon these headers.
>>
>> Some minor wording adjustments were made to make the descriptions
>> more consistent for the description / return format.
>>
>> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> Reviewed-by: Quentin Monnet <quentin@isovalent.com>
>> Co-authored-by: Alexei Starovoitov <ast@kernel.org>
>> Co-authored-by: Michael Kerrisk <mtk.manpages@gmail.com>
>> Signed-off-by: Joe Stringer <joe@cilium.io>
>
> Ack with one nit below.
>
> Acked-by: Yonghong Song <yhs@fb.com>
>
>> ---
>> include/uapi/linux/bpf.h | 122 ++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 121 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index b89af20cfa19..fb16c590e6d9 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
>> @@ -93,7 +93,127 @@ union bpf_iter_link_info {
>> } map;
>> };
>> -/* BPF syscall commands, see bpf(2) man-page for details. */
>> +/* BPF syscall commands, see bpf(2) man-page for more details. */
>> +/**
>> + * DOC: eBPF Syscall Preamble
>> + *
>> + * The operation to be performed by the **bpf**\ () system call is
>> determined
>> + * by the *cmd* argument. Each operation takes an accompanying argument,
>> + * provided via *attr*, which is a pointer to a union of type
>> *bpf_attr* (see
>> + * below). The size argument is the size of the union pointed to by
>> *attr*.
>> + */
>> +/**
>> + * DOC: eBPF Syscall Commands
>> + *
>> + * BPF_MAP_CREATE
>> + * Description
>> + * Create a map and return a file descriptor that refers to the
>> + * map. The close-on-exec file descriptor flag (see **fcntl**\
>> (2))
>> + * is automatically enabled for the new file descriptor.
>> + *
>> + * Applying **close**\ (2) to the file descriptor returned by
>> + * **BPF_MAP_CREATE** will delete the map (but see NOTES).
>> + *
>> + * Return
>> + * A new file descriptor (a nonnegative integer), or -1 if an
>> + * error occurred (in which case, *errno* is set appropriately).
>> + *
> [...]
>> + * BPF_PROG_LOAD
>> + * Description
>> + * Verify and load an eBPF program, returning a new file
>> + * descriptor associated with the program.
>> + *
>> + * Applying **close**\ (2) to the file descriptor returned by
>> + * **BPF_PROG_LOAD** will unload the eBPF program (but see
>> NOTES).
>> + *
>> + * The close-on-exec file descriptor flag (see **fcntl**\ (2)) is
>> + * automatically enabled for the new file descriptor.
>> + *
>> + * Return
>> + * A new file descriptor (a nonnegative integer), or -1 if an
>> + * error occurred (in which case, *errno* is set appropriately).
>> + *
>> + * NOTES
>> + * eBPF objects (maps and programs) can be shared between processes.
>> + * 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.
>
> if the object is pinned, the object will be live if the pinned file is
> not removed. The file description can refer to a link file descriptor or
> an iterator file descriptor which will (indirectly) hold a reference
> count to the program as well. It will be good we can clarify a little
> more in Patch #2 at NOTES section after other bpf syscall commands are
> introduced.
Sorry. Looks like NOTES are properly updated in patch #4. So you can
ignore this comment.
>
>> + */
>> enum bpf_cmd {
>> BPF_MAP_CREATE,
>> BPF_MAP_LOOKUP_ELEM,
>>
next prev parent reply other threads:[~2021-03-04 0:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 17:19 [PATCHv2 bpf-next 00/15] Improve BPF syscall command documentation Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 01/15] bpf: Import syscall arg documentation Joe Stringer
2021-03-03 19:38 ` Yonghong Song
2021-03-03 20:20 ` Yonghong Song [this message]
2021-03-02 17:19 ` [PATCHv2 bpf-next 02/15] bpf: Add minimal bpf() command documentation Joe Stringer
2021-03-03 19:44 ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 03/15] bpf: Document BPF_F_LOCK in syscall commands Joe Stringer
2021-03-03 20:16 ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 04/15] bpf: Document BPF_PROG_PIN syscall command Joe Stringer
2021-03-03 20:21 ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 05/15] bpf: Document BPF_PROG_ATTACH " Joe Stringer
2021-03-03 20:23 ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 06/15] bpf: Document BPF_PROG_TEST_RUN " Joe Stringer
2021-03-03 20:29 ` Yonghong Song
2021-03-03 23:53 ` Joe Stringer
2021-04-10 18:12 ` Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 07/15] bpf: Document BPF_PROG_QUERY " Joe Stringer
2021-03-03 20:31 ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 08/15] bpf: Document BPF_MAP_*_BATCH syscall commands Joe Stringer
2021-03-03 17:38 ` Brian Vazquez
2021-03-03 20:44 ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 09/15] scripts/bpf: Abstract eBPF API target parameter Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 10/15] scripts/bpf: Add syscall commands printer Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 11/15] tools/bpf: Remove bpf-helpers from bpftool docs Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 12/15] selftests/bpf: Templatize man page generation Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 13/15] selftests/bpf: Test syscall command parsing Joe Stringer
2021-03-03 22:23 ` Yonghong Song
2021-03-03 23:50 ` Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 14/15] docs/bpf: Add bpf() syscall command reference Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 15/15] tools: Sync uapi bpf.h header with latest changes Joe Stringer
2021-03-03 17:25 ` [PATCHv2 bpf-next 00/15] Improve BPF syscall command documentation Jonathan Corbet
2021-03-03 18:50 ` Joe Stringer
2021-03-05 2:51 ` Alexei Starovoitov
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=9909f5ad-f532-646d-6282-73a2578dbc34@fb.com \
--to=yhs@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=joe@cilium.io \
--cc=linux-doc@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=quentin@isovalent.com \
--cc=toke@redhat.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