amlogic: drm: meson_gem: Fix a deadlock issue
After enabled the lock debug config, the below message is displayed.
[ 20.897676@5] =============================================
[ 20.899234@5] [ INFO: possible recursive locking detected ]
[ 20.904782@5] 4.9.241-TIZEN-amlogic-kvim+ #6 Not tainted
[ 20.910067@5] ---------------------------------------------
[ 20.915614@5] enlightenment/579 is trying to acquire lock:
[ 20.921074@5] (&dev->struct_mutex){+.+...}, at: [<
ffffff80096db7d8>] drm_gem_object_unreference_unlocked+0x20/0x140
[ 20.931561@5]
[ 20.931561@5] but task is already holding lock:
[ 20.937714@5] (&dev->struct_mutex){+.+...}, at: [<
ffffff8009c8a744>] am_meson_gem_cpu_fini_ioctl+0x34/0xe8
[ 20.947421@5]
[ 20.947421@5] other info that might help us debug this:
[ 20.954267@5] Possible unsafe locking scenario:
[ 20.954267@5]
[ 20.960507@5] CPU0
[ 20.963107@5] ----
[ 20.965707@5] lock(&dev->struct_mutex);
[ 20.969693@5] lock(&dev->struct_mutex);
[ 20.973680@5]
[ 20.973680@5] *** DEADLOCK ***
[ 20.973680@5]
[ 20.980094@5] May be due to missing lock nesting notation
[ 20.980094@5]
[ 20.987201@5] 1 lock held by enlightenment/579:
[ 20.991707@5] #0: (&dev->struct_mutex){+.+...}, at: [<
ffffff8009c8a744>] am_meson_gem_cpu_fini_ioctl+0x34/0xe8
[ 21.001847@5]
[ 21.001847@5] stack backtrace:
[ 21.006529@5] CPU: 5 PID: 579 Comm: enlightenment Not tainted 4.9.241-TIZEN-amlogic-kvim+ #6
[ 21.014934@5] Hardware name: Khadas VIM3 (DT)
[ 21.019268@5] Call trace:
[ 21.021871@5] [<
ffffff800908b9e8>] dump_backtrace+0x0/0x268
[ 21.027415@5] [<
ffffff800908bc78>] show_stack+0x28/0x38
[ 21.032616@5] [<
ffffff80095b46d4>] dump_stack+0xe0/0x12c
[ 21.037903@5] [<
ffffff8009122df4>] __lock_acquire+0x1064/0x1b28
[ 21.043795@5] [<
ffffff8009123e80>] lock_acquire+0xe8/0x288
[ 21.049255@5] [<
ffffff80096db808>] drm_gem_object_unreference_unlocked+0x50/0x140
[ 21.056709@5] [<
ffffff8009c8a7b8>] am_meson_gem_cpu_fini_ioctl+0xa8/0xe8
[ 21.063382@5] [<
ffffff80096dcbe4>] drm_ioctl+0x204/0x4a8
[ 21.068670@5] [<
ffffff80092a1a74>] do_vfs_ioctl+0x674/0x8e0
[ 21.074215@5] [<
ffffff80092a1d74>] SyS_ioctl+0x94/0xa8
[ 21.079328@5] [<
ffffff8009083a1c>] __sys_trace_return+0x0/0x4
[ 21.166643@2] input: Virtual Key Device as /devices/virtual/input/input6
Change-Id: Iadb1df81b88b288f2d6841520ce55c2ee47cedef
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>