Re: [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Maarten Lankhorst
Op 26-05-16 om 12:43 schreef Chris Wilson: > On Thu, May 26, 2016 at 12:37:30PM +0200, Maarten Lankhorst wrote: >> The check should also not be for NULL, but for use_ww_ctx. >> This way the if check is optimized out for the ww_ctx path, where >> ww_ctx is always non-null. > The compiler can see

Re: [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Maarten Lankhorst
Op 26-05-16 om 12:43 schreef Chris Wilson: > On Thu, May 26, 2016 at 12:37:30PM +0200, Maarten Lankhorst wrote: >> The check should also not be for NULL, but for use_ww_ctx. >> This way the if check is optimized out for the ww_ctx path, where >> ww_ctx is always non-null. > The compiler can see

Re: [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Chris Wilson
On Thu, May 26, 2016 at 12:37:30PM +0200, Maarten Lankhorst wrote: > The check should also not be for NULL, but for use_ww_ctx. > This way the if check is optimized out for the ww_ctx path, where > ww_ctx is always non-null. The compiler can see use_ww_ctx == false => ww_ctx == NULL just as well

Re: [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Chris Wilson
On Thu, May 26, 2016 at 12:37:30PM +0200, Maarten Lankhorst wrote: > The check should also not be for NULL, but for use_ww_ctx. > This way the if check is optimized out for the ww_ctx path, where > ww_ctx is always non-null. The compiler can see use_ww_ctx == false => ww_ctx == NULL just as well

Re: [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Maarten Lankhorst
Op 26-05-16 om 10:31 schreef Chris Wilson: > The ww_mutex has the property of allowing the lock to detect and report > when it may be used in deadlocking scenarios (to allow the caller to > unwind its locks and avoid the deadlock). This detection needs to be > performed before we queue up for the

Re: [PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Maarten Lankhorst
Op 26-05-16 om 10:31 schreef Chris Wilson: > The ww_mutex has the property of allowing the lock to detect and report > when it may be used in deadlocking scenarios (to allow the caller to > unwind its locks and avoid the deadlock). This detection needs to be > performed before we queue up for the

[PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Chris Wilson
The ww_mutex has the property of allowing the lock to detect and report when it may be used in deadlocking scenarios (to allow the caller to unwind its locks and avoid the deadlock). This detection needs to be performed before we queue up for the spin, otherwise we wait on the osq_lock() for our

[PATCH] mutex: Do not spin/queue before performing ww_mutex deadlock avoidance

2016-05-26 Thread Chris Wilson
The ww_mutex has the property of allowing the lock to detect and report when it may be used in deadlocking scenarios (to allow the caller to unwind its locks and avoid the deadlock). This detection needs to be performed before we queue up for the spin, otherwise we wait on the osq_lock() for our