From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Andi Kleen <ak@linux.intel.com>
Cc: namhyung@kernel.org, linux-perf-users@vger.kernel.org,
"Yann E. MORIN" <yann.morin.1998@free.fr>,
"buildroot@buildroot.org" <buildroot@buildroot.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v9 1/4] Create source symlink in perf object dir
Date: Mon, 25 Nov 2024 18:25:06 +0100 [thread overview]
Message-ID: <20241125182506.38af9907@booty> (raw)
In-Reply-To: <20240807231823.898979-1-ak@linux.intel.com>
Hello Andi,
+cc Yann and the Buildroot mailing list (see the end of this report).
On Wed, 7 Aug 2024 16:18:20 -0700
Andi Kleen <ak@linux.intel.com> wrote:
> Create a source symlink to the original source in the objdir.
> This is similar to what the main kernel build script does.
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
> tools/perf/Makefile.perf | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 175e4c7898f0..d46892d8223b 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -163,6 +163,8 @@ ifneq ($(OUTPUT),)
> # for flex/bison parsers.
> VPATH += $(OUTPUT)
> export VPATH
> +# create symlink to the original source
> +SOURCE := $(shell ln -sf $(srctree)/tools/perf $(OUTPUT)/source)
I found that since this patch got applied in 890a1961c812 (v6.12-rc1)
building perf fails silently in some cases.
The cases I have tested:
- make <FLAGS> -C tools/perf -> OK
- make <FLAGS> -C tools/perf O=/my/out/of/tree/dir -> OK
- make <FLAGS> -C tools/perf O=tools/perf -> fails
The failure in the third case is silent: make exits with a return value
of 0, but there is no perf executable created.
Even 'make <FLAGS> -C tools/perf install' exits returning 0, but no
executable is installed. However the following lines are output during
'make install', which are a sign of this issue happening:
install: omitting directory '/home/murray/w/bootlin/linux/tools/perf/perf'
ln: failed to access '/tmp/aaa/usr/bin/perf': No such file or directory
I realize 'O=tools/perf' is "useless" in the sense that the same result
would be obtained by not setting 'O' at all. However I also believe it
is expected that O=tools/perf should work equally to not setting 'O',
and as such there is a regression.
Also, right now the Buildroot embedded Linux build system builds perf
by always passing O=$(LINUX_DIR)/tools/perf/, thus it is currently
broken for kernels 6.12-rc1 and later.
Below is the test script I wrote to automate my testing. It is a bit
more complex than expected because it needs to hide a different bug,
which would otherwise mask the one being reported here. A slightly
different version of this script was used to automate 'git bisect'.
-------------------------8<-------------------------
#!/bin/sh
# Usage:
# build-perf-report Build with O=tools/perf
# build-perf-report <DIR> Build with O=<DIR>
set -eu
# Default to O=tools/perf
OUT_DIR=${1:-tools/perf}
echo "Output dir: ${OUT_DIR}"
# This is the toolchain I initially used to reproduce the issue:
# https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--glibc--stable-2024.02-1.tar.bz2
#
# However commenting the two lines for a native build is equally
# reproducing the problem on my x86_64 Ubuntu 22.04 host
export ARCH=arm64
export CROSS_COMPILE="ccache ${HOME}/x-tools/aarch64--glibc--stable-2024.02-1/bin/aarch64-linux-"
LINUX_MAKE_FLAGS="\
GIT_DIR=. \
KCFLAGS=-Wno-attribute-alias \
WERROR=0 \
REGENERATE_PARSERS=1 \
DESTDIR=/tmp/aaa \
prefix=/usr \
NO_GTK2=1 \
NO_LIBPERL=1 \
NO_LIBPYTHON=1 \
NO_LIBBIONIC=1 \
NO_LIBTRACEEVENT=1 \
NO_NEWT=1 \
NO_SLANG=1 \
NO_LIBAUDIT=1 \
NO_LIBUNWIND=1 \
NO_LIBNUMA=1 \
NO_LIBELF=1 \
NO_DWARF=1 \
NO_DEMANGLE=1 \
NO_LIBCRYPTO=1 \
NO_ZLIB=1 \
NO_LZMA=1 \
-C tools/perf O=${OUT_DIR}
"
echo "Kernel version: $(git describe)"
# Revert (without committing) 13d675aea6cac5bb4619ef9e3fdd90129fe6d139
# which introduces a different build failure (fixed by a later commit)
# masking the issue being examined
git checkout -- .
git show 13d675aea6cac5bb4619ef9e3fdd90129fe6d139 | git apply || :
# Clean the DESTDIR
rm -fr /tmp/aaa/
git clean -xdfq
make defconfig
# If building out of tree, create an empty build dir
if [ ${OUT_DIR} != "tools/perf" ]; then
rm -fr ${OUT_DIR}
mkdir -p ${OUT_DIR}
fi
make ${LINUX_MAKE_FLAGS}
make ${LINUX_MAKE_FLAGS} install
# remove the fix added above
git checkout -- .
echo "-------------------------------------------------------"
echo "perf files in O (${OUT_DIR}):"
find ${OUT_DIR} -name perf -not -type d | xargs file
echo "-------------------------------------------------------"
echo "perf executable in DESTDIR:"
find /tmp/aaa/ -name perf -not -type d | xargs file | grep 'executable'
echo "-------------------------------------------------------"
-------------------------8<-------------------------
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-11-25 17:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 23:18 [PATCH v9 1/4] Create source symlink in perf object dir Andi Kleen
2024-08-07 23:18 ` [PATCH v9 2/4] perf test: Support external tests for separate objdir Andi Kleen
2024-08-07 23:18 ` [PATCH v9 3/4] perf script: Fix perf script -F +metric Andi Kleen
2024-08-08 5:18 ` Namhyung Kim
2024-08-08 18:09 ` Ian Rogers
2024-08-08 20:18 ` Andi Kleen
2024-08-09 15:00 ` Ian Rogers
2024-08-07 23:18 ` [PATCH v9 4/4] Add a test case for " Andi Kleen
2024-11-25 17:25 ` Luca Ceresoli [this message]
2024-11-25 19:12 ` [PATCH v9 1/4] Create source symlink in perf object dir Andi Kleen
2024-11-26 7:34 ` Luca Ceresoli
2025-04-09 17:43 ` Florian Fainelli
2025-04-09 17:59 ` Florian Fainelli
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=20241125182506.38af9907@booty \
--to=luca.ceresoli@bootlin.com \
--cc=ak@linux.intel.com \
--cc=buildroot@buildroot.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=yann.morin.1998@free.fr \
/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;
as well as URLs for NNTP newsgroup(s).