linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Madhavan Srinivasan <maddy@linux.ibm.com>,
	npiggin@gmail.com, christophe.leroy@csgroup.eu,
	aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com,
	shuah@kernel.org
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org,
	Sachin Sant <sachinp@linux.ibm.com>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 2/3] selftest/powerpc: Add flags.mk to support pmu buildable
Date: Tue, 30 Apr 2024 00:09:43 +1000	[thread overview]
Message-ID: <874jbkjm54.fsf@mail.lhotse> (raw)
In-Reply-To: <20240229093711.581230-2-maddy@linux.ibm.com>

Madhavan Srinivasan <maddy@linux.ibm.com> writes:
> When running `make -C powerpc/pmu run_tests` from top level selftests
> directory, currently this error is being reported
>
> make: Entering directory '/home/maddy/linux/tools/testing/selftests/powerpc/pmu'
> Makefile:40: warning: overriding recipe for target 'emit_tests'
> ../../lib.mk:111: warning: ignoring old recipe for target 'emit_tests'
> gcc -m64    count_instructions.c ../harness.c event.c lib.c ../utils.c loop.S  -o /home/maddy/selftest_output//count_instructions
> In file included from count_instructions.c:13:
> event.h:12:10: fatal error: utils.h: No such file or directory
> 12 | #include "utils.h"
>   |          ^~~~~~~~~
> compilation terminated.
>
> This is due to missing of include path in CFLAGS. That is, CFLAGS and
> GIT_VERSION macros are defined in the powerpc/ folder Makefile which
> in this case not involved.
>
> To address the failure incase of executing specific sub-folder test directly,
> a new rule file has been addded by the patch called "flags.mk" under
> selftest/powerpc/ folder and is linked to all the Makefile of powerpc/pmu
> sub-folders.

This patch made my selftest build go from ~10s to ~50s !

I tracked it down to "git describe" being run hundreds of times.

> diff --git a/tools/testing/selftests/powerpc/flags.mk b/tools/testing/selftests/powerpc/flags.mk
> new file mode 100644
> index 000000000000..28374f470126
> --- /dev/null
> +++ b/tools/testing/selftests/powerpc/flags.mk
> @@ -0,0 +1,12 @@
> +#This checks for any ENV variables and add those.
> +
> +#ifeq ($(GIT_VERSION),)
 
This isn't right, # is a comment in make syntax, so this line is just a
comment. It needs to be "ifeq".

> +GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
 
Using '=' here means Make re-runs the command every time the variable is
used. Previously that was OK because the variable was set once and then
exported. But now that it's a Make variable in each file it leads to
"git describe" being run a few hundred times.

I've squashed in those fixes, no need to send a v2.

cheers

  parent reply	other threads:[~2024-04-29 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29  9:37 [PATCH 1/3] selftest/powerpc: Re-order *FLAGS to follow lib.mk Madhavan Srinivasan
2024-02-29  9:37 ` [PATCH 2/3] selftest/powerpc: Add flags.mk to support pmu buildable Madhavan Srinivasan
2024-02-29 13:41   ` Sachin Sant
2024-04-29 14:09   ` Michael Ellerman [this message]
2024-05-02  8:34     ` Madhavan Srinivasan
2024-02-29  9:37 ` [PATCH 3/3] selftest/powerpc: make sub-folders buildable on it own Madhavan Srinivasan
2024-05-03 10:41 ` [PATCH 1/3] selftest/powerpc: Re-order *FLAGS to follow lib.mk Michael Ellerman

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=874jbkjm54.fsf@mail.lhotse \
    --to=mpe@ellerman.id.au \
    --cc=aneesh.kumar@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=sachinp@linux.ibm.com \
    --cc=shuah@kernel.org \
    /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).