linux_dsm_epyc7002/drivers/clocksource
Soren Brinkmann c1dcc927da clocksource: cadence_ttc: Fix mutex taken inside interrupt context
When the kernel is compiled with:
CONFIG_HIGH_RES_TIMERS=no
CONFIG_HZ_PERIODIC=yes
CONFIG_DEBUG_ATOMIC_SLEEP=yes

The following WARN appears:

WARNING: CPU: 1 PID: 0 at linux/kernel/mutex.c:856 mutex_trylock+0x70/0x1fc()
DEBUG_LOCKS_WARN_ON(in_interrupt())
Modules linked in:
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.12.0-xilinx-dirty #93
[<c0014a78>] (unwind_backtrace+0x0/0x11c) from [<c0011b6c>] (show_stack+0x10/0x14)
[<c0011b6c>] (show_stack+0x10/0x14) from [<c039120c>] (dump_stack+0x7c/0xc0)
[<c039120c>] (dump_stack+0x7c/0xc0) from [<c001fda4>] (warn_slowpath_common+0x60/0x84)
[<c001fda4>] (warn_slowpath_common+0x60/0x84) from [<c001fe48>] (warn_slowpath_fmt+0x2c/0x3c)
[<c001fe48>] (warn_slowpath_fmt+0x2c/0x3c) from [<c0392658>] (mutex_trylock+0x70/0x1fc)
[<c0392658>] (mutex_trylock+0x70/0x1fc) from [<c02dfc08>] (clk_prepare_lock+0xc/0xe4)
[<c02dfc08>] (clk_prepare_lock+0xc/0xe4) from [<c02e099c>] (clk_get_rate+0xc/0x44)
[<c02e099c>] (clk_get_rate+0xc/0x44) from [<c02d0394>] (ttc_set_mode+0x34/0x78)
[<c02d0394>] (ttc_set_mode+0x34/0x78) from [<c005f794>] (clockevents_set_mode+0x28/0x5c)
[<c005f794>] (clockevents_set_mode+0x28/0x5c) from [<c00607fc>] (tick_broadcast_on_off+0x190/0x1c0)
[<c00607fc>] (tick_broadcast_on_off+0x190/0x1c0) from [<c005f168>] (clockevents_notify+0x58/0x1ac)
[<c005f168>] (clockevents_notify+0x58/0x1ac) from [<c02b99dc>] (cpuidle_setup_broadcast_timer+0x20/0x24)
[<c02b99dc>] (cpuidle_setup_broadcast_timer+0x20/0x24) from [<c006cd04>] (generic_smp_call_function_single_interrupt+0)
[<c006cd04>] (generic_smp_call_function_single_interrupt+0xe0/0x130) from [<c00138c8>] (handle_IPI+0x88/0x118)
[<c00138c8>] (handle_IPI+0x88/0x118) from [<c0008504>] (gic_handle_irq+0x58/0x60)
[<c0008504>] (gic_handle_irq+0x58/0x60) from [<c0012644>] (__irq_svc+0x44/0x78)
Exception stack(0xef099fa0 to 0xef099fe8)
9fa0: 00000001 ef092100 00000000 ef092100 ef098000 00000015 c0399f2c c0579d74
9fc0: 0000406a 413fc090 00000000 00000000 00000000 ef099fe8 c00666ec c000f46c
9fe0: 20000113 ffffffff
[<c0012644>] (__irq_svc+0x44/0x78) from [<c000f46c>] (arch_cpu_idle+0x34/0x3c)
[<c000f46c>] (arch_cpu_idle+0x34/0x3c) from [<c0053980>] (cpu_startup_entry+0xa8/0x10c)
[<c0053980>] (cpu_startup_entry+0xa8/0x10c) from [<000085a4>] (0x85a4)

We are in an interrupt context (IPI) and we are calling clk_get_rate in the
set_mode function which in turn ends up by getting a mutex... Even if that
does not hang, it is a potential kernel deadlock.

It is not allowed to call clk_get_rate() from interrupt context. To
avoid such calls the timer input frequency is stored in the driver's
data struct which makes it accessible to the driver in any context.

