From patchwork Tue Sep 20 08:51:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 76591 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1369860qgf; Tue, 20 Sep 2016 01:51:26 -0700 (PDT) X-Received: by 10.66.132.81 with SMTP id os17mr54218157pab.106.1474361486170; Tue, 20 Sep 2016 01:51:26 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si69193515pfb.46.2016.09.20.01.51.25; Tue, 20 Sep 2016 01:51:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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 linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753871AbcITIvY (ORCPT + 14 others); Tue, 20 Sep 2016 04:51:24 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:38409 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753699AbcITIvW (ORCPT ); Tue, 20 Sep 2016 04:51:22 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ODS00BRKOLHY050@mailout3.w1.samsung.com>; Tue, 20 Sep 2016 09:51:18 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20160920085117eucas1p2c7d7958d2136f9f971f407652ef799e7~1_-PFYDUG0635406354eucas1p2H; Tue, 20 Sep 2016 08:51:17 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 2C.48.02283.588F0E75; Tue, 20 Sep 2016 09:51:17 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20160920085116eucas1p173db6f4c36659584cc4c20a118b0671e~1_-Ocooap0973409734eucas1p1n; Tue, 20 Sep 2016 08:51:16 +0000 (GMT) X-AuditID: cbfec7f1-f79f46d0000008eb-94-57e0f88556e4 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D3.3D.10494.658F0E75; Tue, 20 Sep 2016 09:50:30 +0100 (BST) Received: from [106.116.147.30] by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ODS00GVWOLEI460@eusync2.samsung.com>; Tue, 20 Sep 2016 09:51:16 +0100 (BST) Subject: Re: [PATCH v3 0/2] Exynos IOMMU: proper runtime PM support (use device dependencies) To: Tobias Jakobi , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, "Rafael J. Wysocki" Cc: Joerg Roedel , Inki Dae , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Mark Brown , "Luis R. Rodriguez" , Greg Kroah-Hartman , Tomeu Vizoso , Lukas Wunner , Kevin Hilman From: Marek Szyprowski Message-id: Date: Tue, 20 Sep 2016 10:51:13 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-version: 1.0 In-reply-to: <57E05C68.80804@math.uni-bielefeld.de> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SW0wTQRSGM93udttQXRbUExCNTTSKouAljqAGAg+rPsiDsYmaaCMbQFvA FhT0BTHlqrVACIi3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Wtmi6ebHzNZXN41h83ic+8RRosZ5/cxWbx4 Lm1xY8JTRoszpy+xWrSt/sBq0bf2EpuDoMeTg/OYPHbcXcLosWlVJ5vH/rlr2D0m31jO6PHv GLvHlqvtLB59W1YxenzeJOcxo30bawBXlJtNRmpiSmqRQmpecn5KZl66rVJoiJuuhZJCXmJu qq1ShK5vSJCSQlliTimQZ2SABhycA9yDlfTtEtwytn36wFrwi79iS8d/9gbGCTxdjJwcEgIm Esuv/2aDsMUkLtxbD2RzcQgJLGGUWLHlAJTznFHi5plpzF2MHBzCAvES97aYgcRFBG4zSpya dx6q6BijxParZ5lAHGaBPcwSDYuugc1lEzCU6HrbBWbzCthJLF91mxHEZhFQldjX95QdZKqo QIzE+r4EiBJBiR+T77GA2JwCxhJ9Ux+AlTMLmEl8eXmYFcKWl9i85i3zBEaBWUhaZiEpm4Wk bAEj8ypGkdTS4tz03GIjveLE3OLSvHS95PzcTYzAaN927OeWHYxd74IPMQpwMCrx8AY8vB8u xJpYVlyZe4hRgoNZSYQ35/ODcCHelMTKqtSi/Pii0pzU4kOMpkA/TGSWEk3OByaivJJ4QxND c0tDI2MLC3MjIyVx3qkfroQLCaQnlqRmp6YWpBbB9DFxcEo1MAoJvzl1wPep0pSZk8VUXx5b unc2b0qhww0Nw8X/GIsZQh7YystGOc1w/LHj988txteDl1yebXJ58bpsvY/qT40nFkkaLvb5 2PnWtfK7Yus0tp3tLp5eX1/9Pyh5jCd80puT7BX7NmtWL9rCunvNnfjon9vYuaSqT5ovXflm yWEz1vn1HYpmyuFKLMUZiYZazEXFiQAb69mQDAMAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20160920085116eucas1p173db6f4c36659584cc4c20a118b0671e X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20160913124917eucas1p23425d2cb1c24e73ae3c2927ec141fd30 X-RootMTR: 20160913124917eucas1p23425d2cb1c24e73ae3c2927ec141fd30 References: <1473770941-8337-1-git-send-email-m.szyprowski@samsung.com> <57E05C68.80804@math.uni-bielefeld.de> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi All, On 2016-09-19 23:45, Tobias Jakobi wrote: > I did some tests with the new version today. Sadly the reboot/shutdown > issues are still present. Thanks for the report. I've managed to reproduce this issue and it is again caused by modifying device on devices_kset list before it will be finally added by device_add(). I thought that the new patchset allows creating links to a device, which has not been yet added to system device list. Rafael: What is your opinion? Should it be allowed to create a link to device, which has not yet been added to system device list by device_add()? My code used to do that, because IOMMUs are configured from of_platform_device_create_pdata() of_dma_configure() of_iommu_configure(), which happens before device_add(). To solve the reported corruption of devices_kset list, following change is needed: spin_unlock(&devices_kset->list_lock); } If you think that links can be created only to a device, which has been fully added to the system, I will register a bus notifier and create a link on consumers device probe then. [...] Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland -- To unsubscribe from this list: send the line "unsubscribe linux-pm" 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/base/core.c b/drivers/base/core.c index aa8196508db9..4542ba9f60d4 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1039,11 +1039,18 @@ static void devices_kset_move_after(struct device *deva, struct device *devb) */ void devices_kset_move_last(struct device *dev) { + struct device *d; + if (!devices_kset) return; pr_debug("devices_kset: Moving %s to end of list\n", dev_name(dev)); spin_lock(&devices_kset->list_lock); - list_move_tail(&dev->kobj.entry, &devices_kset->list); + list_for_each_entry(d, &devices_kset->list, kobj.entry) { + if (d == dev) { + list_move_tail(&dev->kobj.entry, &devices_kset->list); + break; + } + }