On 24 Jun 2015, at 10:51, Paul Goyette <[email protected]> wrote:

<snip>
> 
> There is a rather "interesting" mutex-dance in sme_check_events() about
> which I need to think:
> 
>       mutex_enter(wq_mutex)
>       check for empty wq
>       mutex_exit(wq_mutex)
> 
>       mutex_enter(global_sysmon_mutex)
>       mutex_enter(wq_mutex)
>       queue up the wq entries
>       mutex_exit(wq_mutex)
>       check for low_power condition
>       mutex_exit(global_sysmon_mutex)
> 
> I'm pretty sure this can be reduced a bit:
> 
>       mutex_enter(global_sysmon_mutex)
>       mutex_enter(wq_mutex)
>       check for empty wq
> 
>       queue up the wq entries
>       mutex_exit(wq_mutex)
>       check for low_poer condition
>       mutex_exit(global_sysmon_mutex)

It can't, see rev. 1.114:

Add a counter of busy events and stop enqueueing more work if a device is busy.
Protect this counter with a new short time lock "sme_work_mtx" and
keep "sme_mtx" as long time lock.

Removes a deadlock where an active event holds "sme_mtx", the callout
"sme_events_check" blocks on "sme_mtx" and callout processing stops.

--
J. Hannken-Illjes - [email protected] - TU Braunschweig (Germany)

Reply via email to