[dlezcano] completed the changelog with the WARN trace and added a more
detailed description. Tested on zync zc702.

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2013-12-30 11:32:24 +01:00
..
acpi_pm.c treewide: Fix printks with 0x%# 2013-08-27 10:49:38 +02:00
arm_arch_timer.c clocksource: arch_timer: Do not register arch_sys_counter twice 2013-10-16 08:30:03 +02:00
arm_global_timer.c clocksource/arm_global_timer: Set FEAT_PERCPU flag 2013-10-02 11:33:46 +02:00
bcm2835_timer.c clocksource: bcm2835: Switch to sched_clock_register() 2013-07-30 11:24:51 -07:00
bcm_kona_timer.c ARM: DT: binding fixup to align with vendor-prefixes.txt (drivers) 2013-08-20 10:51:38 -07:00
cadence_ttc_timer.c clocksource: cadence_ttc: Fix mutex taken inside interrupt context 2013-12-30 11:32:24 +01:00
clksrc-dbx500-prcmu.c clocksource: dbx500-prcmu: Switch to sched_clock_register() 2013-07-30 11:24:52 -07:00
clksrc-of.c clocksource: clksrc-of: Do not drop unheld reference on device node 2013-12-10 19:41:27 +01:00
cs5535-clockevt.c clocksource: use clockevents_config_and_register() where possible 2013-01-14 10:12:42 -08:00
cyclone.c clocksource: cyclone: Add missing iounmap 2012-01-26 19:30:40 -08:00
dummy_timer.c clocksource+irqchip: delete __cpuinit usage from all related files 2013-07-14 19:36:57 -04:00
dw_apb_timer_of.c clocksource: dw_apb_timer_of: Fix support for dts binding "snps,dw-apb-timer" 2013-12-10 19:49:18 +01:00
dw_apb_timer.c Revert "dw_apb_timer_of.c: Remove parts that were picoxcell-specific" 2013-06-18 16:02:04 -07:00
em_sti.c clocksource: em_sti: convert to clk_prepare/unprepare 2013-10-22 22:36:24 +02:00
exynos_mct.c clocksource: exynos_mct: Set IRQ affinity when the CPU goes online 2013-09-26 02:30:15 +02:00
i8253.c time: Kill xtime_lock, replacing it with jiffies_lock 2012-11-13 14:08:23 -05:00
Kconfig clocksource: time-efm32: Select CLKSRC_MMIO 2013-12-10 19:41:26 +01:00
Makefile clocksource: Provide timekeeping for efm32 SoCs 2013-10-22 22:36:33 +02:00
metag_generic.c clocksource+irqchip: delete __cpuinit usage from all related files 2013-07-14 19:36:57 -04:00
mmio.c clocksource: add common mmio clocksource 2011-05-23 18:04:51 +01:00
moxart_timer.c ARM: clocksource: moxart: Add bitops.h include 2013-08-01 01:13:34 +02:00
mxs_timer.c clocksource: mxs_timer: Switch to sched_clock_register() 2013-07-30 11:24:52 -07:00
nomadik-mtu.c Merge remote-tracking branch 'tip/timers/core' into fordlezcano/3.13/sched-clock64-conversion 2013-09-26 12:05:54 -07:00
samsung_pwm_timer.c Merge remote-tracking branch 'tip/timers/core' into fordlezcano/3.13/sched-clock64-conversion 2013-09-26 12:05:54 -07:00
scx200_hrt.c clocksource: scx200_hrt: Fix the build 2012-02-22 13:25:16 +01:00
sh_cmt.c clocksource: sh_cmt: 32-bit control register support 2013-08-22 00:18:45 +02:00
sh_mtu2.c clocksource: sh_mtu2: Add clk_prepare/unprepare support 2013-11-20 21:55:22 +01:00
sh_tmu.c clocksource: sh_tmu: Add clk_prepare/unprepare support 2013-11-20 21:55:24 +01:00
sun4i_timer.c clocksource: sunxi: Stop timer from ticking before enabling interrupts 2013-12-10 19:41:28 +01:00
tcb_clksrc.c clocksource: tcb_clksrc: Remove IRQF_DISABLED 2013-10-03 16:28:40 +02:00
tegra20_timer.c clocksource: Put nodes passed to CLOCKSOURCE_OF_DECLARE callbacks centrally 2013-10-02 11:42:48 +02:00
time-armada-370-xp.c clocksource: armada-370-xp: Register sched_clock after the counter reset 2013-12-10 19:41:27 +01:00
time-efm32.c clocksource: Provide timekeeping for efm32 SoCs 2013-10-22 22:36:33 +02:00
time-orion.c clocksource: orion: Use linux/sched_clock.h 2013-07-17 20:28:00 -07:00
timer-marco.c Now that we have a generic arch hook for broadcast we can remove the local 2013-07-23 16:54:15 -07:00
timer-prima2.c clocksource: sirf: Switch to sched_clock_register() and use 64 bits 2013-07-30 11:24:55 -07:00
vf_pit_timer.c clocksource: vf_pit_timer: Switch to sched_clock_register() 2013-07-30 11:24:56 -07:00
vt8500_timer.c clocksource: Put nodes passed to CLOCKSOURCE_OF_DECLARE callbacks centrally 2013-10-02 11:42:48 +02:00
zevio-timer.c clocksource: Add TI-Nspire timer support 2013-06-06 17:23:13 +02:00