AnsweredAssumed Answered

Deadlock on i.MX6UL running NXP Linux kernel 4.1.15_2.0.1

Question asked by Felix Radensky on Jan 3, 2017
Latest reply on Feb 28, 2017 by Dave McMordie

Hello,

 

I'm experiencing a system freeze on Variscite i.MX6UL SOM running NXP kernel 4.1.15_2.0.1. The easiest way to reproduce the problem is to boot with init=/bin/bash kernel argument and leave the system idle for several minutes.  Enabling lockdep in the kernel reveals the following circular locking dependency in NXP run-time PM code:

 

[ INFO: possible circular locking dependency detected ]
4.1.15-224489-gfae15ad #11 Not tainted
-------------------------------------------------------
kworker/0:1/19 is trying to acquire lock:
 (bus_freq_mutex){+.+...}, at: [<80023eb8>] reduce_bus_freq_handler+0x18/0x28

 

but task is already holding lock:
 ((&(&low_bus_freq_handler)->work)){+.+...}, at: [<80040e84>] process_one_work+0xf4/0x44c

 

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

 

-> #1 ((&(&low_bus_freq_handler)->work)){+.+...}:
       [<80041cb8>] __cancel_work_timer+0x8c/0x1b4
       [<8002539c>] request_bus_freq+0xa4/0x148
       [<802c9808>] mxsfb_runtime_resume+0xc/0x14
       [<8032f64c>] __rpm_callback+0x2c/0x60
       [<8032f6a0>] rpm_callback+0x20/0x80
       [<803304f8>] rpm_resume+0x360/0x530
       [<8033072c>] __pm_runtime_resume+0x64/0x90
       [<802cb114>] mxsfb_probe+0x698/0x9e4
       [<8032a160>] platform_drv_probe+0x44/0xac
       [<803289fc>] driver_probe_device+0x174/0x2b0
       [<80328c10>] __driver_attach+0x94/0x98
       [<80326f1c>] bus_for_each_dev+0x68/0x9c
       [<8032815c>] bus_add_driver+0x148/0x1f0
       [<80329204>] driver_register+0x78/0xf8
       [<80009670>] do_one_initcall+0x8c/0x1d8
       [<80763d40>] kernel_init_freeable+0x124/0x1c4
       [<80563e3c>] kernel_init+0x8/0xe8
       [<8000f3f8>] ret_from_fork+0x14/0x3c

 

-> #0 (bus_freq_mutex){+.+...}:
       [<80568f0c>] mutex_lock_nested+0x68/0x408
       [<80023eb8>] reduce_bus_freq_handler+0x18/0x28
       [<80040ef4>] process_one_work+0x164/0x44c
       [<80041228>] worker_thread+0x4c/0x49c
       [<800469a0>] kthread+0xe8/0x100
       [<8000f3f8>] ret_from_fork+0x14/0x3c

 

other info that might help us debug this:

 

 Possible unsafe locking scenario:

 

       CPU0                    CPU1
       ----                    ----
  lock((&(&low_bus_freq_handler)->work));
                               lock(bus_freq_mutex);
                               lock((&(&low_bus_freq_handler)->work));
  lock(bus_freq_mutex);

 

 *** DEADLOCK ***

 

2 locks held by kworker/0:1/19:
 #0:  ("events"){.+.+.+}, at: [<80040e84>] process_one_work+0xf4/0x44c
 #1:  ((&(&low_bus_freq_handler)->work)){+.+...}, at: [<80040e84>] process_one_work+0xf4/0x44c

 

 

With CONFIG_PM disabled the problem is not reproducible. I can also reproduce the freeze on Variscite i.MX6Q SOM running the same kernel version.

 

I'd appreciate any feedback on solving the problem.

 

Felix.

Outcomes