Re: [PATCH 2/2] drm/i915: Use rcu instead of stop_machine in set_wedged

From: Thomas Gleixner
Date: Fri Oct 06 2017 - 06:12:50 EST

On Fri, 6 Oct 2017, Chris Wilson wrote:
> Quoting Daniel Vetter (2017-10-06 10:06:37)
> > stop_machine is not really a locking primitive we should use, except
> > when the hw folks tell us the hw is broken and that's the only way to
> > work around it.
> >
> > This patch tries to address the locking abuse of stop_machine() from
> >
> > commit 20e4933c478a1ca694b38fa4ac44d99e659941f5
> > Author: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Date: Tue Nov 22 14:41:21 2016 +0000
> >
> > drm/i915: Stop the machine as we install the wedged submit_request handler
> >
> > Chris said parts of the reasons for going with stop_machine() was that
> > it's no overhead for the fast-path. But these callbacks use irqsave
> > spinlocks and do a bunch of MMIO, and rcu_read_lock is _real_ fast.
> I still want a discussion of the reason why keeping the normal path clean
> and why an alternative is sought, here. That design leads into vv

stop_machine() is the least resort when serialization problems cannot be
solved otherwise. We try to avoid it where ever we can. While on the call
site it looks simple, it's invasive in terms of locking as shown by the
lockdep splat and it's imposing latencies and other side effects on all
CPUs in the system. So if you don't have a compelling technical reason to
use it, then it _is_ the wrong tool.

As Daniel has shown it's not required, so there is no technical reason why
stomp_machine() has to be used here.