BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>,
	ast@kernel.org,  daniel@iogearbox.net, andrii@kernel.org
Cc: martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
	 john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	haoluo@google.com,  jolsa@kernel.org, mykolal@fb.com,
	bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] selftests/bpf: fix uprobe_multi compilation error
Date: Thu, 26 Sep 2024 16:44:48 -0700	[thread overview]
Message-ID: <084902540a09a7036b713bd2336955e9b63fb30b.camel@gmail.com> (raw)
In-Reply-To: <20240926144948.172090-1-alan.maguire@oracle.com>

On Thu, 2024-09-26 at 15:49 +0100, Alan Maguire wrote:
> When building selftests, the following was seen:
> 
> uprobe_multi.c: In function ‘trigger_uprobe’:
> uprobe_multi.c:108:40: error: ‘MADV_PAGEOUT’ undeclared (first use in this function)
>   108 |                 madvise(addr, page_sz, MADV_PAGEOUT);
>       |                                        ^~~~~~~~~~~~
> uprobe_multi.c:108:40: note: each undeclared identifier is reported only once for each function it appears in
> make: *** [Makefile:850: bpf-next/tools/testing/selftests/bpf/uprobe_multi] Error 1
> 
> ...even with updated UAPI headers. It seems the above value is
> defined in UAPI <linux/mman.h> but including that file triggers
> other redefinition errors.  Simplest solution is to add a
> guarded definition, as was done for MADV_POPULATE_READ.
> 
> Fixes: 3c217a182018 ("selftests/bpf: add build ID tests")
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---

I was curious why this error is not triggered on my local machine or CI.
MADV_PAGEOUT is indeed defined in UAPI.
Selftests build picks it from host system header, which is
/usr/include/bits/mman-linux.h for my Fedora 40 setup.
The MADV_PAGEOUT was added by commit [1] back in 2019
(and should be available from Linux 5.4, I guess Alan uses a very old kernel).

I think that at some point in time we should adjust selftests to use
UAPI headers that come from the kernel being tested, not from the host.
Until that happens, I think this fix is fine.

[1] 1a4e58cce84e ("mm: introduce MADV_PAGEOUT")

Acked-by: Eduard Zingerman <eddyz87@gmail.com>

(I want back to 2019...)

[...]


  reply	other threads:[~2024-09-26 23:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 14:49 [PATCH bpf-next] selftests/bpf: fix uprobe_multi compilation error Alan Maguire
2024-09-26 23:44 ` Eduard Zingerman [this message]
2024-09-27 10:26   ` Alan Maguire
2024-09-27 20:50 ` patchwork-bot+netdevbpf

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=084902540a09a7036b713bd2336955e9b63fb30b.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@fomichev.me \
    --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