linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: perf version issues
       [not found] <8a75f3b1-2b99-1233-3a70-070311b6ebc1@huawei.com>
@ 2022-03-22 20:11 ` Arnaldo Carvalho de Melo
  2022-03-22 22:17   ` John Garry
  2022-03-23 12:44   ` John Garry
  0 siblings, 2 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-03-22 20:11 UTC (permalink / raw)
  To: John Garry
  Cc: Ian Rogers, Jiri Olsa, Linux Kernel Mailing List, linux-perf-users

Re-adding lkml and Ian, Jiri, as I found some strange behaviour with
'git cherry-pick'.

Em Mon, Mar 21, 2022 at 08:43:26AM +0000, John Garry escreveu:
> Hi Arnaldo,
> 
> I have been finding that during my development that the output from "perf
> -v" may be incorrect in certain circumstances. I sent some patches to fix it
> up:
> https://lore.kernel.org/linux-perf-users/1645449409-158238-1-git-send-email-john.garry@huawei.com/T/#mf7234d2e331a53370c148eb4a0633d405a5c6832
> 
> Is there some issue that these cannot be processed?

So, while testing it I noticed that if we use 'git cherry-pick' it
doesn't trigger a rebuild, even having a new head :-\

I.e. with the two patches in at the HEAD, try:

  $ git log --oneline -2
  cb66befccba18fac (HEAD -> perf/core) perf tools: Fix version kernel tag
  4e666cdb06eede20 perf tools: Fix dependency for version file creation
  $ make -C tools/perf O=/tmp/build/perf install-bin
  $ perf -v
  perf version 5.17.rc8.gcb66befccba1

Ok so far, now lets remove HEAD and leave just the first patch, that has
the ORIG_HEAD dependency to trigger a rebuild:

  $ git reset --hard HEAD~
  HEAD is now at 4e666cdb06eede20 perf tools: Fix dependency for version file creation
  $ make -C tools/perf O=/tmp/build/perf install-bin
  $ perf -v
  perf version 5.17.rc8.g4e666cdb06ee

Ok, detected and rebuilt, perf -v works as expected.

Now lets try cherry picking your second patch:

$ git cherry-pick cb66befccba18fac
  [perf/core 8ff6a6c06a90a362] perf tools: Fix version kernel tag
   Author: John Garry <john.garry@huawei.com>
   Date: Mon Feb 21 21:16:49 2022 +0800
   1 file changed, 4 insertions(+), 9 deletions(-)
  $ make -C tools/perf O=/tmp/build/perf install-bin
  $ perf -v
  perf version 5.17.rc8.g4e666cdb06ee

Now it doesn´t notice it and there is no automatic rebuild triggered, we
stay with the cset from before the cherry-pick :-\

$ git log --oneline -2
8ff6a6c06a90a362 (HEAD -> perf/core) perf tools: Fix version kernel tag
4e666cdb06eede20 perf tools: Fix dependency for version file creation
$

Anyway, your patch works for some cases, so its an improvement and I'll
apply it, we can continue from there.

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: perf version issues
  2022-03-22 20:11 ` perf version issues Arnaldo Carvalho de Melo
@ 2022-03-22 22:17   ` John Garry
  2022-03-23 12:44   ` John Garry
  1 sibling, 0 replies; 4+ messages in thread
From: John Garry @ 2022-03-22 22:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ian Rogers, Jiri Olsa, Linux Kernel Mailing List, linux-perf-users

On 22/03/2022 20:11, Arnaldo Carvalho de Melo wrote:
>> I have been finding that during my development that the output from "perf
>> -v" may be incorrect in certain circumstances. I sent some patches to fix it
>> up:
>> https://lore.kernel.org/linux-perf-users/1645449409-158238-1-git-send-email-john.garry@huawei.com/T/#mf7234d2e331a53370c148eb4a0633d405a5c6832
>>
>> Is there some issue that these cannot be processed?
> So, while testing it I noticed that if we use 'git cherry-pick' it
> doesn't trigger a rebuild, even having a new head:-\
> 
> I.e. with the two patches in at the HEAD, try:
> 
>    $ git log --oneline -2
>    cb66befccba18fac (HEAD -> perf/core) perf tools: Fix version kernel tag
>    4e666cdb06eede20 perf tools: Fix dependency for version file creation
>    $ make -C tools/perf O=/tmp/build/perf install-bin
>    $ perf -v
>    perf version 5.17.rc8.gcb66befccba1
> 
> Ok so far, now lets remove HEAD and leave just the first patch, that has
> the ORIG_HEAD dependency to trigger a rebuild:
> 
>    $ git reset --hard HEAD~
>    HEAD is now at 4e666cdb06eede20 perf tools: Fix dependency for version file creation
>    $ make -C tools/perf O=/tmp/build/perf install-bin
>    $ perf -v
>    perf version 5.17.rc8.g4e666cdb06ee
> 
> Ok, detected and rebuilt, perf -v works as expected.

ok, good

> 
> Now lets try cherry picking your second patch:
> 
> $ git cherry-pick cb66befccba18fac
>    [perf/core 8ff6a6c06a90a362] perf tools: Fix version kernel tag
>     Author: John Garry<john.garry@huawei.com>
>     Date: Mon Feb 21 21:16:49 2022 +0800
>     1 file changed, 4 insertions(+), 9 deletions(-)
>    $ make -C tools/perf O=/tmp/build/perf install-bin
>    $ perf -v
>    perf version 5.17.rc8.g4e666cdb06ee
> 
> Now it doesn´t notice it and there is no automatic rebuild triggered, we
> stay with the cset from before the cherry-pick:-\
> 
> $ git log --oneline -2
> 8ff6a6c06a90a362 (HEAD -> perf/core) perf tools: Fix version kernel tag
> 4e666cdb06eede20 perf tools: Fix dependency for version file creation
> $
> 
> Anyway, your patch works for some cases, so its an improvement and I'll
> apply it, we can continue from there.

