Kernel warning dump by enable kernel config "CONFIG_DEBUG_MUTEXES":
------------[ cut here ]------------
WARNING: at kernel/mutex.c:577 mutex_trylock+0x180/0x1d0()
DEBUG_LOCKS_WARN_ON(in_interrupt())
Modules linked in:
CPU: 0 PID: 68 Comm: kworker/0:2 Tainted: G W
3.10.17-16855-ga44de14 #1325
Workqueue: events phy_state_machine
[<
80014cbc>] (unwind_backtrace+0x0/0x138) from [<
8001251c>]
(show_stack+0x10/0x14)
[<
8001251c>] (show_stack+0x10/0x14) from [<
80026754>]
(warn_slowpath_common+0x4c/0x68)
[<
80026754>] (warn_slowpath_common+0x4c/0x68) from [<
80026804>]
(warn_slowpath_fmt+0x30/0x40)
[<
80026804>] (warn_slowpath_fmt+0x30/0x40) from [<
8069f6b0>]
(mutex_trylock+0x180/0x1d0)
[<
8069f6b0>] (mutex_trylock+0x180/0x1d0) from [<
804dce7c>]
(clk_prepare_lock+0xc/0xd8)
[<
804dce7c>] (clk_prepare_lock+0xc/0xd8) from [<
804ddbcc>]
(clk_get_rate+0xc/0x5c)
[<
804ddbcc>] (clk_get_rate+0xc/0x5c) from [<
803b7528>]
(fec_ptp_start_cyclecounter+0x1c/0x198)
[<
803b7528>] (fec_ptp_start_cyclecounter+0x1c/0x198) from [<
803b5928>]
(fec_restart+0x6e8/0x870)
[<
803b5928>] (fec_restart+0x6e8/0x870) from [<
803b5d50>]
(fec_enet_adjust_link+0x7c/0xb4)
[<
803b5d50>] (fec_enet_adjust_link+0x7c/0xb4) from [<
803b07b8>]
(phy_state_machine+0xfc/0x394)
[<
803b07b8>] (phy_state_machine+0xfc/0x394) from [<
8003f03c>]
(process_one_work+0x198/0x428)
[<
8003f03c>] (process_one_work+0x198/0x428) from [<
8003fd24>]
(worker_thread+0x144/0x3a4)
[<
8003fd24>] (worker_thread+0x144/0x3a4) from [<
800458d8>]
(kthread+0xa4/0xb0)
[<
800458d8>] (kthread+0xa4/0xb0) from [<
8000ebd8>] (ret_from_fork+0x14/0x3c)
---[ end trace
d1930b3e1c195329 ]---
Root cause:
Worker thread call netif_tx_lock_bh() to diable the softirq preempt, and
then call clk_get_rate() to get ptp clock rate.
In fact, netif_tx_lock_bh()->local_bh_disable(), which make in_interrupt()
to be ture. clk_get_rate()->clk_prepare_lock()->mutex_trylock(), and
mutex_trylock() cannot use at interrupt context, otherwise there have
kernel dump.
So, remove the clk_get_rate() in there.
Signed-off-by: Fugang Duan <B38611@freescale.com>