[PATCH v2 6/6] perf/x86/intel/bts: Use extended error reporting in event initialization

From: Alexander Shishkin
Date: Mon Aug 24 2015 - 10:36:27 EST


If intel_bts events would conflict with other events that are active in
the system, provide an extended error message to the user along with the
usual EBUSY.

Signed-off-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/perf_event_intel_bts.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_bts.c b/arch/x86/kernel/cpu/perf_event_intel_bts.c
index 54690e8857..c6a8da8f5a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_bts.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_bts.c
@@ -16,6 +16,8 @@

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

+#define PERF_MODNAME "perf/x86/intel/bts"
+
#include <linux/bitops.h>
#include <linux/types.h>
#include <linux/slab.h>
@@ -492,7 +494,7 @@ static int bts_event_init(struct perf_event *event)
return -ENOENT;

if (x86_add_exclusive(x86_lbr_exclusive_bts))
- return -EBUSY;
+ return perf_err(-EBUSY, "BTS conflicts with active events");

ret = x86_reserve_hardware();
if (ret) {
--
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/