* [PATCH v2 0/2] perf tool versioning fixes
@ 2022-02-21 13:16 John Garry
2022-02-21 13:16 ` [PATCH v2 1/2] perf: Fix dependency for version file creation John Garry
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: John Garry @ 2022-02-21 13:16 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung
Cc: linux-perf-users, irogers, olsajiri, rric, ak, John Garry
This series includes a couple of fixes I made from working on a clone of
acme.git
It is based on perf/urgent @ commit b3d971ec2534.
Differences to v1:
- Add patch to fix kernel version tag
- Fix perf out-of-tree build
John Garry (2):
perf: Fix dependency for version file creation
perf: Fix version kernel tag
tools/perf/Makefile.perf | 4 ++--
tools/perf/util/PERF-VERSION-GEN | 13 ++++---------
2 files changed, 6 insertions(+), 11 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] perf: Fix dependency for version file creation
2022-02-21 13:16 [PATCH v2 0/2] perf tool versioning fixes John Garry
@ 2022-02-21 13:16 ` John Garry
2022-02-21 13:16 ` [PATCH v2 2/2] perf: Fix version kernel tag John Garry
2022-02-25 19:37 ` [PATCH v2 0/2] perf tool versioning fixes John Garry
2 siblings, 0 replies; 7+ messages in thread
From: John Garry @ 2022-02-21 13:16 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung
Cc: linux-perf-users, irogers, olsajiri, rric, ak, John Garry
The version generated by perf may not be correct by just changing the
head commit, like this:
$git log --pretty=format:"%H" -n 1
b5d9d4708a24ac1889a30e9aedf8af8d73102139
$perf -v
perf version 5.16.gb5d9d4708a24
$git reset --hard HEAD^
HEAD is now at 629f520b265f
$make
...
$./perf -v
perf version 5.16.gb5d9d4708a24
The dependency to building PERF-VERSION-FILE should also include ORIG_HEAD,
as this changes when changing the head commit (while HEAD does not).
Signed-off-by: John Garry <john.garry@huawei.com>
---
tools/perf/Makefile.perf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index ac861e42c8f7..9c935f86d172 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -691,7 +691,7 @@ $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
-$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
+$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD ../../.git/ORIG_HEAD
$(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
$(Q)touch $(OUTPUT)PERF-VERSION-FILE
@@ -1144,7 +1144,7 @@ endif
# then force version regeneration:
#
ifeq ($(wildcard ../../.git/HEAD),)
- GIT-HEAD-PHONY = ../../.git/HEAD
+ GIT-HEAD-PHONY = ../../.git/HEAD ../../.git/ORIG_HEAD
else
GIT-HEAD-PHONY =
endif
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] perf: Fix version kernel tag
2022-02-21 13:16 [PATCH v2 0/2] perf tool versioning fixes John Garry
2022-02-21 13:16 ` [PATCH v2 1/2] perf: Fix dependency for version file creation John Garry
@ 2022-02-21 13:16 ` John Garry
[not found] ` <CAP-5=fXT3VYB2uBXmihuruq==FENLFcFSHMLY0Fk29pRvU-wag@mail.gmail.com>
2022-02-25 19:37 ` [PATCH v2 0/2] perf tool versioning fixes John Garry
2 siblings, 1 reply; 7+ messages in thread
From: John Garry @ 2022-02-21 13:16 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung
Cc: linux-perf-users, irogers, olsajiri, rric, ak, John Garry
Generating the version kernel tag relies on "git describe" command to get
the latest Linus kernel tag.
However, when working from clones of Linus' git we may not have the latest
tag. For example, when working on Arnaldo's acme.git, we can have this:
$git branch
perf/core
$head -n 5 ../../Makefile
head -n 5 ../../Makefile | tail -n 4
VERSION = 5
PATCHLEVEL = 17
SUBLEVEL = 0
EXTRAVERSION = -rc3
$ git describe --abbrev=0 --match "v[0-9].[0-9]*"
v4.13-rc5
Indeed using tags is a problem as it relies on tags being pulled from
Linus' git (and pushed to the clone).
In commit a4147f0f9138 ("perf tools: Fix perf version generation"), Robert
introduced a change to use the kernelversion rule to generate the kernel
tag when no git tags are available. However, as mentioned above, the tag we
generate may be incorrect, so just always use kernelversion to get the tag
(apart from building perf out of tree).
Signed-off-by: John Garry <john.garry@huawei.com>
---
tools/perf/util/PERF-VERSION-GEN | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 59241ff342be..0ee5af529238 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -11,23 +11,18 @@ LF='
'
#
-# First check if there is a .git to get the version from git describe
-# otherwise try to get the version from the kernel Makefile
+# Always try first to get the version from the kernel Makefile
#
CID=
TAG=
if test -d ../../.git -o -f ../../.git
then
- TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
+ TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
CID=$(git log -1 --abbrev=12 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
-elif test -f ../../PERF-VERSION-FILE
-then
+else
TAG=$(cut -d' ' -f3 ../../PERF-VERSION-FILE | sed -e 's/\"//g')
fi
-if test -z "$TAG"
-then
- TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
-fi
+
VN="$TAG$CID"
if test -n "$CID"
then
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] perf tool versioning fixes
2022-02-21 13:16 [PATCH v2 0/2] perf tool versioning fixes John Garry
2022-02-21 13:16 ` [PATCH v2 1/2] perf: Fix dependency for version file creation John Garry
2022-02-21 13:16 ` [PATCH v2 2/2] perf: Fix version kernel tag John Garry
@ 2022-02-25 19:37 ` John Garry
2 siblings, 0 replies; 7+ messages in thread
From: John Garry @ 2022-02-25 19:37 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung
Cc: linux-perf-users, irogers, olsajiri, rric, ak
On 21/02/2022 13:16, John Garry wrote:
> This series includes a couple of fixes I made from working on a clone of
> acme.git
>
Hi Arnaldo,
Can you kindly check this series if you get a chance? If you try from a
clone of your own git you may see the issue reported in 2/2.
Thanks!!
> It is based on perf/urgent @ commit b3d971ec2534.
>
> Differences to v1:
> - Add patch to fix kernel version tag
> - Fix perf out-of-tree build
>
> John Garry (2):
> perf: Fix dependency for version file creation
> perf: Fix version kernel tag
>
> tools/perf/Makefile.perf | 4 ++--
> tools/perf/util/PERF-VERSION-GEN | 13 ++++---------
> 2 files changed, 6 insertions(+), 11 deletions(-)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] perf: Fix version kernel tag
[not found] ` <CAP-5=fXT3VYB2uBXmihuruq==FENLFcFSHMLY0Fk29pRvU-wag@mail.gmail.com>
@ 2022-03-11 8:27 ` John Garry
2022-03-14 22:12 ` Ian Rogers
0 siblings, 1 reply; 7+ messages in thread
From: John Garry @ 2022-03-11 8:27 UTC (permalink / raw)
To: Ian Rogers
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, linux-perf-users, olsajiri, rric, ak
On 11/03/2022 02:18, Ian Rogers wrote:
> Generating the version kernel tag relies on "git describe" command
> to get
> the latest Linus kernel tag.
>
> However, when working from clones of Linus' git we may not have the
> latest
> tag. For example, when working on Arnaldo's acme.git, we can have this:
> $git branch
> perf/core
> $head -n 5 ../../Makefile
> head -n 5 ../../Makefile | tail -n 4
> VERSION = 5
> PATCHLEVEL = 17
> SUBLEVEL = 0
> EXTRAVERSION = -rc3
> $ git describe --abbrev=0 --match "v[0-9].[0-9]*"
> v4.13-rc5
>
Hi Ian,
Thanks for having a look.
>
> I'm a little confused by this, isn't the "git branch" showing your local
> branch? For me:
>
> $git branch
> acme
> $git status
> On branch acme
> Your branch is up to date with 'acme/perf/core'.
> $git describe --abbrev=0 --match "v[0-9].[0-9]*"
> v5.17-rc4
> $git remote show acme
> * remote acme
> Fetch URL:
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
> <http://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git>
> Push URL:
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
> <http://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git>
> ...
> $ /tmp/perf/perf --version
> perf version 5.17.rc4.g56dce868198c
>
> Is your branch tracking acme/master ?
I was following acme/perf/core but I don't think that it is so important.
The difference is that I am working from a clone of acme/linux.git and
so torvalds/linux.git is a remote for me. I assume that you have a clone
of torvalds/linux.git
That means that if my clone of acme git does not pull in the tags from
torvalds git then "git describe" gives a wrong result.
Please check this experiment:
john@localhost:~> git clone
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git acme_test
Cloning into 'acme_test'...
remote: Enumerating objects: 59, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (3/3), done.
...
john@localhost:~> cd acme_test/
john@localhost:~/acme_test> git checkout remotes/origin/perf/core -B
perf/core
Updating files: 100% (58299/58299), done.
Branch 'perf/core' set up to track remote branch 'perf/core' from 'origin'.
Switched to a new branch 'perf/core'
john@localhost:~/acme_test> git describe --abbrev=0 --match "v[0-9].[0-9]*"
v4.13-rc5
john@localhost:~/acme_test> head -n 5 Makefile | tail -n 4
VERSION = 5
PATCHLEVEL = 17
SUBLEVEL = 0
EXTRAVERSION = -rc4
john@localhost:~/acme_test> git remote add torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
john@localhost:~/acme_test> git fetch torvalds
remote: Enumerating objects: 1516, done.
remote: Counting objects: 100% (1516/1516), done.
remote: Compressing objects: 100% (413/413), done.
remote: Total 1944 (delta 1202), reused 1314 (delta 1098), pack-reused 428
Receiving objects: 100% (1944/1944), 1.68 MiB | 5.12 MiB/s, done.
Resolving deltas: 100% (1270/1270), completed with 400 local objects.
From git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
* [new branch] master -> torvalds/master
...
* [new tag] v5.17-rc2 -> v5.17-rc2
* [new tag] v5.17-rc3 -> v5.17-rc3
* [new tag] v5.17-rc4 -> v5.17-rc4
* [new tag] v5.17-rc5 -> v5.17-rc5
* [new tag] v5.17-rc6 -> v5.17-rc6
...
john@localhost:~/acme_test> git describe --abbrev=0 --match "v[0-9].[0-9]*"
v5.17-rc4
So you can see that "git describe" gives the wrong result (v4.13-rc5)
before we pull in torvalds git.
My point is that git tags are unreliable and we should avoid them.
Thanks,
John
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] perf: Fix version kernel tag
2022-03-11 8:27 ` John Garry
@ 2022-03-14 22:12 ` Ian Rogers
2022-03-15 11:31 ` John Garry
0 siblings, 1 reply; 7+ messages in thread
From: Ian Rogers @ 2022-03-14 22:12 UTC (permalink / raw)
To: John Garry
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, linux-perf-users, olsajiri, rric, ak
On Fri, Mar 11, 2022 at 12:28 AM John Garry <john.garry@huawei.com> wrote:
>
> On 11/03/2022 02:18, Ian Rogers wrote:
> > Generating the version kernel tag relies on "git describe" command
> > to get
> > the latest Linus kernel tag.
> >
> > However, when working from clones of Linus' git we may not have the
> > latest
> > tag. For example, when working on Arnaldo's acme.git, we can have this:
> > $git branch
> > perf/core
> > $head -n 5 ../../Makefile
> > head -n 5 ../../Makefile | tail -n 4
> > VERSION = 5
> > PATCHLEVEL = 17
> > SUBLEVEL = 0
> > EXTRAVERSION = -rc3
> > $ git describe --abbrev=0 --match "v[0-9].[0-9]*"
> > v4.13-rc5
> >
>
> Hi Ian,
>
> Thanks for having a look.
>
> >
> > I'm a little confused by this, isn't the "git branch" showing your local
> > branch? For me:
> >
> > $git branch
> > acme
> > $git status
> > On branch acme
> > Your branch is up to date with 'acme/perf/core'.
> > $git describe --abbrev=0 --match "v[0-9].[0-9]*"
> > v5.17-rc4
> > $git remote show acme
> > * remote acme
> > Fetch URL:
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
> > <http://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git>
> > Push URL:
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
> > <http://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git>
> > ...
> > $ /tmp/perf/perf --version
> > perf version 5.17.rc4.g56dce868198c
> >
> > Is your branch tracking acme/master ?
>
> I was following acme/perf/core but I don't think that it is so important.
>
> The difference is that I am working from a clone of acme/linux.git and
> so torvalds/linux.git is a remote for me. I assume that you have a clone
> of torvalds/linux.git
>
> That means that if my clone of acme git does not pull in the tags from
> torvalds git then "git describe" gives a wrong result.
>
> Please check this experiment:
>
> john@localhost:~> git clone
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git acme_test
> Cloning into 'acme_test'...
> remote: Enumerating objects: 59, done.
> remote: Counting objects: 100% (59/59), done.
> remote: Compressing objects: 100% (3/3), done.
>
> ...
>
> john@localhost:~> cd acme_test/
>
> john@localhost:~/acme_test> git checkout remotes/origin/perf/core -B
> perf/core
> Updating files: 100% (58299/58299), done.
> Branch 'perf/core' set up to track remote branch 'perf/core' from 'origin'.
> Switched to a new branch 'perf/core'
>
> john@localhost:~/acme_test> git describe --abbrev=0 --match "v[0-9].[0-9]*"
> v4.13-rc5
>
> john@localhost:~/acme_test> head -n 5 Makefile | tail -n 4
> VERSION = 5
> PATCHLEVEL = 17
> SUBLEVEL = 0
> EXTRAVERSION = -rc4
>
> john@localhost:~/acme_test> git remote add torvalds
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>
> john@localhost:~/acme_test> git fetch torvalds
> remote: Enumerating objects: 1516, done.
> remote: Counting objects: 100% (1516/1516), done.
> remote: Compressing objects: 100% (413/413), done.
> remote: Total 1944 (delta 1202), reused 1314 (delta 1098), pack-reused 428
> Receiving objects: 100% (1944/1944), 1.68 MiB | 5.12 MiB/s, done.
> Resolving deltas: 100% (1270/1270), completed with 400 local objects.
> From git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
> * [new branch] master -> torvalds/master
>
> ...
>
> * [new tag] v5.17-rc2 -> v5.17-rc2
> * [new tag] v5.17-rc3 -> v5.17-rc3
> * [new tag] v5.17-rc4 -> v5.17-rc4
> * [new tag] v5.17-rc5 -> v5.17-rc5
> * [new tag] v5.17-rc6 -> v5.17-rc6
>
> ...
>
> john@localhost:~/acme_test> git describe --abbrev=0 --match "v[0-9].[0-9]*"
> v5.17-rc4
>
> So you can see that "git describe" gives the wrong result (v4.13-rc5)
> before we pull in torvalds git.
>
> My point is that git tags are unreliable and we should avoid them.
(Plain text resend)
Got it, thanks for the detailed explanation!
Acked-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
>
> Thanks,
> John
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] perf: Fix version kernel tag
2022-03-14 22:12 ` Ian Rogers
@ 2022-03-15 11:31 ` John Garry
0 siblings, 0 replies; 7+ messages in thread
From: John Garry @ 2022-03-15 11:31 UTC (permalink / raw)
To: Ian Rogers, acme
Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
linux-perf-users, olsajiri, rric, ak
On 14/03/2022 22:12, Ian Rogers wrote:
>> john@localhost:~/acme_test> git describe --abbrev=0 --match "v[0-9].[0-9]*"
>> v5.17-rc4
>>
>> So you can see that "git describe" gives the wrong result (v4.13-rc5)
>> before we pull in torvalds git.
>>
>> My point is that git tags are unreliable and we should avoid them.
>
> (Plain text resend)
>
> Got it, thanks for the detailed explanation!
>
> Acked-by: Ian Rogers<irogers@google.com>
Great, thanks
Arnaldo, Can you kindly consider picking up this series?
Cheers,
John
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-03-15 11:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-21 13:16 [PATCH v2 0/2] perf tool versioning fixes John Garry
2022-02-21 13:16 ` [PATCH v2 1/2] perf: Fix dependency for version file creation John Garry
2022-02-21 13:16 ` [PATCH v2 2/2] perf: Fix version kernel tag John Garry
[not found] ` <CAP-5=fXT3VYB2uBXmihuruq==FENLFcFSHMLY0Fk29pRvU-wag@mail.gmail.com>
2022-03-11 8:27 ` John Garry
2022-03-14 22:12 ` Ian Rogers
2022-03-15 11:31 ` John Garry
2022-02-25 19:37 ` [PATCH v2 0/2] perf tool versioning fixes John Garry
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).