From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Sreevani Sreejith <ssreevani@meta.com>,
void@manifault.com, psreep@gmail.com, bpf@vger.kernel.org,
Linux-kernel@vger.kernel.org, andrii@kernel.org, mykola@meta.com
Cc: linux-doc@vger.kernel.org
Subject: Re: [PATCH V3 bpf-next] BPF, docs: libbpf Overview Document
Date: Mon, 13 Mar 2023 16:44:59 +0700 [thread overview]
Message-ID: <ZA7wm8scokV+XPav@debian.me> (raw)
In-Reply-To: <20230310180928.2462527-1-ssreevani@meta.com>
[-- Attachment #1: Type: text/plain, Size: 2500 bytes --]
On Fri, Mar 10, 2023 at 10:09:28AM -0800, Sreevani Sreejith wrote:
> From: Sreevani <ssreevani@meta.com>
>
> Summary: Document that provides an overview of libbpf features for BPF
> application development.
It seems like you ignore some of my reviews at [1]. Anyway, I repeat
them here, augmenting my new comments.
The patch description should have been "Document overview of libbpf,
including its features for developing BPF programs.".
> +######
> libbpf
> -======
> +######
Why did you add heading overline and change the heading character marker?
> +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 */
You may want to also add :lineos: option or manually add line numbers
if you add :emphasize-lines: so that readers can see the line number
it refers to.
> +Also, find the libbpf API documentation `here
> +<https://libbpf.readthedocs.io/en/latest/api.html>`_
"See also `libbpf API documentation <link>`_".
> +
> +libbpf and Rust
> +===============
> +
> +If you are building BPF applications in Rust, it is recommended to use the
> +`Libbpf-rs <https://github.com/libbpf/libbpf-rs>`_ library instead of bindgen
> +bindings directly to libbpf. Libbpf-rs wraps libbpf functionality in
> +Rust-idiomatic interfaces and provides libbpf-cargo plugin to handle BPF code
> +compilation and skeleton generation. Using Libbpf-rs will make building user
> +space part of the BPF application easier. Note that the BPF program themselves
> +must still be written in plain C.
BPF apps are application that use BPF program, right? I thought that
despite there is libbpf-rs, I still have to develop BPF apps in C.
Thanks.
[1]: https://lore.kernel.org/linux-doc/ZAqzeQZLNMyaZOck@debian.me/
--
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-13 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 18:09 [PATCH V3 bpf-next] BPF, docs: libbpf Overview Document Sreevani Sreejith
2023-03-13 9:44 ` Bagas Sanjaya [this message]
2023-03-13 12:59 ` David Vernet
2023-03-15 3:28 ` Bagas Sanjaya
2023-03-15 5:53 ` David Vernet
2023-03-15 16:36 ` Sreevani Sreejith
2023-03-13 13:03 ` David Vernet
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=ZA7wm8scokV+XPav@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;
as well as URLs for NNTP newsgroup(s).