From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.deacon@arm.com (Will Deacon) Date: Tue, 5 Jan 2010 18:07:44 -0000 Subject: [PATCH 5/5] arm/perfevents: implement perf event support for ARMv6 In-Reply-To: <1262602122-10373-6-git-send-email-jamie.iles@picochip.com> References: <1262602122-10373-1-git-send-email-jamie.iles@picochip.com> <1262602122-10373-2-git-send-email-jamie.iles@picochip.com> <1262602122-10373-3-git-send-email-jamie.iles@picochip.com> <1262602122-10373-4-git-send-email-jamie.iles@picochip.com> <1262602122-10373-5-git-send-email-jamie.iles@picochip.com> <1262602122-10373-6-git-send-email-jamie.iles@picochip.com> Message-ID: <000401ca8e31$fac86820$f0593860$@deacon@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Jamie, I've been trying to test your patches with a quad-core ARM 11MPCore on a Realview PB11MP board. Unfortunately, I occasionally experience a complete system hang during some profiling runs. I don't think it's your fault however, as it can occur even when monitoring only software events. I've managed to reproduce this on the tip/master branch and got the following information [I enabled lock debugging]: ================================= [ INFO: inconsistent lock state ] 2.6.33-rc2-tip+ #5 --------------------------------- inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. perf/1463 [HC0[0]:SC0[0]:HE1:SE1] takes: (&ctx->lock){?.....}, at: [] __perf_event_sched_in+0x20/0x168 {IN-HARDIRQ-W} state was registered at: [] __lock_acquire+0x5c8/0x17b4 [] lock_acquire+0xd4/0xec [] _raw_spin_lock+0x2c/0x3c [] perf_ctx_adjust_freq+0xc/0x1dc [] perf_event_task_tick+0x44/0xb4 [] scheduler_tick+0xec/0x144 [] update_process_times+0x40/0x4c [] tick_periodic+0xdc/0x108 [] tick_handle_periodic+0x24/0xf0 [] ipi_timer+0x34/0x44 [] do_local_timer+0x50/0x80 [] __irq_svc+0x44/0xe0 [] default_idle+0x28/0x2c [] cpu_idle+0x8c/0xe4 [<70008080>] 0x70008080 irq event stamp: 454 hardirqs last enabled at (454): [] _raw_spin_unlock_irq+0x24/0x2c hardirqs last disabled at (453): [] _raw_spin_lock_irq+0x18/0x50 softirqs last enabled at (0): [] copy_process+0x328/0xf70 softirqs last disabled at (0): [<(null)>] (null) other info that might help us debug this: no locks held by perf/1463. stack backtrace: [] (unwind_backtrace+0x0/0xd4) from [] (print_usage_bug+0x16c/0x1ac) [] (print_usage_bug+0x16c/0x1ac) from [] (mark_lock+0x328/0x5f0) [] (mark_lock+0x328/0x5f0) from [] (__lock_acquire+0x654/0x17b4) [] (__lock_acquire+0x654/0x17b4) from [] (lock_acquire+0xd4/0xec) [] (lock_acquire+0xd4/0xec) from [] (_raw_spin_lock+0x2c/0x3c) [] (_raw_spin_lock+0x2c/0x3c) from [] (__perf_event_sched_in+0x20/0x168) [] (__perf_event_sched_in+0x20/0x168) from [] (perf_event_task_sched_in+0x48/0x58) [] (perf_event_task_sched_in+0x48/0x58) from [] (finish_task_switch+0x34/0xb4) [] (finish_task_switch+0x34/0xb4) from [] (schedule+0x728/0x834) [] (schedule+0x728/0x834) from [] (pipe_wait+0x64/0x84) [] (pipe_wait+0x64/0x84) from [] (pipe_read+0x3ac/0x428) [] (pipe_read+0x3ac/0x428) from [] (do_sync_read+0x94/0xe0) [] (do_sync_read+0x94/0xe0) from [] (vfs_read+0xa8/0x150) [] (vfs_read+0xa8/0x150) from [] (sys_read+0x3c/0x68) [] (sys_read+0x3c/0x68) from [] (ret_fast_syscall+0x0/0x38) This occurs more frequently when profiling code that spawns child processes [e.g. gcc] but I've see it happen with sleep too. It also happens if I pass maxcpus=1 as a bootarg. Have you seen this happen on your board? I've failed to reproduce it on my x86 machine. Will * Jamie Iles wrote: > This patch implements support for ARMv6 performance counters in the > Linux performance events subsystem. ARMv6 architectures that have the > performance counters should enable HW_PERF_EVENTS and define the > interrupts for the counters in arch/arm/kernel/perf_event.c > > This implementation also provides an ARM PMU abstraction layer to allow > ARMv7 and others to be supported in the future by adding new a > 'struct arm_pmu'. > > Signed-off-by: Jamie Iles > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Jean Pihet > Cc: Will Deacon > --- > arch/arm/Kconfig | 8 + > arch/arm/kernel/Makefile | 1 + > arch/arm/kernel/perf_event.c | 1338 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 1347 insertions(+), 0 deletions(-) > create mode 100644 arch/arm/kernel/perf_event.c