From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Network Development <netdev@vger.kernel.org>,
bpf <bpf@vger.kernel.org>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v2 bpf-next 1/3] bpf: Introduce bpf_timer
Date: Mon, 14 Jun 2021 20:33:17 -0700 [thread overview]
Message-ID: <CAADnVQKKrb1kz_C-v7RcgYgEe_JPhhpL4W6ySM28HcE_g=ncVw@mail.gmail.com> (raw)
In-Reply-To: <f36d19e7-cc6f-730b-cf13-d77e1ce88d2f@fb.com>
On Fri, Jun 11, 2021 at 3:12 PM Yonghong Song <yhs@fb.com> wrote:
> > +struct bpf_hrtimer {
> > + struct hrtimer timer;
> > + struct bpf_map *map;
> > + struct bpf_prog *prog;
> > + void *callback_fn;
> > + void *value;
> > +};
> > +
> > +/* the actual struct hidden inside uapi struct bpf_timer */
> > +struct bpf_timer_kern {
> > + struct bpf_hrtimer *timer;
> > + struct bpf_spin_lock lock;
> > +};
>
> Looks like in 32bit system, sizeof(struct bpf_timer_kern) is 64
> and sizeof(struct bpf_timer) is 128.
>
> struct bpf_spin_lock {
> __u32 val;
> };
>
> struct bpf_timer {
> __u64 :64;
> __u64 :64;
> };
>
> Checking the code, we may not have issues as structure
> "bpf_timer" is only used to reserve spaces and
> map copy value routine handles that properly.
>
> Maybe we can still make it consistent with
> two fields in bpf_timer_kern mapping to
> two fields in bpf_timer?
>
> struct bpf_timer_kern {
> __bpf_md_ptr(struct bpf_hrtimer *, timer);
> struct bpf_spin_lock lock;
> };
Such alignment of fields is not necessary,
since the fields are not accessible directly from bpf prog.
struct bpf_timer_kern needs to fit into struct bpf_timer and
alignof these two structs needs to be the same.
That's all. I'll add build_bug_on to make sure.
next prev parent reply other threads:[~2021-06-15 3:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-11 4:24 [PATCH v2 bpf-next 0/3] bpf: Introduce BPF timers Alexei Starovoitov
2021-06-11 4:24 ` [PATCH v2 bpf-next 1/3] bpf: Introduce bpf_timer Alexei Starovoitov
2021-06-11 6:42 ` Cong Wang
2021-06-11 18:45 ` Alexei Starovoitov
2021-06-15 6:10 ` Cong Wang
2021-06-16 4:53 ` Alexei Starovoitov
2021-06-11 7:05 ` Cong Wang
2021-06-11 22:12 ` Yonghong Song
2021-06-15 3:33 ` Alexei Starovoitov [this message]
2021-06-15 4:21 ` Yonghong Song
2021-06-14 16:51 ` Yonghong Song
2021-06-15 3:29 ` Alexei Starovoitov
2021-06-15 5:31 ` Andrii Nakryiko
2021-06-15 5:40 ` Alexei Starovoitov
2021-06-15 15:24 ` Andrii Nakryiko
2021-06-16 4:26 ` Alexei Starovoitov
2021-06-16 5:54 ` Andrii Nakryiko
2021-06-16 16:52 ` Alexei Starovoitov
2021-06-15 4:48 ` Andrii Nakryiko
2021-06-11 4:24 ` [PATCH v2 bpf-next 2/3] bpf: Add verifier checks for bpf_timer Alexei Starovoitov
2021-06-11 4:24 ` [PATCH v2 bpf-next 3/3] selftests/bpf: Add bpf_timer test Alexei Starovoitov
2021-06-11 6:47 ` [PATCH v2 bpf-next 0/3] bpf: Introduce BPF timers Cong Wang
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='CAADnVQKKrb1kz_C-v7RcgYgEe_JPhhpL4W6ySM28HcE_g=ncVw@mail.gmail.com' \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=yhs@fb.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).