All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] samples: bpf: avoid name collision with kernel enum values
Date: Mon, 27 Sep 2021 18:01:27 +0200	[thread overview]
Message-ID: <87mtnyj9d4.fsf@toke.dk> (raw)
In-Reply-To: <20210927134629.4cnzf25dfbprxwbc@apollo.localdomain>

Kumar Kartikeya Dwivedi <memxor@gmail.com> writes:

> On Mon, Sep 27, 2021 at 06:07:30PM IST, Toke Høiland-Jørgensen wrote:
>> Kumar Kartikeya Dwivedi <memxor@gmail.com> writes:
>>
>> > In xdp_redirect_map_multi.bpf.c, on newer kernels samples compilation
>> > fails when vmlinux.h is generated from a kernel supporting broadcast for
>> > devmap. Hence, avoid naming collisions to prevent build failure.
>>
>> Hmm, shouldn't the sample just be getting the value from the kernel in
>> the first place instead of re-defining it?
>>
>
> True, but in general my assumption was that it could be built with a older
> kernel's vmlinux.h, but be ran on a newer one. If that's not strictly needed, I
> can just drop it.

But the code is still making assumptions about the contents of
vmlinux.h, isn't it? Like the size (and existence) of struct
bpf_devmap_val.

> This can also be the case if you haven't built the kernel in the tree
> (just did a make headers_install), it then falls back to generating
> the vmlinux.h from the running kernel.

This seems a bit brittle. Given that the samples are distributed with
the kernel sources, I would expect them to always correspond to the
kernel version in the source tree they're in and not randomly break if
the running kernel is different...

-Toke


      reply	other threads:[~2021-09-27 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 12:56 [PATCH bpf-next] samples: bpf: avoid name collision with kernel enum values Kumar Kartikeya Dwivedi
2021-09-27 12:37 ` Toke Høiland-Jørgensen
2021-09-27 13:46   ` Kumar Kartikeya Dwivedi
2021-09-27 16:01     ` Toke Høiland-Jørgensen [this message]

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=87mtnyj9d4.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=memxor@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.