Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Tony Ambardar <tony.ambardar@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
	Shuah Khan <shuah@kernel.org>,
	Ilya Leoshkevich <iii@linux.ibm.com>,
	Quentin Monnet <qmo@kernel.org>
Subject: Re: [PATCH bpf-next v5 7/8] libbpf: Support creating light skeleton of either endianness
Date: Tue, 3 Sep 2024 16:52:16 -0700	[thread overview]
Message-ID: <ZtehME2iZOzrLaNU@kodidev-ubuntu> (raw)
In-Reply-To: <CAADnVQJeQvKJeJpJVh1BkrkHeY6WOaNFTh4sru-H3=ecO=qd5g@mail.gmail.com>

On Tue, Sep 03, 2024 at 12:57:51PM -0700, Alexei Starovoitov wrote:
> On Tue, Sep 3, 2024 at 12:34 AM Tony Ambardar <tony.ambardar@gmail.com> wrote:
> >
> > @@ -1040,10 +1121,11 @@ void bpf_gen__map_update_elem(struct bpf_gen *gen, int map_idx, void *pvalue,
> >         int zero = 0;
> >
> >         memset(&attr, 0, attr_size);
> > -       pr_debug("gen: map_update_elem: idx %d\n", map_idx);
> >
> >         value = add_data(gen, pvalue, value_size);
> >         key = add_data(gen, &zero, sizeof(zero));
> > +       pr_debug("gen: map_update_elem: idx %d, value: off %d size %d\n",
> > +                map_idx, value, value_size);
> >
> >         /* if (map_desc[map_idx].initial_value) {
> >          *    if (ctx->flags & BPF_SKEL_KERNEL)
> > @@ -1068,6 +1150,8 @@ void bpf_gen__map_update_elem(struct bpf_gen *gen, int map_idx, void *pvalue,
> >         emit(gen, BPF_EMIT_CALL(BPF_FUNC_probe_read_kernel));
> >
> >         map_update_attr = add_data(gen, &attr, attr_size);
> > +       pr_debug("gen: map_update_elem: attr: off %d size %d\n",
> > +                map_update_attr, attr_size);
> >         move_blob2blob(gen, attr_field(map_update_attr, map_fd), 4,
> >                        blob_fd_array_off(gen, map_idx));
> >         emit_rel_store(gen, attr_field(map_update_attr, key), key);
> 
> I don't see the point of two pr_debug("gen: map_update_elem...
> just a few lines from each other.
> 
> Other than that:
> Acked-by: Alexei Starovoitov <ast@kernel.org>

Thanks for reviewing, Alexei. I agree those could be consolidated, and I
tested the following patch to do so. I'll include it if another respin is
needed, or someone else could modify during merge otherwise.

--- a/tools/lib/bpf/gen_loader.c
+++ b/tools/lib/bpf/gen_loader.c
@@ -1124,8 +1124,6 @@ void bpf_gen__map_update_elem(struct bpf_gen *gen, int map_idx, void *pvalue,

        value = add_data(gen, pvalue, value_size);
        key = add_data(gen, &zero, sizeof(zero));
-       pr_debug("gen: map_update_elem: idx %d, value: off %d size %d\n",
-                map_idx, value, value_size);

        /* if (map_desc[map_idx].initial_value) {
         *    if (ctx->flags & BPF_SKEL_KERNEL)
@@ -1150,8 +1148,8 @@ void bpf_gen__map_update_elem(struct bpf_gen *gen, int map_idx, void *pvalue,
        emit(gen, BPF_EMIT_CALL(BPF_FUNC_probe_read_kernel));

        map_update_attr = add_data(gen, &attr, attr_size);
-       pr_debug("gen: map_update_elem: attr: off %d size %d\n",
-                map_update_attr, attr_size);
+       pr_debug("gen: map_update_elem: idx %d, value: off %d size %d, attr: off %d size %d\n",
+                map_idx, value, value_size, map_update_attr, attr_size);
        move_blob2blob(gen, attr_field(map_update_attr, map_fd), 4,
                       blob_fd_array_off(gen, map_idx));
        emit_rel_store(gen, attr_field(map_update_attr, key), key);


  reply	other threads:[~2024-09-03 23:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03  7:32 [PATCH bpf-next v5 0/8] libbpf, selftests/bpf: Support cross-endian usage Tony Ambardar
2024-09-03  7:32 ` [PATCH bpf-next v5 1/8] libbpf: Improve log message formatting Tony Ambardar
2024-09-03  7:32 ` [PATCH bpf-next v5 2/8] libbpf: Fix header comment typos for BTF.ext Tony Ambardar
2024-09-03  7:33 ` [PATCH bpf-next v5 3/8] libbpf: Fix output .symtab byte-order during linking Tony Ambardar
2024-09-03  7:33 ` [PATCH bpf-next v5 4/8] libbpf: Support BTF.ext loading and output in either endianness Tony Ambardar
2024-09-04 19:48   ` Andrii Nakryiko
2024-09-16  8:21     ` Tony Ambardar
2024-09-03  7:33 ` [PATCH bpf-next v5 5/8] libbpf: Support opening bpf objects of " Tony Ambardar
2024-09-04 19:50   ` Andrii Nakryiko
2024-09-03  7:33 ` [PATCH bpf-next v5 6/8] libbpf: Support linking " Tony Ambardar
2024-09-04 19:51   ` Andrii Nakryiko
2024-09-03  7:33 ` [PATCH bpf-next v5 7/8] libbpf: Support creating light skeleton " Tony Ambardar
2024-09-03 19:57   ` Alexei Starovoitov
2024-09-03 23:52     ` Tony Ambardar [this message]
2024-09-03  7:33 ` [PATCH bpf-next v5 8/8] selftests/bpf: Support cross-endian building Tony Ambardar
2024-09-04  5:52   ` Yonghong Song

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=ZtehME2iZOzrLaNU@kodidev-ubuntu \
    --to=tony.ambardar@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=iii@linux.ibm.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=qmo@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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