From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751694AbdJFKMq (ORCPT ); Fri, 6 Oct 2017 06:12:46 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:37847 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750915AbdJFKMp (ORCPT ); Fri, 6 Oct 2017 06:12:45 -0400 Date: Fri, 6 Oct 2017 12:12:41 +0200 (CEST) From: Thomas Gleixner To: Chris Wilson cc: Daniel Vetter , Intel Graphics Development , LKML , Mika Kuoppala , Marta Lofstedt , Daniel Vetter , Peter Zijlstra Subject: Re: [PATCH 2/2] drm/i915: Use rcu instead of stop_machine in set_wedged In-Reply-To: <150728147814.14660.6817347768155085898@mail.alporthouse.com> Message-ID: References: <20171006090637.25545-1-daniel.vetter@ffwll.ch> <20171006090637.25545-2-daniel.vetter@ffwll.ch> <150728147814.14660.6817347768155085898@mail.alporthouse.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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. Thanks, tglx