linux-stable/drivers/clk
Marek Szyprowski 6b4feaea25 clk: exynos: use irqsave version of spin_lock to avoid deadlock with irqs
It is allowed to enable/disable clocks from interrupts, so common Exynos
ARM clock management code for CPUfreq should use 'irqsave' version of
spin_lock calls to avoid potential deadlock caused by spin_lock recursion.
The same spin_lock is used by gate/mux clocks during enable/disable calls.

This deadlock, can be reproduced by enabling CPUfreq (ondemand or
userspace) and decoding video with s5p-mfc driver.

Relevant stack trace:
[ 5928.061534] BUG: spinlock recursion on CPU#0, bash/1252
[ 5928.061609]  lock: 0xee80454c, .magic: dead4ead, .owner: bash/1252, .owner_cpu: 0
[ 5928.068586] CPU: 0 PID: 1252 Comm: bash Tainted: G        W       4.4.0-rc4-00001-g447a7fd #678
[ 5928.077260] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[ 5928.083359] [<c00153dc>] (unwind_backtrace) from [<c00121b4>] (show_stack+0x10/0x14)
[ 5928.091072] [<c00121b4>] (show_stack) from [<c0213e28>] (dump_stack+0x68/0xb8)
[ 5928.098275] [<c0213e28>] (dump_stack) from [<c005c1ec>] (do_raw_spin_lock+0x184/0x1ac)
[ 5928.106177] [<c005c1ec>] (do_raw_spin_lock) from [<c05cfa98>] (_raw_spin_lock_irqsave+0x20/0x28)
[ 5928.114943] [<c05cfa98>] (_raw_spin_lock_irqsave) from [<c0468698>] (clk_gate_endisable+0x24/0x98)
[ 5928.123882] [<c0468698>] (clk_gate_endisable) from [<c0464d40>] (clk_core_disable+0x60/0x84)
[ 5928.132299] [<c0464d40>] (clk_core_disable) from [<c0465e00>] (clk_disable+0x24/0x30)
[ 5928.140117] [<c0465e00>] (clk_disable) from [<c03f3b80>] (s5p_mfc_handle_frame+0x254/0x860)
[ 5928.148445] [<c03f3b80>] (s5p_mfc_handle_frame) from [<c03f4b34>] (s5p_mfc_irq+0x890/0xa24)
[ 5928.156778] [<c03f4b34>] (s5p_mfc_irq) from [<c00627bc>] (handle_irq_event_percpu+0x50/0x14c)
[ 5928.165283] [<c00627bc>] (handle_irq_event_percpu) from [<c00628f0>] (handle_irq_event+0x38/0x5c)
[ 5928.174143] [<c00628f0>] (handle_irq_event) from [<c0065864>] (handle_fasteoi_irq+0xdc/0x1a4)
[ 5928.182645] [<c0065864>] (handle_fasteoi_irq) from [<c0062090>] (generic_handle_irq+0x18/0x28)
[ 5928.191236] [<c0062090>] (generic_handle_irq) from [<c00621a4>] (__handle_domain_irq+0x6c/0xdc)
[ 5928.199917] [<c00621a4>] (__handle_domain_irq) from [<c0009470>] (gic_handle_irq+0x4c/0x98)
[ 5928.208249] [<c0009470>] (gic_handle_irq) from [<c0012c54>] (__irq_svc+0x54/0x90)
[ 5928.215709] Exception stack(0xeddb5cb8 to 0xeddb5d00)
[ 5928.220745] 5ca0:                                                       ee80454c faddfadc
[ 5928.228906] 5cc0: 00000000 01000001 ee831ce0 f8114200 ee807c00 01130520 00000403 eddb5d84
[ 5928.237063] 5ce0: ee807c48 2faf0800 ee807c0c eddb5d08 c046b618 c046b634 20000053 ffffffff
[ 5928.245225] [<c0012c54>] (__irq_svc) from [<c046b634>] (exynos_cpuclk_notifier_cb+0x170/0x270)
[ 5928.253823] [<c046b634>] (exynos_cpuclk_notifier_cb) from [<c003cb58>] (notifier_call_chain+0x44/0x84)
[ 5928.263106] [<c003cb58>] (notifier_call_chain) from [<c003ccd4>] (__srcu_notifier_call_chain+0x6c/0x9c)
[ 5928.272480] [<c003ccd4>] (__srcu_notifier_call_chain) from [<c003cd1c>] (srcu_notifier_call_chain+0x18/0x20)
[ 5928.282288] [<c003cd1c>] (srcu_notifier_call_chain) from [<c0464ed0>] (__clk_notify+0x6c/0x74)
[ 5928.290881] [<c0464ed0>] (__clk_notify) from [<c0465388>] (clk_propagate_rate_change+0xa0/0xac)
[ 5928.299561] [<c0465388>] (clk_propagate_rate_change) from [<c0465378>] (clk_propagate_rate_change+0x90/0xac)
[ 5928.309370] [<c0465378>] (clk_propagate_rate_change) from [<c04666fc>] (clk_core_set_rate_nolock+0x64/0xa8)
[ 5928.319091] [<c04666fc>] (clk_core_set_rate_nolock) from [<c0466760>] (clk_set_rate+0x20/0x30)
[ 5928.327686] [<c0466760>] (clk_set_rate) from [<c0428c70>] (set_target+0xe8/0x23c)
[ 5928.335152] [<c0428c70>] (set_target) from [<c04244d0>] (__cpufreq_driver_target+0x184/0x29c)
[ 5928.343655] [<c04244d0>] (__cpufreq_driver_target) from [<c0427128>] (cpufreq_set+0x44/0x64)
[ 5928.352074] [<c0427128>] (cpufreq_set) from [<c0423948>] (store_scaling_setspeed+0x5c/0x74)
[ 5928.360407] [<c0423948>] (store_scaling_setspeed) from [<c04238d0>] (store+0x7c/0x98)
[ 5928.368221] [<c04238d0>] (store) from [<c0132540>] (sysfs_kf_write+0x44/0x48)
[ 5928.375338] [<c0132540>] (sysfs_kf_write) from [<c0131b9c>] (kernfs_fop_write+0xb8/0x1bc)
[ 5928.383496] [<c0131b9c>] (kernfs_fop_write) from [<c00d71f8>] (__vfs_write+0x2c/0xd4)
[ 5928.391308] [<c00d71f8>] (__vfs_write) from [<c00d7de8>] (vfs_write+0xa0/0x144)
[ 5928.398598] [<c00d7de8>] (vfs_write) from [<c00d8048>] (SyS_write+0x44/0x84)
[ 5928.405631] [<c00d8048>] (SyS_write) from [<c000f540>] (ret_fast_syscall+0x0/0x3c)

