diff options
-rw-r--r-- | arch/x86/kernel/cpu/perf_counter.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c index 3776b0b630c8..f9cd0849bd42 100644 --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c | |||
@@ -984,8 +984,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter) | |||
984 | * Branch tracing: | 984 | * Branch tracing: |
985 | */ | 985 | */ |
986 | if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && | 986 | if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && |
987 | (hwc->sample_period == 1) && !bts_available()) | 987 | (hwc->sample_period == 1)) { |
988 | return -EOPNOTSUPP; | 988 | /* BTS is not supported by this architecture. */ |
989 | if (!bts_available()) | ||
990 | return -EOPNOTSUPP; | ||
991 | |||
992 | /* BTS is currently only allowed for user-mode. */ | ||
993 | if (hwc->config & ARCH_PERFMON_EVENTSEL_OS) | ||
994 | return -EOPNOTSUPP; | ||
995 | } | ||
989 | 996 | ||
990 | hwc->config |= config; | 997 | hwc->config |= config; |
991 | 998 | ||