All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Palmer Dabbelt <palmer@rivosinc.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ian Rogers <irogers@google.com>,
	James Clark <james.clark@linaro.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/1 perf-tools] tools riscv: Include fence.h from the same directory barrier.h lives
Date: Tue, 26 Nov 2024 13:36:44 -0800	[thread overview]
Message-ID: <Z0Y_bC42dufBNE4L@ghost> (raw)
In-Reply-To: <Z0Y8XQMBXT5JdOAG@x1>

On Tue, Nov 26, 2024 at 06:23:41PM -0300, Arnaldo Carvalho de Melo wrote:
> When cross building perf to riscv I noticed that it isn't finding the
> asm/fence.h file included from tools/arch/riscv/include/asm/barrier.h,
> since both live in the same directory, load it from there instead of
> from asm/fence.h, fixing the libbpf build in such environment:
> 
>   perfbuilder@number:~$ time dm ubuntu:22.04-x-riscv64
>      1     4.32 ubuntu:22.04-x-riscv64        : FAIL gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
>                        from mmap.c:7:
>       /git/perf-6.12.0-rc6/tools/include/asm/../../arch/riscv/include/asm/barrier.h:13:10: fatal error: asm/fence.h: No such file or directory
>          13 | #include <asm/fence.h>
>             |          ^~~~~~~~~~~~~
>       compilation terminated.
>   <SNIP other similar errors>
> 
> This probably should work in other systems where the right asm/fence.h
> is available, but in the above scenario, it fails. Probably we should
> fix the perf build system to find it in tools/arch/riscv/include/asm/,
> but this one-liner should be a stop gap solution till we get there.
> 
> Testing it:
> 
>   perfbuilder@number:~$ time dm ubuntu:22.04-x-riscv64
>      1    21.65 ubuntu:22.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0  flex 2.6.4
>   BUILD_TARBALL_HEAD=800d169e2d39e4e81ade326d73ae7c4343c12b45
>   $ git log --oneline -1 800d169e2d39e4e81ade326d73ae7c4343c12b45
>   800d169e2d39e4e8 tools riscv: Include fence.h from the same directory barrier.h lives
>   toolsbuilder@number:~/perf-6.12.0-rc6$ ls -la /tmp/build/perf/perf
>   -rwxr-xr-x. 1 toolsbuilder toolsbuilder 3278728 Nov 26 21:12 /tmp/build/perf/perf
>   toolsbuilder@number:~/perf-6.12.0-rc6$ file /tmp/build/perf/perf
>   /tmp/build/perf/perf: ELF 64-bit LSB pie executable, UCB RISC-V, RVC, double-float ABI, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, BuildID[sha1]=9b77bbf51da74cee24c6d5fc5814343cc7e9a652, for GNU/Linux 4.15.0, with debug_info, not stripped
>   toolsbuilder@number:~/perf-6.12.0-rc6$
>   toolsbuilder@number:~/perf-6.12.0-rc6$ readelf -d /tmp/build/perf/perf | head
>   Dynamic section at offset 0x242db0 contains 33 entries:
>     Tag        Type                         Name/Value
>    0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
>    0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
>    0x0000000000000001 (NEEDED)             Shared library: [libelf.so.1]
>    0x0000000000000001 (NEEDED)             Shared library: [libdw.so.1]
>    0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
>    0x0000000000000001 (NEEDED)             Shared library: [ld-linux-riscv64-lp64d.so.1]
>    0x0000000000000020 (PREINIT_ARRAY)      0x238740
>   toolsbuilder@number:~/perf-6.12.0-rc6$
> 
> Fixes: 6d74d178fe6eaf61 ("tools: Add riscv barrier implementation")
> Cc: Charlie Jenkins <charlie@rivosinc.com>
> Cc: Palmer Dabbelt <palmer@rivosinc.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/arch/riscv/include/asm/barrier.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/arch/riscv/include/asm/barrier.h b/tools/arch/riscv/include/asm/barrier.h
> index 6997f197086ddf61..e78241632e2f1301 100644
> --- a/tools/arch/riscv/include/asm/barrier.h
> +++ b/tools/arch/riscv/include/asm/barrier.h
> @@ -10,7 +10,7 @@
>  #ifndef _TOOLS_LINUX_ASM_RISCV_BARRIER_H
>  #define _TOOLS_LINUX_ASM_RISCV_BARRIER_H
>  
> -#include <asm/fence.h>
> +#include "fence.h"
>  #include <linux/compiler.h>
>  
>  /* These barriers need to enforce ordering on both devices and memory. */
> -- 
> 2.47.0
> 

We have been trying to get this resolved with a different patch [1], but
getting it picked up was painfully slow and it wasn't picked up into
6.12 for some reason... It is on master now, but it hasn't been
backported yet, I don't know why not. There was another fix here [2]
that is similar to what you have, but [1] was selected instead of it.

[1] https://lore.kernel.org/linux-riscv/172835823300.66789.3704854116445399222.git-patchwork-notify@kernel.org/
[2] https://lore.kernel.org/linux-riscv/mvm5xq44bqh.fsf@suse.de/

- Charlie


      reply	other threads:[~2024-11-26 21:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 21:23 [PATCH 1/1 perf-tools] tools riscv: Include fence.h from the same directory barrier.h lives Arnaldo Carvalho de Melo
2024-11-26 21:36 ` Charlie Jenkins [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=Z0Y_bC42dufBNE4L@ghost \
    --to=charlie@rivosinc.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=palmer@rivosinc.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.