CC: stable@vger.kernel.org  # v4.2+
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2015-12-16 16:36:03 +01:00
..
at91 clk: at91: add generated clock driver 2015-10-01 12:48:11 -07:00
bcm Merge branch 'clk-iproc' into clk-next 2015-10-21 17:28:19 -07:00
berlin ARM: SoC driver updates for v4.4 2015-11-10 15:00:03 -08:00
h8300 h8300: unaligned divcr register support. 2015-11-08 22:44:37 +09:00
hisilicon clk: Remove unneeded semicolons 2015-09-17 11:15:14 -07:00
imx ARM: SoC fixes for 4.4-rc 2015-12-12 16:43:44 -08:00
ingenic clk: ingenic: Include clk.h 2015-07-20 11:11:36 -07:00
keystone clk: keystone: fix a trivial typo 2015-10-19 15:29:09 -07:00
mediatek clk: mediatek: Add USB clock support in MT8173 APMIXEDSYS 2015-10-01 12:06:00 +08:00
meson clk: meson8b: Properly include clk.h 2015-07-20 10:53:10 -07:00
mmp clk: mmp: add linux/clk.h includes 2015-11-25 14:06:16 -08:00
mvebu clk: mvebu: Use of_clk_get_parent_name() 2015-10-16 16:35:43 -07:00
mxs clk:mxs: Fix bug on frequency divider 2015-10-01 15:24:34 -07:00
nxp clk: lpc18xx-cgu: fix potential system hang when disabling unused clocks 2015-10-26 12:36:58 -07:00
pistachio clk: pistachio: correct critical clock list 2015-08-26 11:34:43 -07:00
pxa The clk framework changes for 4.3 are mostly updates to existing drivers 2015-08-31 17:26:48 -07:00
qcom clk: qcom: msm8960: Fix dsi1/2 halt bits 2015-10-27 13:10:13 -07:00
rockchip The majority of the changes are driver updates and new device 2015-11-05 12:59:36 -08:00
samsung clk: exynos: use irqsave version of spin_lock to avoid deadlock with irqs 2015-12-16 16:36:03 +01:00
shmobile ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
sirf clk: atlas7: fix noc/socket disconnect/reconnect for unit clks 2015-09-29 08:27:14 -07:00
socfpga clk: socfpga: Add a second parent option for the dbg_base_clk 2015-08-24 16:49:03 -07:00
spear The clk framework changes for 4.3 are mostly updates to existing drivers 2015-08-31 17:26:48 -07:00
st drivers: clk: st: Correct the pll-type for A9 for stih418 2015-10-08 23:52:59 -07:00
sunxi clk: sunxi: pll2: Fix clock running too fast 2015-12-02 23:27:47 -08:00
tegra clk: tegra: Changes for v4.4-rc1 2015-10-20 08:49:11 -07:00
ti clk: ti: drop locking code from mux/divider drivers 2015-11-24 11:30:27 +02:00
ux500 clk/ARM: move Ux500 PRCC bases to the device tree 2015-08-24 16:49:14 -07:00
versatile clk: versatile-icst: fix memory leak 2015-10-23 13:34:53 -07:00
x86
zte clk: zx: Constify parent names in clock init data 2015-07-28 11:59:39 -07:00
zynq ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
clk-asm9260.c
clk-axi-clkgen.c clk: axi-clkgen: Remove clk.h include 2015-07-20 10:52:50 -07:00
clk-axm5516.c
clk-cdce706.c clk: Convert __clk_get_flags() to clk_hw_get_flags() 2015-08-24 16:48:44 -07:00
clk-cdce925.c clk: cdce925: Include clk.h 2015-07-20 11:11:32 -07:00
clk-clps711x.c clk: clps711x: Remove clk.h include 2015-07-20 10:52:53 -07:00
clk-composite.c clk: Convert basic types to clk_hw based provider APIs 2015-08-24 16:48:48 -07:00
clk-conf.c
clk-devres.c
clk-divider.c clk: divider: handle integer overflow when dividing large clock rates 2015-09-16 15:22:33 -07:00
clk-efm32gg.c clk: efm32gg: Remove clk.h include 2015-07-20 10:52:54 -07:00
clk-fixed-factor.c clk: Convert basic types to clk_hw based provider APIs 2015-08-24 16:48:48 -07:00
clk-fixed-rate.c
clk-fractional-divider.c clk: fractional-divider: switch to rational best approximation 2015-10-02 11:29:48 -07:00
clk-gate.c clk: basic-type: Silence warnings about lock imbalances 2015-07-28 11:59:28 -07:00
clk-gpio.c clk: gpio: Get parent clk names in of_gpio_clk_setup() 2015-11-18 17:19:01 -08:00
clk-highbank.c clk: highbank: Include clk.h 2015-07-20 11:11:22 -07:00
clk-ls1x.c
clk-max-gen.c
clk-max-gen.h
clk-max77686.c drivers/clk: include <module.h> for clk-max77xxx modular code 2015-06-16 14:12:25 -04:00
clk-max77802.c clk: max77802: Update MODULE_AUTHOR() email address 2015-10-14 11:31:55 -07:00
clk-mb86s7x.c
clk-moxart.c clk: moxart: Include clk.h 2015-07-20 11:11:33 -07:00
clk-multiplier.c clk: Remove clk_{register,unregister}_multiplier() 2015-10-23 13:34:46 -07:00
clk-mux.c clk: Replace __clk_get_num_parents with clk_hw_get_num_parents() 2015-08-24 16:48:43 -07:00
clk-nomadik.c clk: nomadik: Remove clk.h and clkdev.h includes 2015-07-20 10:52:57 -07:00
clk-nspire.c
clk-palmas.c clk: palmas: Remove clkdev.h includes 2015-07-20 10:52:58 -07:00
clk-pwm.c
clk-qoriq.c clk: qoriq: fix memory leak 2015-11-30 13:00:54 -08:00
clk-rk808.c clk: rk808: Remove clk.h include 2015-07-20 10:53:00 -07:00
clk-s2mps11.c clk: s2mps11: Use kcalloc instead of kzalloc for array allocation 2015-07-28 11:59:32 -07:00
clk-scpi.c clk: scpi: add missing of_node_put 2015-11-30 16:29:15 -08:00
clk-si514.c Add driver for the si514 clock generator chip 2015-10-08 23:52:55 -07:00
clk-si570.c clk: si570: Include clk.h 2015-07-20 11:11:35 -07:00
clk-si5351.c clk: si5351: add missing of_node_put 2015-10-21 16:16:33 -07:00
clk-si5351.h
clk-stm32f4.c clk: stm32f4: Convert to clk_hw based provider APIs 2015-08-24 16:48:51 -07:00
clk-twl6040.c Merge branch 'cleanup-clk-h-includes' into clk-next 2015-07-28 11:59:09 -07:00
clk-u300.c clk: u300: Remove clk.h include 2015-07-20 10:53:04 -07:00
clk-vt8500.c
clk-wm831x.c clk: wm831x: Remove clk.h include 2015-07-20 10:53:05 -07:00
clk-xgene.c clk: xgene: Remove unused setup.h include 2015-10-16 12:06:58 -07:00
clk.c clk: Add clk_hw_is_enabled() for use by clk providers 2015-10-26 12:36:55 -07:00
clk.h
clkdev.c clkdev: fix clk_add_alias() with a NULL alias device name 2015-10-20 17:24:08 +01:00
Kconfig ARM: SoC driver updates for v4.4 2015-11-10 15:00:03 -08:00
Makefile ARM: SoC driver updates for v4.4 2015-11-10 15:00:03 -08:00