From patchwork Thu Sep 14 12:01:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 112550 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp656930qgf; Thu, 14 Sep 2017 05:01:35 -0700 (PDT) X-Google-Smtp-Source: ADKCNb73YbRXoFGI/LbxCWu//b/ZaUmgJp7ELKKNZcidituMNk7oBFM7ZtTSbQt266fMIPjqMfkn X-Received: by 10.84.240.196 with SMTP id l4mr19103794plt.443.1505390495441; Thu, 14 Sep 2017 05:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505390495; cv=none; d=google.com; s=arc-20160816; b=Et2ynQv7qqCP4lMUFExM6LXlu7zb5ztTO1L+feXQQCGVwcRtm0NtSss4f0a8NZi1eX 0n+INIhUjD4iseisKB7kvuZMI/6BQOAwlosZ5Idn1N2A42V3fSLtV+j9l49yQS4zzIeq bIrX/dZK/8nsHHIedxleQVtXnBrgAa8FwevvIvUZWmAOwT5P/i4aaha2gPdbx2Ep/rF/ mCxHLXO+KGctShjudVhX555M+UWaJKexYUaiR7sZM03z/HF9DILbyAY2phlA3UTRWRo1 2alIIt5F4+6E+Ul4yroe8ojIhiGlXpcHTsHu/WQm6V+xujN9cRgHzpmh7TTtvjSQ1+wW zWcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=s6txELhFwdmV+KDfvXhe9VMjgRrzO2Ph3ddgMBo4XWw=; b=lai5e26RhEJqjEXJA5d0OL2K0+IGcJdjuwu9Dnp36v/GfWFtMIYUPowSPqLNHSz2EW bkcjgBkq319om7GFTt5Y10KvuOQHR1etH8QS2jw3DiRJcfpHRhOQnASgUsFoMLqvnpef jSfDhRie6VKVVjwcUNH+qIumwrOXn+4PQNMqujJLFsy8tgLdVZBkW0u2h5wwrYggI9cG sYZLaGiR6DBZX/Sy8weJYQv0PtYCIcyjAgmGNL5orsdSAdGVb1PFBX3/E1kUcG8jPEuq FY6fdaVUHPdthirxpBW0YcxAP9HDXgsOYAnAwxpFe3fvZ9Qp5K10Eqty7qzyW1nMdCWx eVVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si10931199pgr.364.2017.09.14.05.01.35; Thu, 14 Sep 2017 05:01:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751691AbdINMBd (ORCPT + 6 others); Thu, 14 Sep 2017 08:01:33 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:53501 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbdINMBc (ORCPT ); Thu, 14 Sep 2017 08:01:32 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170914120130euoutp02a2c70a604903d74631978c0290927614~kOKzDh50j1621216212euoutp02f; Thu, 14 Sep 2017 12:01:30 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170914120128eucas1p2a6b87912bf95bc1ea14828fcea5f8adb~kOKyAcReF2619726197eucas1p2v; Thu, 14 Sep 2017 12:01:28 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id FD.DF.12907.89F6AB95; Thu, 14 Sep 2017 13:01:28 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170914120128eucas1p1ef0aa82654554401950b1889a9809de7~kOKxWNn2t1667616676eucas1p1Y; Thu, 14 Sep 2017 12:01:28 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-35-59ba6f983a92 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 04.BB.18832.89F6AB95; Thu, 14 Sep 2017 13:01:28 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OW900LKEQPY7H20@eusync4.samsung.com>; Thu, 14 Sep 2017 13:01:28 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Gustavo Padovan , Daniel Vetter , stable@vger.kernel.org Subject: [PATCH 1/2] drm/exynos: Fix locking in the suspend/resume paths Date: Thu, 14 Sep 2017 14:01:00 +0200 Message-id: <1505390461-14211-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505390461-14211-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsWy7djPc7oz8ndFGqxu0rG4te4cq8XGGetZ LRY+vMtsceXrezaLVY9KLCbdn8Bi8eLeRRaL8+c3sFvMOL+PyWLtk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QwBJGiRcXfjNBOE1MEueeLQOr YhMwlOh62wVmiwi4STQdnskKUsQssJBZorHvAFhCWMBDYuqnyYwgNouAqsSh9bOYQGxeoPjZ k3dYIdbJSZw8NhnM5hTwlNi0YypQLwfQNg+JL3NCJjDyLmBkWMUoklpanJueW2yoV5yYW1ya l66XnJ+7iREYjtuO/dy8g/HSxuBDjAIcjEo8vA8sd0YKsSaWFVfmHmKU4GBWEuH9EbwrUog3 JbGyKrUoP76oNCe1+BCjNAeLkjhv757VkUIC6YklqdmpqQWpRTBZJg5OqQbGfvmvb3jerfKb Gu40q2xV79dl/0r+ct/7zmZkYeEpkmOotu7y11VrVyRZxtw/vdlJ42+M66T9Z6OY3y48vah/ 1u5Zzs9zFSxX3bI4v+Dsof2Ra/Z+Ws5YJHB5Y72zddWNnPeOi3nkrxlO5L39nPderZSiB9e7 OG6mSwu/5SxtrZno5q9d++bseiWW4oxEQy3mouJEAIV9HF5DAgAA X-CMS-MailID: 20170914120128eucas1p1ef0aa82654554401950b1889a9809de7 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-CMS-RootMailID: 20170914120128eucas1p1ef0aa82654554401950b1889a9809de7 X-RootMTR: 20170914120128eucas1p1ef0aa82654554401950b1889a9809de7 References: <1505390461-14211-1-git-send-email-m.szyprowski@samsung.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Commit 48a92916729b ("drm/exynos: use drm_for_each_connector_iter()") replaced unsafe drm_for_each_connector() with drm_for_each_connector_iter() and removed surrounding drm_modeset_lock calls. However, that lock was there not only to protect unsafe drm_for_each_connector(), but it was also required to be held by the dpms code which was called from the loop body. This patch restores those drm_modeset_lock calls to fix broken suspend and resume of Exynos DRM subsystem in v4.13 kernel. Fixes: 48a92916729b ("drm/exynos: use drm_for_each_connector_iter()") CC: stable@vger.kernel.org # v4.13 Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++++ 1 file changed, 4 insertions(+) -- 1.9.1 Acked-by: Krzysztof Kozlowski diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index b1f7299600f0..7f3cfc5dd320 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -174,6 +174,7 @@ static int exynos_drm_suspend(struct device *dev) if (pm_runtime_suspended(dev) || !drm_dev) return 0; + drm_modeset_lock_all(drm_dev); drm_connector_list_iter_begin(drm_dev, &conn_iter); drm_for_each_connector_iter(connector, &conn_iter) { int old_dpms = connector->dpms; @@ -185,6 +186,7 @@ static int exynos_drm_suspend(struct device *dev) connector->dpms = old_dpms; } drm_connector_list_iter_end(&conn_iter); + drm_modeset_unlock_all(drm_dev); return 0; } @@ -198,6 +200,7 @@ static int exynos_drm_resume(struct device *dev) if (pm_runtime_suspended(dev) || !drm_dev) return 0; + drm_modeset_lock_all(drm_dev); drm_connector_list_iter_begin(drm_dev, &conn_iter); drm_for_each_connector_iter(connector, &conn_iter) { if (connector->funcs->dpms) { @@ -208,6 +211,7 @@ static int exynos_drm_resume(struct device *dev) } } drm_connector_list_iter_end(&conn_iter); + drm_modeset_unlock_all(drm_dev); return 0; }