All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Error reporting improvement (updated)
@ 2014-04-18  2:00 Adrien BAK
  2014-04-18  8:41 ` Peter Zijlstra
  2014-04-20  8:03 ` [tip:perf/urgent] perf tools: Improve error reporting tip-bot for Adrien BAK
  0 siblings, 2 replies; 5+ messages in thread
From: Adrien BAK @ 2014-04-18  2:00 UTC (permalink / raw)
  To: linux-perf-users, Jiri Olsa
  Cc: paulus, a.p.zijlstra, mingo, acme, will.deacon

Update : I resend this patch due to my email client behaving. I added the
reported-by line Will Deacon added in the original discussion.

In the current version, when using perf record, if something goes wrong in
tools/perf/builtin-record.c:375  session = perf_session__new(file, 
false, NULL);
The error message:
"Not enough memory for reading per file header"
is issued. This error message seems to be outdated and is not very helpful.
This patch propose to replace this error message by
"Perf session creation failed"

I believe this issue has been brought to lkml :
https://lkml.org/lkml/2014/2/24/458
although this patch only tackle a (small) part of the issue.

Additionnaly, this patch improves error reporting in
tools/perf/util/data.c open_file_write
Currently, if the call to open fails, the user is unaware of it.
This patch logs the error, before returning the error code to the caller.

Signed-off-by: Adrien BAK <adrien.bak@metascale.org>
Reported-by: Will Deacon <will.deacon@arm.com>
---
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index eb524f9..8ce62ef 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 
 	session = perf_session__new(file, false, NULL);
 	if (session == NULL) {
-		pr_err("Not enough memory for reading perf file header\n");
+		pr_err("Perf session creation failed.\n");
 		return -1;
 	}
 
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 1fbcd8b..ff2ced7 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -86,10 +86,16 @@ static int open_file_read(struct perf_data_file *file)
 
 static int open_file_write(struct perf_data_file *file)
 {
+	int fd;
 	if (check_backup(file))
 		return -1;
 
-	return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+	fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+
+	if (fd < 0)
+		pr_err("failed to open %s : %s\n", file->path, strerror(errno));
+
+	return fd;
 }
 
 static int open_file(struct perf_data_file *file)

-- 
A.

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

* Re: [PATCH] Error reporting improvement (updated)
  2014-04-18  2:00 [PATCH] Error reporting improvement (updated) Adrien BAK
@ 2014-04-18  8:41 ` Peter Zijlstra
  2014-04-18 10:25   ` Jiri Olsa
  2014-04-20  8:03 ` [tip:perf/urgent] perf tools: Improve error reporting tip-bot for Adrien BAK
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2014-04-18  8:41 UTC (permalink / raw)
  To: Adrien BAK; +Cc: linux-perf-users, Jiri Olsa, paulus, mingo, acme, will.deacon

On Fri, Apr 18, 2014 at 11:00:43AM +0900, Adrien BAK wrote:
> Update : I resend this patch due to my email client behaving. I added the

You should also add a subsystem tag in your $subject, something like:

Subject: [PATCH] perf,tools: Error reporting improvement (updated)
                 ^^^^^^^^^^^

That makes it clear what you're patching.

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

* Re: [PATCH] Error reporting improvement (updated)
  2014-04-18  8:41 ` Peter Zijlstra
@ 2014-04-18 10:25   ` Jiri Olsa
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2014-04-18 10:25 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Adrien BAK, linux-perf-users, paulus, mingo, acme, will.deacon

On Fri, Apr 18, 2014 at 10:41:04AM +0200, Peter Zijlstra wrote:
> On Fri, Apr 18, 2014 at 11:00:43AM +0900, Adrien BAK wrote:
> > Update : I resend this patch due to my email client behaving. I added the
> 
> You should also add a subsystem tag in your $subject, something like:
> 
> Subject: [PATCH] perf,tools: Error reporting improvement (updated)
>                  ^^^^^^^^^^^
> 
> That makes it clear what you're patching.

no need to resend, I fixed that for you this time

jirka

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

* [tip:perf/urgent] perf tools: Improve error reporting
  2014-04-18  2:00 [PATCH] Error reporting improvement (updated) Adrien BAK
  2014-04-18  8:41 ` Peter Zijlstra
