[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-a026dfecc035f213c1cfa0bf6407ce3155f6a9df@git.kernel.org>
Date: Fri, 15 May 2009 08:42:53 GMT
From: tip-bot for Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, hpa@...or.com,
mingo@...hat.com, a.p.zijlstra@...llo.nl, tglx@...utronix.de,
cjashfor@...ux.vnet.ibm.com, mingo@...e.hu
Subject: [tip:perfcounters/core] perf_counter: x86: Allow unpriviliged use of NMIs
Commit-ID: a026dfecc035f213c1cfa0bf6407ce3155f6a9df
Gitweb: http://git.kernel.org/tip/a026dfecc035f213c1cfa0bf6407ce3155f6a9df
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
AuthorDate: Wed, 13 May 2009 10:02:57 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 15 May 2009 09:46:57 +0200
perf_counter: x86: Allow unpriviliged use of NMIs
Apply sysctl_perf_counter_priv to NMIs. Also, fail the counter
creation instead of silently down-grading to regular interrupts.
[ Impact: allow wider perf-counter usage ]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
arch/x86/kernel/cpu/perf_counter.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 88ae8ce..c19e927 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -280,8 +280,11 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
* If privileged enough, allow NMI events:
*/
hwc->nmi = 0;
- if (capable(CAP_SYS_ADMIN) && hw_event->nmi)
+ if (hw_event->nmi) {
+ if (sysctl_perf_counter_priv && !capable(CAP_SYS_ADMIN))
+ return -EACCES;
hwc->nmi = 1;
+ }
hwc->irq_period = hw_event->irq_period;
if ((s64)hwc->irq_period <= 0 || hwc->irq_period > x86_pmu.max_period)
--
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