From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: jolsa@kernel.org, ak@linux.intel.com, namhyung@kernel.org,
irogers@google.com, james.clark@arm.com, mpe@ellerman.id.au,
linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
maddy@linux.vnet.ibm.com, rnsastry@linux.ibm.com,
kjain@linux.ibm.com, disgoel@linux.ibm.com
Subject: Re: [PATCH] tools/perf: Fix bpf-script-test-prologue test compile issue with clang
Date: Thu, 5 Jan 2023 09:53:16 -0300 [thread overview]
Message-ID: <Y7bIPIVx9Y7agt7L@kernel.org> (raw)
In-Reply-To: <20230105120436.92051-1-atrajeev@linux.vnet.ibm.com>
Em Thu, Jan 05, 2023 at 05:34:36PM +0530, Athira Rajeev escreveu:
> While running perf test for bpf, observed that "BPF prologue
> generation" test case fails to compile with clang. Logs below
> from powerpc:
>
> <stdin>:33:2: error: use of undeclared identifier 'fmode_t'
> fmode_t f_mode = (fmode_t)_f_mode;
> ^
> <stdin>:37:6: error: use of undeclared identifier 'f_mode'; did you mean '_f_mode'?
> if (f_mode & FMODE_WRITE)
> ^~~~~~
> _f_mode
> <stdin>:30:60: note: '_f_mode' declared here
> int bpf_func__null_lseek(void *ctx, int err, unsigned long _f_mode,
> ^
> 2 errors generated.
Thanks for fixing this, I noticed the problem but didn't got around to
investigate it.
Tested and applied.
- Arnaldo
> The test code tests/bpf-script-test-prologue.c uses fmode_t.
> And the error above is for "fmode_t" which is defined in
> include/linux/types.h as part of kernel build directory:
> "/lib/modules/<kernel_version>/build" that comes from
> kernel devel [ soft link to /usr/src/<kernel_version> ].
> Clang picks this header file from "-working-directory" build
> option that specifies this build folder.
>
> But the 'commit 14e4b9f4289a ("perf trace: Raw augmented
> syscalls fix libbpf 1.0+ compatibility")', changed the
> include directory to use: "/usr/include". Post this change,
> types.h from /usr/include/ is getting picked upwhich doesn’t
> contain definition of "fmode_t" and hence fails to compile.
>
> Compilation command before this commit:
> /usr/bin/clang -D__KERNEL__ -D__NR_CPUS__=72 -DLINUX_VERSION_CODE=0x50e00 -xc -I/root/lib/perf/include/bpf -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -Wno-unused-value -Wno-pointer-sign -working-directory /lib/modules/<ver>/build -c - -target bpf -g -O2 -o -
>
> Compilation command after this commit:
> /usr/bin/clang -D__KERNEL__ -D__NR_CPUS__=72 -DLINUX_VERSION_CODE=0x50e00 -xc -I/usr/include/ -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -Wno-unused-value -Wno-pointer-sign -working-directory /lib/modules/<ver>/build -c - -target bpf -g -O2 -o -
>
> The difference is addition of -I/usr/include/ in the first line
> which is causing the error. Fix this by adding typedef for "fmode_t"
> in the testcase to solve the compile issue.
>
> Fixes: 14e4b9f4289a ("perf trace: Raw augmented syscalls fix libbpf 1.0+ compatibility")
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> tools/perf/tests/bpf-script-test-prologue.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/tests/bpf-script-test-prologue.c b/tools/perf/tests/bpf-script-test-prologue.c
> index bd83d364cf30..91778b5c6125 100644
> --- a/tools/perf/tests/bpf-script-test-prologue.c
> +++ b/tools/perf/tests/bpf-script-test-prologue.c
> @@ -20,6 +20,8 @@
> # undef if
> #endif
>
> +typedef unsigned int __bitwise fmode_t;
> +
> #define FMODE_READ 0x1
> #define FMODE_WRITE 0x2
>
> --
> 2.31.1
--
- Arnaldo
WARNING: multiple messages have this Message-ID (diff)
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: irogers@google.com, ak@linux.intel.com, rnsastry@linux.ibm.com,
linux-perf-users@vger.kernel.org, maddy@linux.vnet.ibm.com,
james.clark@arm.com, jolsa@kernel.org, kjain@linux.ibm.com,
namhyung@kernel.org, disgoel@linux.ibm.com,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] tools/perf: Fix bpf-script-test-prologue test compile issue with clang
Date: Thu, 5 Jan 2023 09:53:16 -0300 [thread overview]
Message-ID: <Y7bIPIVx9Y7agt7L@kernel.org> (raw)
In-Reply-To: <20230105120436.92051-1-atrajeev@linux.vnet.ibm.com>
Em Thu, Jan 05, 2023 at 05:34:36PM +0530, Athira Rajeev escreveu:
> While running perf test for bpf, observed that "BPF prologue
> generation" test case fails to compile with clang. Logs below
> from powerpc:
>
> <stdin>:33:2: error: use of undeclared identifier 'fmode_t'
> fmode_t f_mode = (fmode_t)_f_mode;
> ^
> <stdin>:37:6: error: use of undeclared identifier 'f_mode'; did you mean '_f_mode'?
> if (f_mode & FMODE_WRITE)
> ^~~~~~
> _f_mode
> <stdin>:30:60: note: '_f_mode' declared here
> int bpf_func__null_lseek(void *ctx, int err, unsigned long _f_mode,
> ^
> 2 errors generated.
Thanks for fixing this, I noticed the problem but didn't got around to
investigate it.
Tested and applied.
- Arnaldo
> The test code tests/bpf-script-test-prologue.c uses fmode_t.
> And the error above is for "fmode_t" which is defined in
> include/linux/types.h as part of kernel build directory:
> "/lib/modules/<kernel_version>/build" that comes from
> kernel devel [ soft link to /usr/src/<kernel_version> ].
> Clang picks this header file from "-working-directory" build
> option that specifies this build folder.
>
> But the 'commit 14e4b9f4289a ("perf trace: Raw augmented
> syscalls fix libbpf 1.0+ compatibility")', changed the
> include directory to use: "/usr/include". Post this change,
> types.h from /usr/include/ is getting picked upwhich doesn’t
> contain definition of "fmode_t" and hence fails to compile.
>
> Compilation command before this commit:
> /usr/bin/clang -D__KERNEL__ -D__NR_CPUS__=72 -DLINUX_VERSION_CODE=0x50e00 -xc -I/root/lib/perf/include/bpf -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -Wno-unused-value -Wno-pointer-sign -working-directory /lib/modules/<ver>/build -c - -target bpf -g -O2 -o -
>
> Compilation command after this commit:
> /usr/bin/clang -D__KERNEL__ -D__NR_CPUS__=72 -DLINUX_VERSION_CODE=0x50e00 -xc -I/usr/include/ -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -Wno-unused-value -Wno-pointer-sign -working-directory /lib/modules/<ver>/build -c - -target bpf -g -O2 -o -
>
> The difference is addition of -I/usr/include/ in the first line
> which is causing the error. Fix this by adding typedef for "fmode_t"
> in the testcase to solve the compile issue.
>
> Fixes: 14e4b9f4289a ("perf trace: Raw augmented syscalls fix libbpf 1.0+ compatibility")
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> tools/perf/tests/bpf-script-test-prologue.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/tests/bpf-script-test-prologue.c b/tools/perf/tests/bpf-script-test-prologue.c
> index bd83d364cf30..91778b5c6125 100644
> --- a/tools/perf/tests/bpf-script-test-prologue.c
> +++ b/tools/perf/tests/bpf-script-test-prologue.c
> @@ -20,6 +20,8 @@
> # undef if
> #endif
>
> +typedef unsigned int __bitwise fmode_t;
> +
> #define FMODE_READ 0x1
> #define FMODE_WRITE 0x2
>
> --
> 2.31.1
--
- Arnaldo
next prev parent reply other threads:[~2023-01-05 12:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 12:04 [PATCH] tools/perf: Fix bpf-script-test-prologue test compile issue with clang Athira Rajeev
2023-01-05 12:04 ` Athira Rajeev
2023-01-05 12:53 ` Arnaldo Carvalho de Melo [this message]
2023-01-05 12:53 ` Arnaldo Carvalho de Melo
2023-01-09 13:16 ` Athira Rajeev
2023-01-09 13:16 ` Athira Rajeev
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=Y7bIPIVx9Y7agt7L@kernel.org \
--to=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.ibm.com \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=namhyung@kernel.org \
--cc=rnsastry@linux.ibm.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.