Message ID | 1461839104-29135-1-git-send-email-m.szyprowski@samsung.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1avj8R-00052r-O5; Thu, 28 Apr 2016 10:25:27 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-8) with esmtp id 1avj8P-0005ID-lv; Thu, 28 Apr 2016 12:25:27 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752149AbcD1KZV (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Thu, 28 Apr 2016 06:25:21 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:62946 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbcD1KZS (ORCPT <rfc822;linux-media@vger.kernel.org>); Thu, 28 Apr 2016 06:25:18 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O6C00A0VAA32R90@mailout4.w1.samsung.com>; Thu, 28 Apr 2016 11:25:15 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-ca-5721e50b1115 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 87.30.05254.B05E1275; Thu, 28 Apr 2016 11:25:15 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O6C002MPA9ZLM80@eusync4.samsung.com>; Thu, 28 Apr 2016 11:25:15 +0100 (BST) From: Marek Szyprowski <m.szyprowski@samsung.com> To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski <m.szyprowski@samsung.com>, Sylwester Nawrocki <s.nawrocki@samsung.com>, Jacek Anaszewski <j.anaszewski@samsung.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Krzysztof Kozlowski <k.kozlowski@samsung.com>, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Subject: [PATCH 1/2] media: exynos4-is: fix deadlock on driver probe Date: Thu, 28 Apr 2016 12:25:03 +0200 Message-id: <1461839104-29135-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKJMWRmVeSWpSXmKPExsVy+t/xa7rcTxXDDZpWCVtsnLGe1aL36nNG i9cvDC16NmxltZhxfh+Txdojd9ktDr9pZ7X4tOUbkwOHx7yTgR59W1YxenzeJBfAHMVlk5Ka k1mWWqRvl8CVcWjWLOaCAzwVj39vYmpgvMXVxcjJISFgInHt4jYmCFtM4sK99WxdjFwcQgJL GSXaH85lgnCamCQuf3nOAlLFJmAo0fW2iw3EFhFwklg46y87SBGzwFImiY3nvoONEhZwkdg4 pQ8owcHBIqAqcfFkBUiYV8BD4vTZHcwQ2+Qk/r9cwTSBkXsBI8MqRtHU0uSC4qT0XEO94sTc 4tK8dL3k/NxNjJDA+LKDcfExq0OMAhyMSjy8kxIUw4VYE8uKK3MPMUpwMCuJ8Jo/AQrxpiRW VqUW5ccXleakFh9ilOZgURLnnbvrfYiQQHpiSWp2ampBahFMlomDU6qBUULK8KaLTeQM1Vyz ac4ZrJ5/zv8r+7zxt9G1QCmHUzy710tffvL7YoVdQ/BUr/PXxY/FBFyaIhuwljvy1PGrvCwe J5/9XqlVb21998Cy+dqXDltfZ3PYsbsr0vvS6b++3nLt1TbhOxivJzAqycs0Gu2oVFMP6iqO 5grXltSQOZp5/0DeEa8nSizFGYmGWsxFxYkA+vqotwgCAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.4.28.101817 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1700_1799 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0' |
Commit Message
Marek Szyprowski
April 28, 2016, 10:25 a.m. UTC
Commit 0c426c472b5585ed6e59160359c979506d45ae49 ("[media] media: Always
keep a graph walk large enough around") changed
media_device_register_entity() function to take mdev->graph_mutex. This
causes deadlock in driver probe, which calls (indirectly) this function
with ->graph_mutex taken. This patch removes taking ->graph_mutex in
driver probe to avoid deadlock. Other drivers don't take ->graph_mutex
for entity registration, so this change should be safe.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/media/platform/exynos4-is/media-dev.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
Comments
Hi Marek, Marek Szyprowski wrote: > Commit 0c426c472b5585ed6e59160359c979506d45ae49 ("[media] media: Always > keep a graph walk large enough around") changed > media_device_register_entity() function to take mdev->graph_mutex. This > causes deadlock in driver probe, which calls (indirectly) this function > with ->graph_mutex taken. This patch removes taking ->graph_mutex in > driver probe to avoid deadlock. Other drivers don't take ->graph_mutex > for entity registration, so this change should be safe. > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> You could also add: Fixes: 0c426c472b55 ("[media] media: Always keep a graph walk large enough around") I guess these should go to fixes, the patches in question are already heading for v4.6. Cc Mauro.
On 04/28/2016 12:25 PM, Marek Szyprowski wrote: > Commit 0c426c472b5585ed6e59160359c979506d45ae49 ("[media] media: Always > keep a graph walk large enough around") changed > media_device_register_entity() function to take mdev->graph_mutex. This > causes deadlock in driver probe, which calls (indirectly) this function > with ->graph_mutex taken. This patch removes taking ->graph_mutex in > driver probe to avoid deadlock. Other drivers don't take ->graph_mutex > for entity registration, so this change should be safe. > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Tested-by: Hans Verkuil <hans.verkuil@cisco.com> Thanks! Hans > --- > drivers/media/platform/exynos4-is/media-dev.c | 13 ++----------- > 1 file changed, 2 insertions(+), 11 deletions(-) > > diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c > index 04348b502232..891625e77ef5 100644 > --- a/drivers/media/platform/exynos4-is/media-dev.c > +++ b/drivers/media/platform/exynos4-is/media-dev.c > @@ -1448,22 +1448,13 @@ static int fimc_md_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, fmd); > > - /* Protect the media graph while we're registering entities */ > - mutex_lock(&fmd->media_dev.graph_mutex); > - > ret = fimc_md_register_platform_entities(fmd, dev->of_node); > - if (ret) { > - mutex_unlock(&fmd->media_dev.graph_mutex); > + if (ret) > goto err_clk; > - } > > ret = fimc_md_register_sensor_entities(fmd); > - if (ret) { > - mutex_unlock(&fmd->media_dev.graph_mutex); > + if (ret) > goto err_m_ent; > - } > - > - mutex_unlock(&fmd->media_dev.graph_mutex); > > ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode); > if (ret) > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Em Mon, 2 May 2016 00:59:56 +0300 Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > Hi Marek, > > Marek Szyprowski wrote: > > Commit 0c426c472b5585ed6e59160359c979506d45ae49 ("[media] media: Always > > keep a graph walk large enough around") changed > > media_device_register_entity() function to take mdev->graph_mutex. This > > causes deadlock in driver probe, which calls (indirectly) this function > > with ->graph_mutex taken. This patch removes taking ->graph_mutex in > > driver probe to avoid deadlock. Other drivers don't take ->graph_mutex > > for entity registration, so this change should be safe. > > > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > You could also add: > > Fixes: 0c426c472b55 ("[media] media: Always keep a graph walk large > enough around") > > I guess these should go to fixes, the patches in question are already > heading for v4.6. Cc Mauro. The patches from Sakari for v4.6 were merged already at -rc6. Just merged them back at the master branch. Regards, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 05/02/16 12:52, Mauro Carvalho Chehab wrote: > Em Mon, 2 May 2016 00:59:56 +0300 > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > >> Hi Marek, >> >> Marek Szyprowski wrote: >>> Commit 0c426c472b5585ed6e59160359c979506d45ae49 ("[media] media: Always >>> keep a graph walk large enough around") changed >>> media_device_register_entity() function to take mdev->graph_mutex. This >>> causes deadlock in driver probe, which calls (indirectly) this function >>> with ->graph_mutex taken. This patch removes taking ->graph_mutex in >>> driver probe to avoid deadlock. Other drivers don't take ->graph_mutex >>> for entity registration, so this change should be safe. >>> >>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> >> >> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> >> >> You could also add: >> >> Fixes: 0c426c472b55 ("[media] media: Always keep a graph walk large >> enough around") >> >> I guess these should go to fixes, the patches in question are already >> heading for v4.6. Cc Mauro. > > The patches from Sakari for v4.6 were merged already at -rc6. Just merged > them back at the master branch. I'm confused. The two patches from Marek fixing driver probe deadlock are not in the master tree (just pulled from it, it's now rc6), so the deadlock still happens in kernel 4.6. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 04348b502232..891625e77ef5 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1448,22 +1448,13 @@ static int fimc_md_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fmd); - /* Protect the media graph while we're registering entities */ - mutex_lock(&fmd->media_dev.graph_mutex); - ret = fimc_md_register_platform_entities(fmd, dev->of_node); - if (ret) { - mutex_unlock(&fmd->media_dev.graph_mutex); + if (ret) goto err_clk; - } ret = fimc_md_register_sensor_entities(fmd); - if (ret) { - mutex_unlock(&fmd->media_dev.graph_mutex); + if (ret) goto err_m_ent; - } - - mutex_unlock(&fmd->media_dev.graph_mutex); ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode); if (ret)