Thanks,

I just noticed the "reset --hard HEAD^" problem and not cherry-pick'ing. 
Let me check this tomorrow.

john


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: perf version issues
  2022-03-22 20:11 ` perf version issues Arnaldo Carvalho de Melo
  2022-03-22 22:17   ` John Garry
@ 2022-03-23 12:44   ` John Garry
  2022-03-24 17:09     ` John Garry
  1 sibling, 1 reply; 4+ messages in thread
From: John Garry @ 2022-03-23 12:44 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ian Rogers, Jiri Olsa, Linux Kernel Mailing List, linux-perf-users

On 22/03/2022 20:11, Arnaldo Carvalho de Melo wrote:

Hi Arnaldo,

> $ git cherry-pick cb66befccba18fac
>    [perf/core 8ff6a6c06a90a362] perf tools: Fix version kernel tag
>     Author: John Garry<john.garry@huawei.com>
>     Date: Mon Feb 21 21:16:49 2022 +0800
>     1 file changed, 4 insertions(+), 9 deletions(-)
>    $ make -C tools/perf O=/tmp/build/perf install-bin
>    $ perf -v
>    perf version 5.17.rc8.g4e666cdb06ee
> 
> Now it doesn´t notice it and there is no automatic rebuild triggered, we
> stay with the cset from before the cherry-pick:-\
> 
> $ git log --oneline -2
> 8ff6a6c06a90a362 (HEAD -> perf/core) perf tools: Fix version kernel tag
> 4e666cdb06eede20 perf tools: Fix dependency for version file creation
> $
> 
> Anyway, your patch works for some cases, so its an improvement and I'll
> apply it, we can continue from there.

After some experimentation, I find that only .git/HEAD changes for a 
cherry-pick depending on whether we're on a branch or not. As such, as 
you have seen, we may not rebuild after a cherry-pick, which is no good.

As far as I can see, only .git/index changes in all circumstances, but 
we don't have a dependency on that.

TBH, using .git files as Makefile dependencies doesn't seem to work well.

Maybe we should output "git log" and check versus what we have in 
PERF-VERSION-FILE and re-build depending on that.

Let me check this further now.

Thanks,
john

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: perf version issues
  2022-03-23 12:44   ` John Garry
@ 2022-03-24 17:09     ` John Garry
  0 siblings, 0 replies; 4+ messages in thread
From: John Garry @ 2022-03-24 17:09 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar
  Cc: Ian Rogers, Jiri Olsa, Linux Kernel Mailing List, linux-perf-users

+ Ingo

On 23/03/2022 12:44, John Garry wrote:
>> $ git cherry-pick cb66befccba18fac
>>    [perf/core 8ff6a6c06a90a362] perf tools: Fix version kernel tag
>>     Author: John Garry<john.garry@huawei.com>
>>     Date: Mon Feb 21 21:16:49 2022 +0800
>>     1 file changed, 4 insertions(+), 9 deletions(-)
>>    $ make -C tools/perf O=/tmp/build/perf install-bin
>>    $ perf -v
>>    perf version 5.17.rc8.g4e666cdb06ee
>>
>> Now it doesn´t notice it and there is no automatic rebuild triggered, we
>> stay with the cset from before the cherry-pick:-\
>>
>> $ git log --oneline -2
>> 8ff6a6c06a90a362 (HEAD -> perf/core) perf tools: Fix version kernel tag
>> 4e666cdb06eede20 perf tools: Fix dependency for version file creation
>> $
>>
>> Anyway, your patch works for some cases, so its an improvement and I'll
>> apply it, we can continue from there.
> 
> After some experimentation, I find that only .git/HEAD changes for a 
> cherry-pick depending on whether we're on a branch or not. As such, as 
> you have seen, we may not rebuild after a cherry-pick, which is no good.
> 
> As far as I can see, only .git/index changes in all circumstances, but 
> we don't have a dependency on that.
> 
> TBH, using .git files as Makefile dependencies doesn't seem to work well.
> 
> Maybe we should output "git log" and check versus what we have in 
> PERF-VERSION-FILE and re-build depending on that.
> 
> Let me check this further now.

Just an update on this...

I did some research and found that Ingo introduced the change to make 
.git/HEAD a dependency as a build optimisation. See commit commit 
c72e3f04b45fb2e50cdd81a50c3778c6a57251d8 ("tools/perf/build: Speed up 
git-version test on re-make")

According to the commit log it's quicker to trigger a rebuild of the 
version string depending on a change in a git internal file rather than 
run "git describe" to see any change in tag/commit every times.

However, I asked the git community about this approach, and their 
general idea is that a dependency on .git/HEAD or other git internal 
file is just not a good idea.

See 
https://lore.kernel.org/git/87wngkpddp.fsf@igel.home/T/#m4a4dd6de52fdbe21179306cd57b3761eb07f45f8

So to get this working robustly we may need to roll back that named 
commit in part.

Thanks,
John

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-24 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <8a75f3b1-2b99-1233-3a70-070311b6ebc1@huawei.com>
2022-03-22 20:11 ` perf version issues Arnaldo Carvalho de Melo
2022-03-22 22:17   ` John Garry
2022-03-23 12:44   ` John Garry
2022-03-24 17:09     ` 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).