[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-c6567f642e20bcc79abed030f44be5b0d6da2ded@git.kernel.org>
Date: Thu, 26 Nov 2009 08:44:56 GMT
From: tip-bot for Frederic Weisbecker <fweisbec@...il.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, acme@...hat.com,
hpa@...or.com, mingo@...hat.com, peterz@...radead.org,
fweisbec@...il.com, tglx@...utronix.de, mingo@...e.hu,
prasad@...ux.vnet.ibm.com
Subject: [tip:perf/core] hw-breakpoints: Improve in-kernel event creation error granularity
Commit-ID: c6567f642e20bcc79abed030f44be5b0d6da2ded
Gitweb: http://git.kernel.org/tip/c6567f642e20bcc79abed030f44be5b0d6da2ded
Author: Frederic Weisbecker <fweisbec@...il.com>
AuthorDate: Thu, 26 Nov 2009 05:35:41 +0100
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 26 Nov 2009 09:29:21 +0100
hw-breakpoints: Improve in-kernel event creation error granularity
In fail case, perf_event_create_kernel_counter() returns NULL
instead of an error, which doesn't help us to inform the user
about the origin of the problem from the outer most callers.
Often we can just return -EINVAL, which doesn't help anyone when
it's eventually about a memory allocation failure.
Then, this patch makes perf_event_create_kernel_counter() always
return a detailed error code.
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Prasad <prasad@...ux.vnet.ibm.com>
LKML-Reference: <1259210142-5714-2-git-send-regression-fweisbec@...il.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/perf_event.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 35df94e..34a1b9d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4780,14 +4780,17 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
*/
ctx = find_get_context(pid, cpu);
- if (IS_ERR(ctx))
- return NULL;
+ if (IS_ERR(ctx)) {
+ err = PTR_ERR(ctx);
+ goto err_exit;
+ }
event = perf_event_alloc(attr, cpu, ctx, NULL,
NULL, callback, GFP_KERNEL);
- err = PTR_ERR(event);
- if (IS_ERR(event))
+ if (IS_ERR(event)) {
+ err = PTR_ERR(event);
goto err_put_context;
+ }
event->filp = NULL;
WARN_ON_ONCE(ctx->parent_ctx);
@@ -4804,11 +4807,10 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
return event;
-err_put_context:
- if (err < 0)
- put_ctx(ctx);
-
- return NULL;
+ err_put_context:
+ put_ctx(ctx);
+ err_exit:
+ return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(perf_event_create_kernel_counter);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists