Re: [PATCH] device probe: add self triggered delayed work request

From: Qing Huang
Date: Mon Aug 08 2016 - 20:08:35 EST




On 08/08/2016 03:42 AM, Shamir Rabinovitch wrote:
Hi Qing,

I suspect there is potential dead-lock with this patch:

cpu0 cpu1

driver_deferred_probe_add deferred_probe_work_func
... mutex_unlock(&deferred_probe_mutex)
mutex_lock(&deferred_probe_mutex) bus_probe_device(dev)
... device return -EPROBE_DEFER
... driver_deferred_probe_add
... mutex_lock(&deferred_probe_mutex)
... <deadlock!>
cancel_delayed_work(&deferred_probe_trigger_work)
<work will never end - deadlock!>
Not sure if I understood your scenario. Why there is a deadlock here?


Please confirm if this scenario is possible.

BR, Shamir Rabinovitch