Old-style BTS driver does not support kernel tracing, which normally would be visible to userspace as -EOPNOTSUPP, or from the tool's user's perspective:
> # perf record -e branches -c1 ls > Error: > No hardware sampling interrupt available. > No APIC? If so then you can boot the kernel with the "lapic" boot parameter > to force-enable it. but with the new way of reporting errors, they will see the following: > # perf record -e branches -c1 ls > Error: > Syscall returned -95, becasue BTS sampling not allowed for kernel space. > Offending attribute field: "exclude_kernel" which is somewhat more to the point of what has actually transpired. Signed-off-by: Alexander Shishkin <[email protected]> --- arch/x86/kernel/cpu/perf_event.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index f56cf074d0..e3d953ef49 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -12,6 +12,8 @@ * For licencing details see kernel-base/COPYING */ +#define EXTERR_MODNAME "perf/x86" + #include <linux/perf_event.h> #include <linux/capability.h> #include <linux/notifier.h> @@ -426,7 +428,8 @@ int x86_setup_perfctr(struct perf_event *event) /* BTS is currently only allowed for user-mode. */ if (!attr->exclude_kernel) - return -EOPNOTSUPP; + return perf_err(-EOPNOTSUPP, exclude_kernel, + "BTS sampling not allowed for kernel space"); /* disallow bts if conflicting events are present */ if (x86_add_exclusive(x86_lbr_exclusive_lbr)) -- 2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

