Skip to contentSkip to conversation

perf buildid-cache: Warn --purge-all failures

PATCH Superseded Ravi Bangoria 4 participants 6 messages May 9, 2018 – May 16, 2018 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf buildid-cache: Warn --purge-all failures

Warn perf buildid-cache --purge-all failures in non verbose mode. Ex,

  $ sudo chown root:root /home/ravi/.debug -R
  $ ./perf buildid-cache -P
    Error: Permission denied.
---
 tools/perf/builtin-buildid-cache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-buildid-cache.c +6 -2
index 7a7403913b57..ef6b3cc8d57d 100644
@@ -488,8 +488,12 @@ int cmd_buildid_cache(int argc, const char **argv)
 		}
 	}
 
-	if (purge_all)
-		ret = build_id_cache__purge_all();
+	if (purge_all) {
+		if (build_id_cache__purge_all()) {
+			pr_warning("Error: %s.\n",
+				str_error_r(errno, sbuf, sizeof(sbuf)));
+		}
+	}
 
 	if (missing_filename)
 		ret = build_id_cache__fprintf_missing(session, stdout);
Signature · 1 line
2.14.3
#1 lore raw
Quoted 18 lines · On Wed, 9 May 2018 20:22:05 +0530 Ravi Bangoria <[email protected]>…

Warn perf buildid-cache --purge-all failures in non verbose mode. Ex,

  $ sudo chown root:root /home/ravi/.debug -R
  $ ./perf buildid-cache -P
    Error: Permission denied.
---
 tools/perf/builtin-buildid-cache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-buildid-cache.c +0 -0
index 7a7403913b57..ef6b3cc8d57d 100644

tools/perf/builtin-buildid-cache.c int cmd_buildid_cache(int argc, const char **argv) · line 494

Quoted 9 lines
tools/perf/builtin-buildid-cache.c +4 -2
@@ -488,8 +488,12 @@ int cmd_buildid_cache(int argc, const char **argv)
 		}
 	}
 
-	if (purge_all)
-		ret = build_id_cache__purge_all();
+	if (purge_all) {
+		if (build_id_cache__purge_all()) {
+			pr_warning("Error: %s.\n",
+				str_error_r(errno, sbuf, sizeof(sbuf)));

I would like to see "Couldn't remove some caches: error reason..." as same as other error messages.

Thank you,

Quoted 8 lines
tools/perf/builtin-buildid-cache.c +2 -0
+		}
+	}
 
 	if (missing_filename)
 		ret = build_id_cache__fprintf_missing(session, stdout);
Signature · 1 line
2.14.3
Signature · 1 line
Masami Hiramatsu <[email protected]>
#2 lore raw

PATCH v2 1/1 perf buildid-cache: Warn --purge-all failures

Warn perf buildid-cache --purge-all failures in non verbose mode. Ex,

  $ sudo chown root:root /home/ravi/.debug -R
  $ sudo chmod 700 /home/ravi/.debug/ -R
  $ ./perf buildid-cache -P
    Couldn't remove some caches. Error: Permission denied.
---
 tools/perf/builtin-buildid-cache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-buildid-cache.c +6 -2
index 7a7403913b57..ef6b3cc8d57d 100644
@@ -488,8 +488,12 @@ int cmd_buildid_cache(int argc, const char **argv)
 		}
 	}
 
-	if (purge_all)
-		ret = build_id_cache__purge_all();
+	if (purge_all) {
+		if (build_id_cache__purge_all()) {
+			pr_warning("Couldn't remove some caches. Error: %s.\n",
+				str_error_r(errno, sbuf, sizeof(sbuf)));
+		}
+	}
 
 	if (missing_filename)
 		ret = build_id_cache__fprintf_missing(session, stdout);
Signature · 1 line
2.14.3
Acked-by on v2 1/1
#3 lore raw
Quoted 10 lines · On Thu, 10 May 2018 10:06:51 +0530 Ravi Bangoria <[email protected]>…

Warn perf buildid-cache --purge-all failures in non verbose mode. Ex,

  $ sudo chown root:root /home/ravi/.debug -R
  $ sudo chmod 700 /home/ravi/.debug/ -R
  $ ./perf buildid-cache -P
    Couldn't remove some caches. Error: Permission denied.

This looks good to me.

Thanks!

Quoted 26 lines
---
 tools/perf/builtin-buildid-cache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-buildid-cache.c +6 -2
index 7a7403913b57..ef6b3cc8d57d 100644
@@ -488,8 +488,12 @@ int cmd_buildid_cache(int argc, const char **argv)
 		}
 	}
 
-	if (purge_all)
-		ret = build_id_cache__purge_all();
+	if (purge_all) {
+		if (build_id_cache__purge_all()) {
+			pr_warning("Couldn't remove some caches. Error: %s.\n",
+				str_error_r(errno, sbuf, sizeof(sbuf)));
+		}
+	}
 
 	if (missing_filename)
 		ret = build_id_cache__fprintf_missing(session, stdout);
Signature · 1 line
2.14.3
Signature · 1 line
Masami Hiramatsu <[email protected]>
maintainer Applied
#4 lore raw

Em Fri, May 11, 2018 at 12:37:52AM +0900, Masami Hiramatsu escreveu:

Quoted 11 lines
Quoted 8 lines · On Thu, 10 May 2018 10:06:51 +0530 Ravi Bangoria <[email protected]>…

Warn perf buildid-cache --purge-all failures in non verbose mode. Ex,

  $ sudo chown root:root /home/ravi/.debug -R
  $ sudo chmod 700 /home/ravi/.debug/ -R
  $ ./perf buildid-cache -P
    Couldn't remove some caches. Error: Permission denied.
Quoted 6 lines
Quoted 2 lines

This looks good to me.

Applied to perf/core,

Thanks,

- Arnaldo

#5 lore raw
In reply to Ravi Bangoria
perf buildid-cache: Warn --purge-all failures
Commit-ID:  d8ed87bc171946313b2e6d26e1fec494da9154bc
Gitweb:     https://git.kernel.org/tip/d8ed87bc171946313b2e6d26e1fec494da9154bc
Author:     Ravi Bangoria <[email protected]>
AuthorDate: Thu, 10 May 2018 10:06:51 +0530
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 15 May 2018 10:32:16 -0300

perf buildid-cache: Warn --purge-all failures

Warn perf buildid-cache --purge-all failures in non verbose mode.

Ex.:

  $ sudo chown root:root /home/ravi/.debug -R
  $ sudo chmod 700 /home/ravi/.debug/ -R
  $ ./perf buildid-cache -P
    Couldn't remove some caches. Error: Permission denied.
---
 tools/perf/builtin-buildid-cache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-buildid-cache.c +6 -2
index 7a7403913b57..115110a4796a 100644
@@ -488,8 +488,12 @@ int cmd_buildid_cache(int argc, const char **argv)
 		}
 	}
 
-	if (purge_all)
-		ret = build_id_cache__purge_all();
+	if (purge_all) {
+		if (build_id_cache__purge_all()) {
+			pr_warning("Couldn't remove some caches. Error: %s.\n",
+				str_error_r(errno, sbuf, sizeof(sbuf)));
+		}
+	}
 
 	if (missing_filename)
 		ret = build_id_cache__fprintf_missing(session, stdout);