Re: RFC on fixing mutex spinning on owner

From: Steven Rostedt
Date: Wed Mar 16 2016 - 22:18:17 EST


On Wed, 16 Mar 2016 16:38:56 -0700
Joel Fernandes <agnel.joel@xxxxxxxxx> wrote:

> I am not sure if the problem is with the i915 driver, because the
> mutex spin on owner stuff is mutex related so the mutex design may
> potentially need a tweak (I mentioned a proposal of adding mutex
> spinning time outs).
> Also since this is latency issue related (I mentioned preemptoff
> tracer and preempt disabled), I sent it to linux-rt-users. Thanks for
> the tip about sending it to i915 developers, incase no one here has a
> say in the matter, I can drop them a note later as well.

Actually, the preempt off section here is not really an issue:

rcu_read_lock();
while (owner_running(lock, owner)) {
if (need_resched())
break;

cpu_relax_lowlatency();
}
rcu_read_unlock();

Although preemption may be disabled, that "need_resched()" check will
break out of the loop if a higher priority task were to want to run on
this CPU.

I probably should add a hook there to let the preemptoff tracer know
that this is not an issue.

Thanks for the report.

-- Steve