|
@@ -546,9 +546,6 @@ static int bts_event_init(struct perf_event *event)
|
|
|
if (event->attr.type != bts_pmu.type)
|
|
|
return -ENOENT;
|
|
|
|
|
|
- if (x86_add_exclusive(x86_lbr_exclusive_bts))
|
|
|
- return -EBUSY;
|
|
|
-
|
|
|
/*
|
|
|
* BTS leaks kernel addresses even when CPL0 tracing is
|
|
|
* disabled, so disallow intel_bts driver for unprivileged
|
|
@@ -562,6 +559,9 @@ static int bts_event_init(struct perf_event *event)
|
|
|
!capable(CAP_SYS_ADMIN))
|
|
|
return -EACCES;
|
|
|
|
|
|
+ if (x86_add_exclusive(x86_lbr_exclusive_bts))
|
|
|
+ return -EBUSY;
|
|
|
+
|
|
|
ret = x86_reserve_hardware();
|
|
|
if (ret) {
|
|
|
x86_del_exclusive(x86_lbr_exclusive_bts);
|