Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2994491imu; Mon, 19 Nov 2018 09:07:00 -0800 (PST) X-Google-Smtp-Source: AJdET5ePgJ/9KqLJ7R11tjTxRLYqu+YqrnQLT2+tJOkQzvUdecFMoBkp+06q/1pVcmWim8Qg3ToG X-Received: by 2002:a62:4b4b:: with SMTP id y72-v6mr23925785pfa.67.1542647220220; Mon, 19 Nov 2018 09:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542647220; cv=none; d=google.com; s=arc-20160816; b=AiyA2KIOrepROFkZPXi/y6ndE/vSAxl42ZYjOYkiTOAKuNhk3VDf4dc16YxijSXdSh kbzH+wSo4so4z6erYfnI4TBxFafxGLhGnp0VZm4/3ghurW8VQrP4SowcXEL5uY5EiSee LYjLwzidrt1hBVJpLC8UsNOnTlyNC4JwFqZ6AKuEDqdOw0nJf7V6mCnvXKCRU4AXvyk2 yxw7jGyW/GNhL0UQ1ORo5OC9VSarsltaLOcGuiqWS8vXpOTyZekfHjqn+Q5jZpyLDNV4 4+QqpjZjCyHGGqF+hB6qwR3I2lDAX69Fl+p1FTwk+HgVKG9iQD8sF2TB2tcQEB9wKi2W qJGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LyVixmCpAeScRUU8dFp1lN/pj1d4FL/FmdrnyRY/CYo=; b=gpqPAn1H2Ne2/QlV5dC5IUKt0ePyoPTE1Emk0CJMzuS+4es5fJHWwKwM+7LLBq++j4 CO/aKamqeVq2Vaiys96NRwCWww4scQhBjrd9uIQ7gZPrTRgqcyiSVpqoQuOg09RCoFFE q7hhYnKvWXBeF97nqDfCL2v6by/HV6hpL93izgB6A4Phw8qczsDMxyEJQWdhHhOHzwuT 7pyGQcOuqcMIxBxY6fxqpxuCJNVvCID4L73LvSSQfG/iD3BIjpNTuM9WTkbJm+WG9/1a CaUbuiZfhlFTdNdIWsOHsOtizLK1vs5nnVy8YyzicJRWfdjHFmTckIh32tuY1T8X9A0l Qwrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="yBZo/3rU"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10-v6si5065737pfk.264.2018.11.19.09.06.44; Mon, 19 Nov 2018 09:07:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="yBZo/3rU"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406797AbeKTD3h (ORCPT + 99 others); Mon, 19 Nov 2018 22:29:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:44312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406762AbeKTD3g (ORCPT ); Mon, 19 Nov 2018 22:29:36 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1B85A214E0; Mon, 19 Nov 2018 17:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542647118; bh=638qOnybY1UKPk/hy9bB2E8t2m+KDkI6JiL5S5bTcS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yBZo/3rUvmpG4DpUImEJQV/Ko3h3ew0kbksp56Wkgz2f+jFlL5PaONz79sLcrypvP bogf0d8zvH8dlPQqfv7faYJ2v0crv8sbx3d+N0/WZQPI+UJpWsusLHtNHzF2zf+8vv TaR4ZR7YJOsR9rV3Fp67/DHF9YhH9NQPCnw2eWMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomi Valkeinen , Peter Ujfalusi , Sasha Levin Subject: [PATCH 3.18 56/90] drm/omap: fix memory barrier bug in DMM driver Date: Mon, 19 Nov 2018 17:29:38 +0100 Message-Id: <20181119162629.865777847@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162620.585061184@linuxfoundation.org> References: <20181119162620.585061184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tomi Valkeinen [ Upstream commit 538f66ba204944470a653a4cccc5f8befdf97c22 ] A DMM timeout "timed out waiting for done" has been observed on DRA7 devices. The timeout happens rarely, and only when the system is under heavy load. Debugging showed that the timeout can be made to happen much more frequently by optimizing the DMM driver, so that there's almost no code between writing the last DMM descriptors to RAM, and writing to DMM register which starts the DMM transaction. The current theory is that a wmb() does not properly ensure that the data written to RAM is observable by all the components in the system. This DMM timeout has caused interesting (and rare) bugs as the error handling was not functioning properly (the error handling has been fixed in previous commits): * If a DMM timeout happened when a GEM buffer was being pinned for display on the screen, a timeout error would be shown, but the driver would continue programming DSS HW with broken buffer, leading to SYNCLOST floods and possible crashes. * If a DMM timeout happened when other user (say, video decoder) was pinning a GEM buffer, a timeout would be shown but if the user handled the error properly, no other issues followed. * If a DMM timeout happened when a GEM buffer was being released, the driver does not even notice the error, leading to crashes or hang later. This patch adds wmb() and readl() calls after the last bit is written to RAM, which should ensure that the execution proceeds only after the data is actually in RAM, and thus observable by DMM. The read-back should not be needed. Further study is required to understand if DMM is somehow special case and read-back is ok, or if DRA7's memory barriers do not work correctly. Signed-off-by: Tomi Valkeinen Signed-off-by: Peter Ujfalusi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -256,6 +256,17 @@ static int dmm_txn_commit(struct dmm_txn } txn->last_pat->next_pa = 0; + /* ensure that the written descriptors are visible to DMM */ + wmb(); + + /* + * NOTE: the wmb() above should be enough, but there seems to be a bug + * in OMAP's memory barrier implementation, which in some rare cases may + * cause the writes not to be observable after wmb(). + */ + + /* read back to ensure the data is in RAM */ + readl(&txn->last_pat->next_pa); /* write to PAT_DESCR to clear out any pending transaction */ writel(0x0, dmm->base + reg[PAT_DESCR][engine->id]);