From: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: "linux-perf-use." <linux-perf-users@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Subject: Re: perf buildid-cache -p <path> question
Date: Tue, 24 Oct 2017 08:50:27 +0200 [thread overview]
Message-ID: <7d8827b9-2517-dfdb-b5fb-64088c81c0c7@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171022001703.c56a77784dbc49b258d36bf7@kernel.org>
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
next prev parent reply other threads:[~2017-10-24 6:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2017-10-25 16:57 ` Masami Hiramatsu
2017-10-26 7:07 ` Thomas-Mich Richter
2017-10-26 14:41 ` Masami Hiramatsu
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=7d8827b9-2517-dfdb-b5fb-64088c81c0c7@linux.vnet.ibm.com \
--to=tmricht@linux.vnet.ibm.com \
--cc=acme@kernel.org \
--cc=brueckner@linux.vnet.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=mhiramat@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).