Re: [RFC][PATCH -v2 1/4] locking/drm/i915: Kill mutex trickery

From: Waiman Long
Date: Thu Aug 25 2016 - 16:17:36 EST

On 08/25/2016 03:36 PM, Daniel Vetter wrote:
On Thu, Aug 25, 2016 at 8:37 PM, Peter Zijlstra<peterz@xxxxxxxxxxxxx> wrote:
Poking at lock internals is not cool. Since I'm going to change the
implementation this will break, take it out.

Cc: Chris Wilson<chris@xxxxxxxxxxxxxxxxxx>
Cc: Daniel Vetter<daniel.vetter@xxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel)<peterz@xxxxxxxxxxxxx>
It's horrible, but we die without this in spurious oom. And we haven't
made much progress in recent years to throw out the locking scheme and
replace it by something else that doesn't need a recursive mutex.

But initerim I guess we could set our own owner field and check that
to keep the duct-tape from getting off completely.

Another alternative is to provide a standard mutex API that returns the owner of the lock if there is a real need for this capability. Peeking into lock internal is not a good practice.