All of lore.kernel.org
 help / color / mirror / Atom feed
* perf buildid-cache -p <path> question
@ 2017-10-16 12:24 Thomas-Mich Richter
  2017-10-16 13:45 ` Thomas-Mich Richter
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Thomas-Mich Richter @ 2017-10-16 12:24 UTC (permalink / raw)
  To: linux-perf-use., Arnaldo Carvalho de Melo; +Cc: Hendrik Brueckner

Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:

I can add and remove files using the perf buildid-cache command. For example 
perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
.debug/usr/bin/tar 
and creates the <buildid> subdirectory
.debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.
Also a symbolic link from the directory
.debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
is created.

Command perf buildid-cache -a /usr/bin/tar
removes these entries.

Now when I run ./perf buildid-cache -p /usr/bin
nothing happens and success is reported:
[root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
Removing bash /usr/bin/: Ok
Removing dbus-daemon /usr/bin/: Ok
Removing ls /usr/bin/: Ok
Removing readlink /usr/bin/: Ok
Removing sleep /usr/bin/: Ok
Removing tar /usr/bin/: Ok
Removing time /usr/bin/: Ok
Removing vim /usr/bin/: Ok
Purging /usr/bin/: Ok

I have done some more debugging and there is something wrong. 
The function
build_id_cache__purge_path() is called and 
build_id_cache__list_build_ids() creates a list of file names located in /usr/bin of the buildid-cache.
build_id_cache__remove_s() is called for each name in the list and tries to locate each file name
	in directory .buildid/YY/ZZZ..ZZZ which fails because 
build_id_cache__linkname() expects a buildid and gets a file name.
The file name bash is treated as .buildid/ba/sh which does not exist.


This seems to be a simple mistake so I wonder if I do something wrong.

Thanks
-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: perf buildid-cache -p <path> question
  2017-10-16 12:24 perf buildid-cache -p <path> question Thomas-Mich Richter
@ 2017-10-16 13:45 ` Thomas-Mich Richter
  2017-10-16 14:12 ` Arnaldo Carvalho de Melo
  2017-10-21 15:17 ` Masami Hiramatsu
  2 siblings, 0 replies; 13+ messages in thread
From: Thomas-Mich Richter @ 2017-10-16 13:45 UTC (permalink / raw)
  To: linux-perf-use., Arnaldo Carvalho de Melo; +Cc: Hendrik Brueckner

On 10/16/2017 02:24 PM, Thomas-Mich Richter wrote:
> Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:
> 
> I can add and remove files using the perf buildid-cache command. For example 
> perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
> .debug/usr/bin/tar 
> and creates the <buildid> subdirectory
> .debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.
> Also a symbolic link from the directory
> .debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
> is created.
> 
> Command perf buildid-cache -a /usr/bin/tar
> removes these entries.
> 
> Now when I run ./perf buildid-cache -p /usr/bin
> nothing happens and success is reported:
> [root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
> Removing bash /usr/bin/: Ok
> Removing dbus-daemon /usr/bin/: Ok
> Removing ls /usr/bin/: Ok
> Removing readlink /usr/bin/: Ok
> Removing sleep /usr/bin/: Ok
> Removing tar /usr/bin/: Ok
> Removing time /usr/bin/: Ok
> Removing vim /usr/bin/: Ok
> Purging /usr/bin/: Ok
> 

Sorry, but this trace output when option -v is specified is incorrect.
I had too much debug code included when this append was written.


However the problem still exists and I have a prepared a patch which
I post soon.

-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: perf buildid-cache -p <path> question
  2017-10-16 12:24 perf buildid-cache -p <path> question Thomas-Mich Richter
  2017-10-16 13:45 ` Thomas-Mich Richter
@ 2017-10-16 14:12 ` Arnaldo Carvalho de Melo
  2017-10-20 16:12   ` Masami Hiramatsu
  2017-10-21 15:17 ` Masami Hiramatsu
  2 siblings, 1 reply; 13+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-10-16 14:12 UTC (permalink / raw)
  To: Thomas-Mich Richter; +Cc: linux-perf-use., Hendrik Brueckner, Masami Hiramatsu

Em Mon, Oct 16, 2017 at 02:24:11PM +0200, Thomas-Mich Richter escreveu:
> Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:
> 
> I can add and remove files using the perf buildid-cache command. For example 
> perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
> .debug/usr/bin/tar 
> and creates the <buildid> subdirectory
> .debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.

That is correct.

> Also a symbolic link from the directory
> .debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
> is created.
> 
> Command perf buildid-cache -a /usr/bin/tar

Nope, command 'perf buildid-cache -r /usr/bin/tar' does it:

[root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
[root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
lrwxrwxrwx. 1 root root 58 Oct 16 10:50 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
[root@jouet ~]# 

[root@jouet ~]# perf buildid-cache -r /usr/bin/tar
[root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
ls: cannot access '/root/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
[root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
ls: cannot access '/root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
[root@jouet ~]# 

> removes these entries.
> 
> Now when I run ./perf buildid-cache -p /usr/bin
> nothing happens and success is reported:

When you do '-p' after a '-a' or after a '-r'? From what you wrote
below, that is after you do a '-a /usr/bin/tar', as it is being purged
as well.

Masami?

> [root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
> Removing bash /usr/bin/: Ok
> Removing dbus-daemon /usr/bin/: Ok
> Removing ls /usr/bin/: Ok
> Removing readlink /usr/bin/: Ok
> Removing sleep /usr/bin/: Ok
> Removing tar /usr/bin/: Ok
> Removing time /usr/bin/: Ok
> Removing vim /usr/bin/: Ok
> Purging /usr/bin/: Ok

In my test it works as advertised:

[root@jouet ~]# perf buildid-cache -a /usr/bin/tar
[root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
lrwxrwxrwx. 1 root root 58 Oct 16 10:56 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
[root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
total 424
drwxr-xr-x. 2 root root   4096 Oct 16 10:56 .
drwxr-xr-x. 3 root root   4096 Oct 16 10:56 ..
-rwxr-xr-x. 2 root root 425032 Jul 19 05:55 elf
-rw-r--r--. 1 root root      0 Oct 16 10:56 probes
[root@jouet ~]# perf buildid-cache -vp /usr/bin/tar
Removing 4c10f253c0cb8459dd846235c0bc18929e4758ea /usr/bin/tar: Ok
Purging /usr/bin/tar: Ok
[root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
ls: cannot access '/root/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
[root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
ls: cannot access '/root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
[root@jouet ~]#

It was purged.

Now lets try what you did, which is to ask for a path that will match
with multiple binaries:

[root@jouet ~]# perf buildid-cache -v -a /usr/bin/tar
Adding 4c10f253c0cb8459dd846235c0bc18929e4758ea /usr/bin/tar: Ok
[root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
lrwxrwxrwx. 1 root root 58 Oct 16 10:58 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
[root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
total 424
drwxr-xr-x. 2 root root   4096 Oct 16 10:58 .
drwxr-xr-x. 3 root root   4096 Oct 16 10:58 ..
-rwxr-xr-x. 2 root root 425032 Jul 19 05:55 elf
-rw-r--r--. 1 root root      0 Oct 16 10:58 probes
[root@jouet ~]# perf buildid-cache -vp /usr/bin
Removing as /usr/bin: FAIL
Purging /usr/bin: FAIL
/usr/bin wasn't in the cache
[root@jouet ~]# perf buildid-cache -vp /usr/bin/
Removing as /usr/bin/: FAIL
Purging /usr/bin/: FAIL
/usr/bin/ wasn't in the cache
[root@jouet ~]#

This is when --purge was added:

commit 8d8c8e4cb3014fcc51f0e127b4316043306f5bb0
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Date:   Fri Feb 27 13:50:26 2015 +0900

    perf buildid-cache: Add --purge FILE to remove all caches of FILE

-----------------------
 
> I have done some more debugging and there is something wrong. 
> The function
> build_id_cache__purge_path() is called and 
> build_id_cache__list_build_ids() creates a list of file names located in /usr/bin of the buildid-cache.
> build_id_cache__remove_s() is called for each name in the list and tries to locate each file name
> 	in directory .buildid/YY/ZZZ..ZZZ which fails because 
> build_id_cache__linkname() expects a buildid and gets a file name.
> The file name bash is treated as .buildid/ba/sh which does not exist.

probably this got broken when the /elf, /probe separation was added,
humm, unsure if a 'git bisect' would help here...

Masami?
 
> This seems to be a simple mistake so I wonder if I do something wrong.

- Arnaldo

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

* Re: perf buildid-cache -p <path> question
  2017-10-16 14:12 ` Arnaldo Carvalho de Melo
@ 2017-10-20 16:12   ` Masami Hiramatsu
  2017-10-20 16:20     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 13+ messages in thread
From: Masami Hiramatsu @ 2017-10-20 16:12 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Thomas-Mich Richter, linux-perf-use.,
	Hendrik Brueckner, Masami Hiramatsu

On Mon, 16 Oct 2017 11:12:22 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Em Mon, Oct 16, 2017 at 02:24:11PM +0200, Thomas-Mich Richter escreveu:
> > Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:
> > 
> > I can add and remove files using the perf buildid-cache command. For example 
> > perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
> > .debug/usr/bin/tar 
> > and creates the <buildid> subdirectory
> > .debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.
> 
> That is correct.
> 
> > Also a symbolic link from the directory
> > .debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
> > is created.
> > 
> > Command perf buildid-cache -a /usr/bin/tar
> 
> Nope, command 'perf buildid-cache -r /usr/bin/tar' does it:

Wait, -r is remove command.

> 
> [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> lrwxrwxrwx. 1 root root 58 Oct 16 10:50 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> [root@jouet ~]# 
> 
> [root@jouet ~]# perf buildid-cache -r /usr/bin/tar
> [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> ls: cannot access '/root/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> ls: cannot access '/root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> [root@jouet ~]# 
> 
> > removes these entries.
> > 
> > Now when I run ./perf buildid-cache -p /usr/bin
> > nothing happens and success is reported:
> 
> When you do '-p' after a '-a' or after a '-r'? From what you wrote
> below, that is after you do a '-a /usr/bin/tar', as it is being purged
> as well.
> 
> Masami?

Yeah, should be. 

OK, -p and -r is slightly different. That is for handling "versioning" caches.

For example, you have a /usr/bin/tar (this is old tar) and its buildid-cache
in cache directory by perf buildid-cache -a /usr/bin/tar.
And at some point, you will update the /usr/bin/tar (this is new tar).
This new tar binary is not same as old one, so if you also do
perf buildid-cache -a /usr/bin/tar, it creates another version of buildid
cache in cache directory.

At this moment,
$ perf buildid-cache -r /usr/bin/tar
will remove only new tar's buildid cache, but old one remains.

On the other hand,
$ perf buildid-cache -p /usr/bin/tar
will remove all the caches related to /usr/bin/tar from buildid cache.

And since the -p is supposed to be used for cleanup, it doesn't return
error even if there is no buildid cache remaining.

> 
> > [root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
> > Removing bash /usr/bin/: Ok
> > Removing dbus-daemon /usr/bin/: Ok
> > Removing ls /usr/bin/: Ok
> > Removing readlink /usr/bin/: Ok
> > Removing sleep /usr/bin/: Ok
> > Removing tar /usr/bin/: Ok
> > Removing time /usr/bin/: Ok
> > Removing vim /usr/bin/: Ok
> > Purging /usr/bin/: Ok

Hmm, curious...

> 
> In my test it works as advertised:
> 
> [root@jouet ~]# perf buildid-cache -a /usr/bin/tar
> [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> lrwxrwxrwx. 1 root root 58 Oct 16 10:56 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> total 424
> drwxr-xr-x. 2 root root   4096 Oct 16 10:56 .
> drwxr-xr-x. 3 root root   4096 Oct 16 10:56 ..
> -rwxr-xr-x. 2 root root 425032 Jul 19 05:55 elf
> -rw-r--r--. 1 root root      0 Oct 16 10:56 probes
> [root@jouet ~]# perf buildid-cache -vp /usr/bin/tar
> Removing 4c10f253c0cb8459dd846235c0bc18929e4758ea /usr/bin/tar: Ok
> Purging /usr/bin/tar: Ok
> [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> ls: cannot access '/root/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> ls: cannot access '/root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> [root@jouet ~]#
> 
> It was purged.

OK. it seems good.

> 
> Now lets try what you did, which is to ask for a path that will match
> with multiple binaries:
> 
> [root@jouet ~]# perf buildid-cache -v -a /usr/bin/tar
> Adding 4c10f253c0cb8459dd846235c0bc18929e4758ea /usr/bin/tar: Ok
> [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> lrwxrwxrwx. 1 root root 58 Oct 16 10:58 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> total 424
> drwxr-xr-x. 2 root root   4096 Oct 16 10:58 .
> drwxr-xr-x. 3 root root   4096 Oct 16 10:58 ..
> -rwxr-xr-x. 2 root root 425032 Jul 19 05:55 elf
> -rw-r--r--. 1 root root      0 Oct 16 10:58 probes
> [root@jouet ~]# perf buildid-cache -vp /usr/bin
> Removing as /usr/bin: FAIL
> Purging /usr/bin: FAIL
> /usr/bin wasn't in the cache

I think -p does only support a file not a path like that.

> [root@jouet ~]# perf buildid-cache -vp /usr/bin/
> Removing as /usr/bin/: FAIL
> Purging /usr/bin/: FAIL
> /usr/bin/ wasn't in the cache
> [root@jouet ~]#
> 
> This is when --purge was added:
> 
> commit 8d8c8e4cb3014fcc51f0e127b4316043306f5bb0
> Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Date:   Fri Feb 27 13:50:26 2015 +0900
> 
>     perf buildid-cache: Add --purge FILE to remove all caches of FILE
> 
> -----------------------
>  
> > I have done some more debugging and there is something wrong. 
> > The function
> > build_id_cache__purge_path() is called and 
> > build_id_cache__list_build_ids() creates a list of file names located in /usr/bin of the buildid-cache.
> > build_id_cache__remove_s() is called for each name in the list and tries to locate each file name
> > 	in directory .buildid/YY/ZZZ..ZZZ which fails because 
> > build_id_cache__linkname() expects a buildid and gets a file name.
> > The file name bash is treated as .buildid/ba/sh which does not exist.
> 
> probably this got broken when the /elf, /probe separation was added,
> humm, unsure if a 'git bisect' would help here...
> 
> Masami?

Should it work for a directory instead of a file too?
I need to investigate it too.

Thanks,

>  
> > This seems to be a simple mistake so I wonder if I do something wrong.
> 
> - Arnaldo


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: perf buildid-cache -p <path> question
  2017-10-20 16:12   ` Masami Hiramatsu
@ 2017-10-20 16:20     ` Arnaldo Carvalho de Melo
  2017-10-24  7:56       ` Thomas-Mich Richter
  0 siblings, 1 reply; 13+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-10-20 16:20 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Thomas-Mich Richter, linux-perf-use., Hendrik Brueckner

Em Sat, Oct 21, 2017 at 01:12:59AM +0900, Masami Hiramatsu escreveu:
> On Mon, 16 Oct 2017 11:12:22 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > Em Mon, Oct 16, 2017 at 02:24:11PM +0200, Thomas-Mich Richter escreveu:
> > > Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:
> > > 
> > > I can add and remove files using the perf buildid-cache command. For example 
> > > perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
> > > .debug/usr/bin/tar 
> > > and creates the <buildid> subdirectory
> > > .debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.
> > 
> > That is correct.
> > 
> > > Also a symbolic link from the directory
> > > .debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
> > > is created.
> > > 
> > > Command perf buildid-cache -a /usr/bin/tar
> > 
> > Nope, command 'perf buildid-cache -r /usr/bin/tar' does it:
> 
> Wait, -r is remove command.

Yes, of course, please see his original message, he stated that to
remove a file from the buildid cache one should use 'perf buildid-cache -a':

On 10/16/2017 02:24 PM, Thomas-Mich Richter wrote:
> Command perf buildid-cache -a /usr/bin/tar
> removes these entries.

> > [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> > lrwxrwxrwx. 1 root root 58 Oct 16 10:50 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > [root@jouet ~]# 
> > 
> > [root@jouet ~]# perf buildid-cache -r /usr/bin/tar
> > [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > ls: cannot access '/root/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> > [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> > ls: cannot access '/root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> > [root@jouet ~]# 
> > 
> > > removes these entries.
> > > 
> > > Now when I run ./perf buildid-cache -p /usr/bin
> > > nothing happens and success is reported:
> > 
> > When you do '-p' after a '-a' or after a '-r'? From what you wrote
> > below, that is after you do a '-a /usr/bin/tar', as it is being purged
> > as well.
> > 
> > Masami?
> 
> Yeah, should be. 
> 
> OK, -p and -r is slightly different. That is for handling "versioning" caches.
> 
> For example, you have a /usr/bin/tar (this is old tar) and its buildid-cache
> in cache directory by perf buildid-cache -a /usr/bin/tar.
> And at some point, you will update the /usr/bin/tar (this is new tar).
> This new tar binary is not same as old one, so if you also do
> perf buildid-cache -a /usr/bin/tar, it creates another version of buildid
> cache in cache directory.
> 
> At this moment,
> $ perf buildid-cache -r /usr/bin/tar
> will remove only new tar's buildid cache, but old one remains.
> 
> On the other hand,
> $ perf buildid-cache -p /usr/bin/tar
> will remove all the caches related to /usr/bin/tar from buildid cache.
> 
> And since the -p is supposed to be used for cleanup, it doesn't return
> error even if there is no buildid cache remaining.
> 
> > 
> > > [root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
> > > Removing bash /usr/bin/: Ok
> > > Removing dbus-daemon /usr/bin/: Ok
> > > Removing ls /usr/bin/: Ok
> > > Removing readlink /usr/bin/: Ok
> > > Removing sleep /usr/bin/: Ok
> > > Removing tar /usr/bin/: Ok
> > > Removing time /usr/bin/: Ok
> > > Removing vim /usr/bin/: Ok
> > > Purging /usr/bin/: Ok
> 
> Hmm, curious...
> 
> > 
> > In my test it works as advertised:
> > 
> > [root@jouet ~]# perf buildid-cache -a /usr/bin/tar
> > [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> > lrwxrwxrwx. 1 root root 58 Oct 16 10:56 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > total 424
> > drwxr-xr-x. 2 root root   4096 Oct 16 10:56 .
> > drwxr-xr-x. 3 root root   4096 Oct 16 10:56 ..
> > -rwxr-xr-x. 2 root root 425032 Jul 19 05:55 elf
> > -rw-r--r--. 1 root root      0 Oct 16 10:56 probes
> > [root@jouet ~]# perf buildid-cache -vp /usr/bin/tar
> > Removing 4c10f253c0cb8459dd846235c0bc18929e4758ea /usr/bin/tar: Ok
> > Purging /usr/bin/tar: Ok
> > [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > ls: cannot access '/root/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> > [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> > ls: cannot access '/root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea': No such file or directory
> > [root@jouet ~]#
> > 
> > It was purged.
> 
> OK. it seems good.
> 
> > 
> > Now lets try what you did, which is to ask for a path that will match
> > with multiple binaries:
> > 
> > [root@jouet ~]# perf buildid-cache -v -a /usr/bin/tar
> > Adding 4c10f253c0cb8459dd846235c0bc18929e4758ea /usr/bin/tar: Ok
> > [root@jouet ~]# ls -la ~/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea
> > lrwxrwxrwx. 1 root root 58 Oct 16 10:58 /root/.debug/.build-id/4c/10f253c0cb8459dd846235c0bc18929e4758ea -> ../../usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > [root@jouet ~]# ls -la ~/.debug/usr/bin/tar/4c10f253c0cb8459dd846235c0bc18929e4758ea
> > total 424
> > drwxr-xr-x. 2 root root   4096 Oct 16 10:58 .
> > drwxr-xr-x. 3 root root   4096 Oct 16 10:58 ..
> > -rwxr-xr-x. 2 root root 425032 Jul 19 05:55 elf
> > -rw-r--r--. 1 root root      0 Oct 16 10:58 probes
> > [root@jouet ~]# perf buildid-cache -vp /usr/bin
> > Removing as /usr/bin: FAIL
> > Purging /usr/bin: FAIL
> > /usr/bin wasn't in the cache
> 
> I think -p does only support a file not a path like that.
> 
> > [root@jouet ~]# perf buildid-cache -vp /usr/bin/
> > Removing as /usr/bin/: FAIL
> > Purging /usr/bin/: FAIL
> > /usr/bin/ wasn't in the cache
> > [root@jouet ~]#
> > 
> > This is when --purge was added:
> > 
> > commit 8d8c8e4cb3014fcc51f0e127b4316043306f5bb0
> > Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> > Date:   Fri Feb 27 13:50:26 2015 +0900
> > 
> >     perf buildid-cache: Add --purge FILE to remove all caches of FILE
> > 
> > -----------------------
> >  
> > > I have done some more debugging and there is something wrong. 
> > > The function
> > > build_id_cache__purge_path() is called and 
> > > build_id_cache__list_build_ids() creates a list of file names located in /usr/bin of the buildid-cache.
> > > build_id_cache__remove_s() is called for each name in the list and tries to locate each file name
> > > 	in directory .buildid/YY/ZZZ..ZZZ which fails because 
> > > build_id_cache__linkname() expects a buildid and gets a file name.
> > > The file name bash is treated as .buildid/ba/sh which does not exist.
> > 
> > probably this got broken when the /elf, /probe separation was added,
> > humm, unsure if a 'git bisect' would help here...
> > 
> > Masami?
> 
> Should it work for a directory instead of a file too?
> I need to investigate it too.

Isn't that implemented by I patch by Thomas?

- Arnaldo

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

* Re: perf buildid-cache -p <path> question
  2017-10-16 12:24 perf buildid-cache -p <path> question Thomas-Mich Richter
  2017-10-16 13:45 ` Thomas-Mich Richter
  2017-10-16 14:12 ` Arnaldo Carvalho de Melo
@ 2017-10-21 15:17 ` Masami Hiramatsu
  2017-10-24  6:50   ` Thomas-Mich Richter
  2 siblings, 1 reply; 13+ messages in thread
From: Masami Hiramatsu @ 2017-10-21 15:17 UTC (permalink / raw)
  To: Thomas-Mich Richter
  Cc: linux-perf-use., Arnaldo Carvalho de Melo, Hendrik Brueckner

On Mon, 16 Oct 2017 14:24:11 +0200
Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> wrote:

> Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:
> 
> I can add and remove files using the perf buildid-cache command. For example 
> perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
> .debug/usr/bin/tar 
> and creates the <buildid> subdirectory
> .debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.
> Also a symbolic link from the directory
> .debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
> is created.
> 
> Command perf buildid-cache -a /usr/bin/tar
> removes these entries.
> 
> Now when I run ./perf buildid-cache -p /usr/bin
> nothing happens and success is reported:
> [root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
> Removing bash /usr/bin/: Ok
> Removing dbus-daemon /usr/bin/: Ok
> Removing ls /usr/bin/: Ok
> Removing readlink /usr/bin/: Ok
> Removing sleep /usr/bin/: Ok
> Removing tar /usr/bin/: Ok
> Removing time /usr/bin/: Ok
> Removing vim /usr/bin/: Ok
> Purging /usr/bin/: Ok

How did you do that? 

At first, perf buildid-cache -p only accept target binary path, not a directory. Because -p (--purge) is for removing all "histrical" caches of target binary, that should be compatible to -r (--remove) option.

Anyway, if I tries below, I got just an error.

[mhiramat@devbox perf]$ rm -rf ~/.debug/
[mhiramat@devbox perf]$ ./perf buildid-cache -a /usr/bin/tar
[mhiramat@devbox perf]$ ./perf buildid-cache -vp /usr/bin
Removing tar /usr/bin: FAIL
Purging /usr/bin: FAIL
/usr/bin wasn't in the cache

Because "/usr/bin" is a directory and not cached. Also, if I add /usr/bin as below, it's just refused.

[mhiramat@devbox perf]$ ./perf buildid-cache -a /usr/bin
Couldn't add /usr/bin: Is a directory

So, I wonder how did you do that.

Thank you,

> 
> I have done some more debugging and there is something wrong. 
> The function
> build_id_cache__purge_path() is called and 
> build_id_cache__list_build_ids() creates a list of file names located in /usr/bin of the buildid-cache.
> build_id_cache__remove_s() is called for each name in the list and tries to locate each file name
> 	in directory .buildid/YY/ZZZ..ZZZ which fails because 
> build_id_cache__linkname() expects a buildid and gets a file name.
> The file name bash is treated as .buildid/ba/sh which does not exist.
> 
> 
> This seems to be a simple mistake so I wonder if I do something wrong.
> 
> Thanks
> -- 
> Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
> --
> Vorsitzende des Aufsichtsrats: Martina Koederitz 
> Geschäftsführung: Dirk Wittkopp
> Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: perf buildid-cache -p <path> question
  2017-10-21 15:17 ` Masami Hiramatsu
@ 2017-10-24  6:50   ` Thomas-Mich Richter
  2017-10-25 16:57     ` Masami Hiramatsu
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas-Mich Richter @ 2017-10-24  6:50 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: linux-perf-use., Arnaldo Carvalho de Melo, Hendrik Brueckner

On 10/21/2017 05:17 PM, Masami Hiramatsu wrote:
> On Mon, 16 Oct 2017 14:24:11 +0200
> Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> wrote:
> 
>> Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:
>>
>> I can add and remove files using the perf buildid-cache command. For example 
>> perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
>> .debug/usr/bin/tar 
>> and creates the <buildid> subdirectory
>> .debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.
>> Also a symbolic link from the directory
>> .debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
>> is created.
>>
>> Command perf buildid-cache -a /usr/bin/tar
>> removes these entries.
>>
>> Now when I run ./perf buildid-cache -p /usr/bin
>> nothing happens and success is reported:
>> [root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
>> Removing bash /usr/bin/: Ok
>> Removing dbus-daemon /usr/bin/: Ok
>> Removing ls /usr/bin/: Ok
>> Removing readlink /usr/bin/: Ok
>> Removing sleep /usr/bin/: Ok
>> Removing tar /usr/bin/: Ok
>> Removing time /usr/bin/: Ok
>> Removing vim /usr/bin/: Ok
>> Purging /usr/bin/: Ok
> 
> How did you do that? 
> 
> At first, perf buildid-cache -p only accept target binary path, not a directory. Because -p (--purge) is for removing all "histrical" caches of target binary, that should be compatible to -r (--remove) option.
> 
> Anyway, if I tries below, I got just an error.
> 
> [mhiramat@devbox perf]$ rm -rf ~/.debug/
> [mhiramat@devbox perf]$ ./perf buildid-cache -a /usr/bin/tar
> [mhiramat@devbox perf]$ ./perf buildid-cache -vp /usr/bin
> Removing tar /usr/bin: FAIL
> Purging /usr/bin: FAIL
> /usr/bin wasn't in the cache
> 
> Because "/usr/bin" is a directory and not cached. Also, if I add /usr/bin as below, it's just refused.
> 
> [mhiramat@devbox perf]$ ./perf buildid-cache -a /usr/bin
> Couldn't add /usr/bin: Is a directory
> 
> So, I wonder how did you do that.

When you look at the patch I submitted, in function build_id_cache__purge_path()
you specify a fully qualified path name, for example /usr/bin/tar. This is a file
and it calls function build_id_cache__remove_file() to remove its entries in the cache.

However if this function gets something like /usr/bin it detects that this is
a directory (system call stat(2)) and calls build_id_cache__purge_path() recursively
to remove the contents of this directory.

PS: This is the same approach as in function rm_rf() which recusively calls itself
to remove all possible buidid entries of a binary.

Hope this helps.



> 
> Thank you,
> 

-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: perf buildid-cache -p <path> question
  2017-10-20 16:20     ` Arnaldo Carvalho de Melo
@ 2017-10-24  7:56       ` Thomas-Mich Richter
  2017-10-25 17:04         ` Masami Hiramatsu
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas-Mich Richter @ 2017-10-24  7:56 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Masami Hiramatsu
  Cc: linux-perf-use., Hendrik Brueckner

On 10/20/2017 06:20 PM, Arnaldo Carvalho de Melo wrote:
> Em Sat, Oct 21, 2017 at 01:12:59AM +0900, Masami Hiramatsu escreveu:
>> On Mon, 16 Oct 2017 11:12:22 -0300
>> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>>
>>
>> For example, you have a /usr/bin/tar (this is old tar) and its buildid-cache
>> in cache directory by perf buildid-cache -a /usr/bin/tar.
>> And at some point, you will update the /usr/bin/tar (this is new tar).
>> This new tar binary is not same as old one, so if you also do
>> perf buildid-cache -a /usr/bin/tar, it creates another version of buildid
>> cache in cache directory.
>>
>> At this moment,
>> $ perf buildid-cache -r /usr/bin/tar
>> will remove only new tar's buildid cache, but old one remains.
>>
>> On the other hand,
>> $ perf buildid-cache -p /usr/bin/tar
>> will remove all the caches related to /usr/bin/tar from buildid cache.
>>
>> And since the -p is supposed to be used for cleanup, it doesn't return
>> error even if there is no buildid cache remaining.
>>
>>
>> Should it work for a directory instead of a file too?
>> I need to investigate it too.
> 
> Isn't that implemented by I patch by Thomas?
> 
> - Arnaldo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Ok, I have understood the behavior of commands
perf buildid-cache -a
and
perf buildid-cache -r.

Same with command perf buildid-cache -p /usr/bin/tar.
It works correctly if you specify a file name and not a directory as I did
in my previous append.

I was mislead by the man page which says
"file list" for option -a
"file(s) to remove" for option -r
"path(s) to remove (remove old caches too)' for option -p

I just find it confusing to explicitly mention files for
option -a and -r whereas option -p mentions path.

We can drop my patch but I would like to clarify the man page
to explicitly mention "file(s)" or "file list" instead of path for option -p.

What do you think?                                                                             

-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: perf buildid-cache -p <path> question
  2017-10-24  6:50   ` Thomas-Mich Richter
@ 2017-10-25 16:57     ` Masami Hiramatsu
  2017-10-26  7:07       ` Thomas-Mich Richter
  0 siblings, 1 reply; 13+ messages in thread
From: Masami Hiramatsu @ 2017-10-25 16:57 UTC (permalink / raw)
  To: Thomas-Mich Richter
  Cc: linux-perf-use., Arnaldo Carvalho de Melo, Hendrik Brueckner

On Tue, 24 Oct 2017 08:50:27 +0200
Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> wrote:

> On 10/21/2017 05:17 PM, Masami Hiramatsu wrote:
> > On Mon, 16 Oct 2017 14:24:11 +0200
> > Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> wrote:
> > 
> >> Maybe its me misunderstanding the buildid cache completely, but I ran into the following issue:
> >>
> >> I can add and remove files using the perf buildid-cache command. For example 
> >> perf buildid-cache -a /usr/bin/tar adds the tar executable to the buildid-cache directory
> >> .debug/usr/bin/tar 
> >> and creates the <buildid> subdirectory
> >> .debug/usr/bin/tar/e54c9946802bbbcb85760ffeb80700a5fd35ebe7/elf file.
> >> Also a symbolic link from the directory
> >> .debug/.buildid/e5/4c9946802bbbcb85760ffeb80700a5fd35ebe7 --> ../../usr/bin/tar/<buildid>/
> >> is created.
> >>
> >> Command perf buildid-cache -a /usr/bin/tar
> >> removes these entries.
> >>
> >> Now when I run ./perf buildid-cache -p /usr/bin
> >> nothing happens and success is reported:
> >> [root@s35lp76 perf]# ./perf buildid-cache -vp /usr/bin/
> >> Removing bash /usr/bin/: Ok
> >> Removing dbus-daemon /usr/bin/: Ok
> >> Removing ls /usr/bin/: Ok
> >> Removing readlink /usr/bin/: Ok
> >> Removing sleep /usr/bin/: Ok
> >> Removing tar /usr/bin/: Ok
> >> Removing time /usr/bin/: Ok
> >> Removing vim /usr/bin/: Ok
> >> Purging /usr/bin/: Ok
> > 
> > How did you do that? 
> > 
> > At first, perf buildid-cache -p only accept target binary path, not a directory. Because -p (--purge) is for removing all "histrical" caches of target binary, that should be compatible to -r (--remove) option.
> > 
> > Anyway, if I tries below, I got just an error.
> > 
> > [mhiramat@devbox perf]$ rm -rf ~/.debug/
> > [mhiramat@devbox perf]$ ./perf buildid-cache -a /usr/bin/tar
> > [mhiramat@devbox perf]$ ./perf buildid-cache -vp /usr/bin
> > Removing tar /usr/bin: FAIL
> > Purging /usr/bin: FAIL
> > /usr/bin wasn't in the cache
> > 
> > Because "/usr/bin" is a directory and not cached. Also, if I add /usr/bin as below, it's just refused.
> > 
> > [mhiramat@devbox perf]$ ./perf buildid-cache -a /usr/bin
> > Couldn't add /usr/bin: Is a directory
> > 
> > So, I wonder how did you do that.
> 
> When you look at the patch I submitted, in function build_id_cache__purge_path()
> you specify a fully qualified path name, for example /usr/bin/tar. This is a file
> and it calls function build_id_cache__remove_file() to remove its entries in the cache.

OK, now I see what the question is based on...
I'll see your patch.

Thank you,

> 
> However if this function gets something like /usr/bin it detects that this is
> a directory (system call stat(2)) and calls build_id_cache__purge_path() recursively
> to remove the contents of this directory.
> 
> PS: This is the same approach as in function rm_rf() which recusively calls itself
> to remove all possible buidid entries of a binary.
> 
> Hope this helps.
> 
> 
> 
> > 
> > Thank you,
> > 
> 
> -- 
> Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
> --
> Vorsitzende des Aufsichtsrats: Martina Koederitz 
> Geschäftsführung: Dirk Wittkopp
> Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: perf buildid-cache -p <path> question
  2017-10-24  7:56       ` Thomas-Mich Richter
@ 2017-10-25 17:04         ` Masami Hiramatsu
  2017-10-26  7:05           ` Thomas-Mich Richter
  0 siblings, 1 reply; 13+ messages in thread
From: Masami Hiramatsu @ 2017-10-25 17:04 UTC (permalink / raw)
  To: Thomas-Mich Richter
  Cc: Arnaldo Carvalho de Melo, linux-perf-use., Hendrik Brueckner

On Tue, 24 Oct 2017 09:56:02 +0200
Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> wrote:

> On 10/20/2017 06:20 PM, Arnaldo Carvalho de Melo wrote:
> > Em Sat, Oct 21, 2017 at 01:12:59AM +0900, Masami Hiramatsu escreveu:
> >> On Mon, 16 Oct 2017 11:12:22 -0300
> >> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >>
> >>
> >> For example, you have a /usr/bin/tar (this is old tar) and its buildid-cache
> >> in cache directory by perf buildid-cache -a /usr/bin/tar.
> >> And at some point, you will update the /usr/bin/tar (this is new tar).
> >> This new tar binary is not same as old one, so if you also do
> >> perf buildid-cache -a /usr/bin/tar, it creates another version of buildid
> >> cache in cache directory.
> >>
> >> At this moment,
> >> $ perf buildid-cache -r /usr/bin/tar
> >> will remove only new tar's buildid cache, but old one remains.
> >>
> >> On the other hand,
> >> $ perf buildid-cache -p /usr/bin/tar
> >> will remove all the caches related to /usr/bin/tar from buildid cache.
> >>
> >> And since the -p is supposed to be used for cleanup, it doesn't return
> >> error even if there is no buildid cache remaining.
> >>
> >>
> >> Should it work for a directory instead of a file too?
> >> I need to investigate it too.
> > 
> > Isn't that implemented by I patch by Thomas?
> > 
> > - Arnaldo
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> Ok, I have understood the behavior of commands
> perf buildid-cache -a
> and
> perf buildid-cache -r.
> 
> Same with command perf buildid-cache -p /usr/bin/tar.
> It works correctly if you specify a file name and not a directory as I did
> in my previous append.
> 
> I was mislead by the man page which says
> "file list" for option -a
> "file(s) to remove" for option -r
> "path(s) to remove (remove old caches too)' for option -p
> 
> I just find it confusing to explicitly mention files for
> option -a and -r whereas option -p mentions path.
> 
> We can drop my patch but I would like to clarify the man page
> to explicitly mention "file(s)" or "file list" instead of path for option -p.
> 
> What do you think?

Indeed. Originally the "file" means existing file but "path" means the path in the
cache, which can be already removed. However, that can mislead users.
So I agree that is unified to "file list".

Thank you,

> 
> -- 
> Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
> --
> Vorsitzende des Aufsichtsrats: Martina Koederitz 
> Geschäftsführung: Dirk Wittkopp
> Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: perf buildid-cache -p <path> question
  2017-10-25 17:04         ` Masami Hiramatsu
@ 2017-10-26  7:05           ` Thomas-Mich Richter
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas-Mich Richter @ 2017-10-26  7:05 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Arnaldo Carvalho de Melo, linux-perf-use., Hendrik Brueckner

On 10/25/2017 07:04 PM, Masami Hiramatsu wrote:
> On Tue, 24 Oct 2017 09:56:02 +0200
> Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> wrote:

...

>>
>> Ok, I have understood the behavior of commands
>> perf buildid-cache -a
>> and
>> perf buildid-cache -r.
>>
>> Same with command perf buildid-cache -p /usr/bin/tar.
>> It works correctly if you specify a file name and not a directory as I did
>> in my previous append.
>>
>> I was mislead by the man page which says
>> "file list" for option -a
>> "file(s) to remove" for option -r
>> "path(s) to remove (remove old caches too)' for option -p
>>
>> I just find it confusing to explicitly mention files for
>> option -a and -r whereas option -p mentions path.
>>
>> We can drop my patch but I would like to clarify the man page
>> to explicitly mention "file(s)" or "file list" instead of path for option -p.
>>
>> What do you think?
> 
> Indeed. Originally the "file" means existing file but "path" means the path in the
> cache, which can be already removed. However, that can mislead users.
> So I agree that is unified to "file list".
> 
> Thank you,
> 

Ok, do you change the man page or should I submit a patch?


-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: perf buildid-cache -p <path> question
  2017-10-25 16:57     ` Masami Hiramatsu
@ 2017-10-26  7:07       ` Thomas-Mich Richter
  2017-10-26 14:41         ` Masami Hiramatsu
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas-Mich Richter @ 2017-10-26  7:07 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: linux-perf-use., Arnaldo Carvalho de Melo, Hendrik Brueckner

On 10/25/2017 06:57 PM, Masami Hiramatsu wrote:

...

>>
>> When you look at the patch I submitted, in function build_id_cache__purge_path()
>> you specify a fully qualified path name, for example /usr/bin/tar. This is a file
>> and it calls function build_id_cache__remove_file() to remove its entries in the cache.
> 
> OK, now I see what the question is based on...
> I'll see your patch.
> 
> Thank you,
> 

I think we drop the patch and change the man page instead.
Any objections?

-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: perf buildid-cache -p <path> question
  2017-10-26  7:07       ` Thomas-Mich Richter
@ 2017-10-26 14:41         ` Masami Hiramatsu
  0 siblings, 0 replies; 13+ messages in thread
From: Masami Hiramatsu @ 2017-10-26 14:41 UTC (permalink / raw)
  To: Thomas-Mich Richter
  Cc: linux-perf-use., Arnaldo Carvalho de Melo, Hendrik Brueckner

On Thu, 26 Oct 2017 09:07:21 +0200
Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> wrote:

> On 10/25/2017 06:57 PM, Masami Hiramatsu wrote:
> 
> ...
> 
> >>
> >> When you look at the patch I submitted, in function build_id_cache__purge_path()
> >> you specify a fully qualified path name, for example /usr/bin/tar. This is a file
> >> and it calls function build_id_cache__remove_file() to remove its entries in the cache.
> > 
> > OK, now I see what the question is based on...
> > I'll see your patch.
> > 
> > Thank you,
> > 
> 
> I think we drop the patch and change the man page instead.
> Any objections?

No, it's just reply ordering issue. :) (I saw this first, and the other next)

Thank you,

> 
> -- 
> Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
> --
> Vorsitzende des Aufsichtsrats: Martina Koederitz 
> Geschäftsführung: Dirk Wittkopp
> Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

end of thread, other threads:[~2017-10-26 14:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 12:24 perf buildid-cache -p <path> question Thomas-Mich Richter
2017-10-16 13:45 ` Thomas-Mich Richter
2017-10-16 14:12 ` Arnaldo Carvalho de Melo
2017-10-20 16:12   ` Masami Hiramatsu
2017-10-20 16:20     ` Arnaldo Carvalho de Melo
2017-10-24  7:56       ` Thomas-Mich Richter
2017-10-25 17:04         ` Masami Hiramatsu
2017-10-26  7:05           ` Thomas-Mich Richter
2017-10-21 15:17 ` Masami Hiramatsu
2017-10-24  6:50   ` Thomas-Mich Richter
2017-10-25 16:57     ` Masami Hiramatsu
2017-10-26  7:07       ` Thomas-Mich Richter
2017-10-26 14:41         ` Masami Hiramatsu

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.