[SNIP]
Ah, so the ttm_ctx I've spotted was something entirely different and
doesn't contain the ww_acquire_ctx (I didn't check)? I'd assume you have
the same ctx passed around to everything in ttm, but if that doesn't exist
then we can indeed not annotate ww_mutex_trylock_ctx with the right ctx.
[SNIP]Oh I'm not worried about the runtime overhead at all, I'm worried about
But to me it actually looks more like that makes it unnecessary complicated.
The use case in amdgpu which could only check the context isn't performance
critical.
conceptual clarity of this stuff. If you have a ctx there's no need to
also look at ->owner.
Another idea: We drop the task argument from functions and go with the
following logic:
ww_mutex_is_owner(lock, ctx)
{
if (ctx)
return lock->ctx == ctx;
else
return lock->owner == current;
}
I think that would solve your use case, and gives us the neat interface
I'm aiming for. Kerneldoc can then explain what's happening for a NULL
ctx.