On Thu, May 23, 2013 at 11:13 AM, Maarten Lankhorst maarten.lankhorst@canonical.com wrote:
- Do you really want to drop the *_slow variants?
Doing so might reduce debugging slightly. I like method #2 in ww-mutex-design.txt, it makes it very clear why you would handle the *_slow case differently anyway.
As you pointed out, we wouldn't lose much debugging information. The same checks could be done in the normal variant with WARN_ON(ctx->lock && ctx->lock != lock); WARN_ON(ctx->lock && ctx->acquired > 0);
s/lock/contending_lock/ I guess. But yeah, I should have more carefully read Peter's suggestion to fold in some of the ww_slow debug checks, we can indeed keep the important debug checks even when dropping slow. Silly me should be less sloppy.
But it boils down to ww_mutex_lock_slow returning void instead of int __must_check from ww_mutex_lock.
Maybe add inlines for *_slow, that use the ww_mutex_lock functions, and check ctx->lock == lock in debugging mode?
So either we keep the _slow versions or drop the __must_check for ww_mutex_lock. In both cases the ww mutex user needs to think a bit what to do, and I don't there's much we can do in the implementation (beside all the existing debug support we have) to help. So now I'm leaning more towards dropping the _slow variants to avoid interface proliferation. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch