Messages in this thread Patch in this message | | | Date | Wed, 02 Sep 2009 16:04:48 +0200 | From | markus.t.metzger@intel ... | Subject | [patch 3/3] x86, perf_counter, bts: do not allow kernel BTS tracing. |
| |
Kernel BTS tracing generates too much data too fast for us to handle, causing the kernel to hang.
Fail for BTS requests for kernel code.
CC: Peter Zijlstra <a.p.zjilstra@chello.nl> Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> --- arch/x86/kernel/cpu/perf_counter.c | 11 9 + 2 - 0 ! 1 files changed, 9 insertions(+), 2 deletions(-)
Index: b/arch/x86/kernel/cpu/perf_counter.c =================================================================== --- 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 * Branch tracing: */ if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && - (hwc->sample_period == 1) && !bts_available()) - return -EOPNOTSUPP; + (hwc->sample_period == 1)) { + /* BTS is not supported by this architecture. */ + if (!bts_available()) + return -EOPNOTSUPP; + + /* BTS is currently only allowed for user-mode. */ + if (hwc->config & ARCH_PERFMON_EVENTSEL_OS) + return -EOPNOTSUPP; + } hwc->config |= config; -- --------------------------------------------------------------------- Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen Germany Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer Registergericht: Muenchen HRB 47456 Ust.-IdNr. VAT Registration No.: DE129385895 Citibank Frankfurt (BLZ 502 109 00) 600119052
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
| |