Re: [PATCH bpf-next] bpf: handle MADV_PAGEOUT error in uprobe_multi.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 20, 2024 at 11:14 AM Jason Xing <kerneljasonxing@xxxxxxxxx> wrote:
>
> From: Jason Xing <kernelxing@xxxxxxxxxxx>
>
> When I compiled the tools/testing/selftests/bpf, the following error
> pops out:
> uprobe_multi.c: In function ‘trigger_uprobe’:
> uprobe_multi.c:109:26: error: ‘MADV_PAGEOUT’ undeclared (first use in this function); did you mean ‘MADV_RANDOM’?
>    madvise(addr, page_sz, MADV_PAGEOUT);
>                           ^~~~~~~~~~~~
>                           MADV_RANDOM
>
> We can see MADV_PAGEOUT existing in mman-common.h on x86 arch, so
> including this header file solves this compilation error.
>
> Signed-off-by: Jason Xing <kernelxing@xxxxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/uprobe_multi.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/bpf/uprobe_multi.c b/tools/testing/selftests/bpf/uprobe_multi.c
> index c7828b13e5ff..b0e11ffe0e1c 100644
> --- a/tools/testing/selftests/bpf/uprobe_multi.c
> +++ b/tools/testing/selftests/bpf/uprobe_multi.c
> @@ -5,6 +5,7 @@
>  #include <stdbool.h>
>  #include <stdint.h>
>  #include <sys/mman.h>
> +#include <mman-common.h>

uprobe_multi.c:8:10: fatal error: mman-common.h: No such file or directory
61 8 | #include <mman-common.h>
62 | ^~~~~~~~~~~~~~~

After seeing the error that CI reported to me, I realized that I did
cp /usr/include/asm-generic/mman-common.h to
/usr/include/mman-common.h.

If I try "#include <asm-generic/mman-common.h>", then I will see
redefinition error:
tools/include/uapi/asm-generic/mman-common.h:26: error: "MAP_POPULATE"
redefined [-Werror]
 #define MAP_POPULATE  0x008000 /* populate (prefault) pagetables */

In file included from /usr/include/sys/mman.h:41,
                 from uprobe_multi.c:7:
/usr/include/bits/mman.h:38: note: this is the location of the
previous definition
 # define MAP_POPULATE 0x08000  /* Populate (prefault) pagetables.  */

It looks odd to me. Let me dig into it more.

Thanks,
Jason





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux