From: Kui-Feng Lee <sinquersw@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: thinker.li@gmail.com, bpf@vger.kernel.org, ast@kernel.org,
martin.lau@linux.dev, song@kernel.org, kernel-team@meta.com,
andrii@kernel.org, kuifeng@meta.com
Subject: Re: [RFC bpf-next v2 1/3] libbpf: Create a shadow copy for each struct_ops map if necessary.
Date: Fri, 16 Feb 2024 09:12:03 -0800 [thread overview]
Message-ID: <89506786-9efd-4d91-980d-a97ed170a02f@gmail.com> (raw)
In-Reply-To: <CAEf4BzYbyEPFOM3XXA31U3KVJpGmtEFoNOLNR4dV=n7nyb7Kgg@mail.gmail.com>
On 2/16/24 08:52, Andrii Nakryiko wrote:
>>>> @@ -487,6 +487,14 @@ struct bpf_struct_ops {
>>>> * from "data".
>>>> */
>>>> void *kern_vdata;
>>>> + /* Description of the layout that a shadow copy should look like.
>>>> + */
>>>> + const struct bpf_struct_ops_map_info *shadow_info;
>>>> + /* A shadow copy of the struct_ops data created according to the
>>>> + * layout described by shadow_info.
>>>> + */
>>>> + void *shadow_data;
>>>> + __u32 shadow_data_size;
>>> what I mentioned on cover letter, just a few lines above, before
>>> kern_vdata we have just `void *data` which initially contains whatever
>>> was set in ELF. Just expose that through bpf_map__initial_value() and
>>> teach bpftool to generate section with variables for that memory and
>>> that should be all we need, no?
>> I am not sure if read your question correctly.
>> Padding & alignments can vary in different platforms. BPF and
>> user space programs are supposed to be in different platforms.
>> So, I can not expect that the same struct has the same layout in
>> BPF/x86/and ARM, right?
> We can constraint this functionality to 64-bit host architectures, and
> then all these concerns will go away. It should be possible to make
> all this work even if the host architecture is 64-bit, but I'm not
> sure it's worth doing.
>
> Either way, we need to keep this simple and minimal, no extra
> descriptors and stuff like that.
>
Ok! I will make changes in the next version base on the assumption that
the host architecture is compatible with BPF.
next prev parent reply other threads:[~2024-02-16 17:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 2:08 [RFC bpf-next v2 0/3] Create shadow variables for struct_ops in skeletons thinker.li
2024-02-14 2:08 ` [RFC bpf-next v2 1/3] libbpf: Create a shadow copy for each struct_ops map if necessary thinker.li
2024-02-15 23:55 ` Andrii Nakryiko
2024-02-16 2:35 ` Kui-Feng Lee
2024-02-16 16:52 ` Andrii Nakryiko
2024-02-16 17:12 ` Kui-Feng Lee [this message]
2024-02-14 2:08 ` [RFC bpf-next v2 2/3] bpftool: generated shadow variables for struct_ops maps thinker.li
2024-02-14 2:08 ` [RFC bpf-next v2 3/3] selftests/bpf: Test if shadow variables work thinker.li
2024-02-15 23:50 ` [RFC bpf-next v2 0/3] Create shadow variables for struct_ops in skeletons Andrii Nakryiko
2024-02-16 2:40 ` Kui-Feng Lee
2024-02-16 16:54 ` Andrii Nakryiko
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=89506786-9efd-4d91-980d-a97ed170a02f@gmail.com \
--to=sinquersw@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=martin.lau@linux.dev \
--cc=song@kernel.org \
--cc=thinker.li@gmail.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