@ 2014-04-20  8:03 ` tip-bot for Adrien BAK
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Adrien BAK @ 2014-04-20  8:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, will.deacon, adrien.bak, tglx, jolsa

Commit-ID:  ffa91880a992ec1aaee4b4f7c9ddffda0c277ba9
Gitweb:     http://git.kernel.org/tip/ffa91880a992ec1aaee4b4f7c9ddffda0c277ba9
Author:     Adrien BAK <adrien.bak@metascale.org>
AuthorDate: Fri, 18 Apr 2014 11:00:43 +0900
Committer:  Jiri Olsa <jolsa@redhat.com>
CommitDate: Sun, 20 Apr 2014 00:15:12 +0200

perf tools: Improve error reporting

In the current version, when using perf record, if something goes
wrong in tools/perf/builtin-record.c:375
  session = perf_session__new(file, false, NULL);

The error message:
"Not enough memory for reading per file header"

is issued. This error message seems to be outdated and is not very
helpful. This patch proposes to replace this error message by
"Perf session creation failed"

I believe this issue has been brought to lkml:
https://lkml.org/lkml/2014/2/24/458
although this patch only tackles a (small) part of the issue.

Additionnaly, this patch improves error reporting in
tools/perf/util/data.c open_file_write.

Currently, if the call to open fails, the user is unaware of it.
This patch logs the error, before returning the error code to
the caller.

Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Adrien BAK <adrien.bak@metascale.org>
Link: http://lkml.kernel.org/r/1397786443.3093.4.camel@beast
[ Reorganize the changelog into paragraphs ]
[ Added empty line after fd declaration in open_file_write ]
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-record.c | 2 +-
 tools/perf/util/data.c      | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index eb524f9..8ce62ef 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 
 	session = perf_session__new(file, false, NULL);
 	if (session == NULL) {
-		pr_err("Not enough memory for reading perf file header\n");
+		pr_err("Perf session creation failed.\n");
 		return -1;
 	}
 
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 1fbcd8b..55de44e 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -86,10 +86,17 @@ static int open_file_read(struct perf_data_file *file)
 
 static int open_file_write(struct perf_data_file *file)
 {
+	int fd;
+
 	if (check_backup(file))
 		return -1;
 
-	return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+	fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+
+	if (fd < 0)
+		pr_err("failed to open %s : %s\n", file->path, strerror(errno));
+
+	return fd;
 }
 
 static int open_file(struct perf_data_file *file)

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

* [PATCH] Error reporting improvement (updated)
@ 2014-04-18  4:59 Adrien BAK
  0 siblings, 0 replies; 5+ messages in thread
From: Adrien BAK @ 2014-04-18  4:59 UTC (permalink / raw)
  To: linux-perf-users, Jiri Olsa
  Cc: paulus, a.p.zijlstra, mingo, acme, will.deacon

Update : I resend this patch due to my email client behaving. I added the
reported-by line Will Deacon added in the original discussion.

In the current version, when using perf record, if something goes wrong in
tools/perf/builtin-record.c:375  session = perf_session__new(file, 
false, NULL);
The error message:
"Not enough memory for reading per file header"
is issued. This error message seems to be outdated and is not very helpful.
This patch propose to replace this error message by
"Perf session creation failed"

I believe this issue has been brought to lkml :
https://lkml.org/lkml/2014/2/24/458
although this patch only tackle a (small) part of the issue.

Additionnaly, this patch improves error reporting in
tools/perf/util/data.c open_file_write
Currently, if the call to open fails, the user is unaware of it.
This patch logs the error, before returning the error code to the caller.

Signed-off-by: Adrien BAK <adrien.bak@metascale.org>
Reported-by: Will Deacon <will.deacon@arm.com>
---
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index eb524f9..8ce62ef 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 
 	session = perf_session__new(file, false, NULL);
 	if (session == NULL) {
-		pr_err("Not enough memory for reading perf file header\n");
+		pr_err("Perf session creation failed.\n");
 		return -1;
 	}
 
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 1fbcd8b..ff2ced7 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -86,10 +86,16 @@ static int open_file_read(struct perf_data_file *file)
 
 static int open_file_write(struct perf_data_file *file)
 {
+	int fd;
 	if (check_backup(file))
 		return -1;
 
-	return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+	fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+
+	if (fd < 0)
+		pr_err("failed to open %s : %s\n", file->path, strerror(errno));
+
+	return fd;
 }
 
 static int open_file(struct perf_data_file *file)

-- 
A.

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

end of thread, other threads:[~2014-04-20  8:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18  2:00 [PATCH] Error reporting improvement (updated) Adrien BAK
2014-04-18  8:41 ` Peter Zijlstra
2014-04-18 10:25   ` Jiri Olsa
2014-04-20  8:03 ` [tip:perf/urgent] perf tools: Improve error reporting tip-bot for Adrien BAK
2014-04-18  4:59 [PATCH] Error reporting improvement (updated) Adrien BAK

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.