From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Sreevani Sreejith <ssreevani@meta.com>,
void@manifault.com, psreep@gmail.com,
Linux BPF <bpf@vger.kernel.org>,
Linux-kernel@vger.kernel.org, andrii@kernel.org, mykola@meta.com
Cc: Linux Documentation <linux-doc@vger.kernel.org>
Subject: Re: [PATCH V2 bpf-next] BPF, docs: libbpf Overview Document
Date: Fri, 10 Mar 2023 11:35:05 +0700 [thread overview]
Message-ID: <ZAqzeQZLNMyaZOck@debian.me> (raw)
In-Reply-To: <20230309224930.4106982-1-ssreevani@meta.com>
[-- Attachment #1: Type: text/plain, Size: 3113 bytes --]
On Thu, Mar 09, 2023 at 02:49:30PM -0800, Sreevani Sreejith wrote:
> From: Sreevani <ssreevani@meta.com>
>
> Summary: Document that provides an overview of libbpf features for BPF
> application development.
>
> Reviewers:
>
> Subscribers:
Please remove the boilerplate above. The summary should become patch
description.
> +======
> libbpf
> ======
Why did you promote the heading above to title heading?
> diff --git a/Documentation/bpf/libbpf/libbpf_overview.rst b/Documentation/bpf/libbpf/libbpf_overview.rst
> new file mode 100644
> index 000000000000..549469aa2d3b
> --- /dev/null
> +++ b/Documentation/bpf/libbpf/libbpf_overview.rst
> @@ -0,0 +1,238 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +.._libbpf-overview-label:
Missing space before label name. Or should the label name be
"_libbpf-overview"?
> +#################################
> +BPF App Lifecycle and libbpf APIs
> +#################################
> <snipped> ...
> +########################
> +BPF Object Skeleton File
> +########################
> <snipped> ...
> +---------------------------------------
> +Other Advantages of Using Skeleton File
> +---------------------------------------
> +
> <snipped> ...
> +###########
> +BPF Helpers
> +###########
> <snipped> ...
> +#########################################
> +BPF CO-RE (Compile Once – Run Everywhere)
> +#########################################
> <snipped> ...
See the bottom.
> +You can generate the BTF information for the running kernel with the following
> +command:
> +
> +::
> +
> +$ bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
My htmldocs build renders the code block above fine, but IMO the
convention here is to indent it.
> +The following code snippet shows how to read the parent field of a kernel
> +``task_struct`` using BPF CO-RE and libbf. The basic helper to read a field in a
> +CO-RE relocatable manner is ``bpf_core_read(dst, sz, src)``, which will read
> +``sz`` bytes from the field referenced by ``src`` into the memory pointed to by
> +``dst``.
> +
> + .. code-block:: C
> + :emphasize-lines: 6
> +
> + //...
> + struct task_struct *task = (void *)bpf_get_current_task();
> + struct task_struct *parent_task;
> + int err;
> +
> + err = bpf_core_read(&parent_task, sizeof(void *), &task->parent);
> + if (err) {
> + /* handle error */
> + }
> +
> + /* parent_task contains the value of task->parent pointer */
I guess :linenos: option also helps locating the highlighted line, right?
> +###########################
> +Getting Started with libbpf
> +###########################
> <snipped> ...
> +###############
> +libbpf and Rust
> +###############
> <snipped> ...
> +########################
> +Additional Documentation
> +########################
For section headings above, I'd like to strip the overline. Yet,
Sphinx is smart when discriminating headings based on underline/overline
character.
Thanks.
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-03-10 4:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 22:49 [PATCH V2 bpf-next] BPF, docs: libbpf Overview Document Sreevani Sreejith
2023-03-10 4:35 ` Bagas Sanjaya [this message]
[not found] <DM4PR15MB53548D70925C64EE3CEF8F86CABA9@DM4PR15MB5354.namprd15.prod.outlook.com>
2023-03-11 2:14 ` Bagas Sanjaya
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=ZAqzeQZLNMyaZOck@debian.me \
--to=bagasdotme@gmail.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=mykola@meta.com \
--cc=psreep@gmail.com \
--cc=ssreevani@meta.com \
--cc=void@manifault.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