From patchwork Wed Feb 21 10:15:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 129007 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp451170ljc; Wed, 21 Feb 2018 02:15:40 -0800 (PST) X-Google-Smtp-Source: AH8x224Z3Woxqf5QS+xmceMrt0JH7unEmE6l0ogkUWRyadiwtTPqLZJe8G0AkbOJUbcFuSeNJ4A4 X-Received: by 2002:a17:902:26:: with SMTP id 35-v6mr2710322pla.42.1519208140605; Wed, 21 Feb 2018 02:15:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519208140; cv=none; d=google.com; s=arc-20160816; b=vOTSYLDgL1RmxQI6VT0EKnjzBQ87cT8D/EdJ8Dj5gv7A28tDGIBlXtIhwtF0QXtEFa iKXqjE/nWhW/EuwjGVx8LOSY2uB5fQmBNBv6ydCF18U/vyRbpIXPXYbe3xxw2aqSLZfg gNSFG+Ma3ufr7wx8TrQyVME254E77XQbyamialdmoKbvJzwlvFZS0VSCdwCS6RhH4hw/ RAiMZIbKjO4C3LPr3XxIZ9ejNzeFIFBJgdZuofMZXp9NNIeCdGSeA1uPK4+zgrD1SmaR zBcROIda6Z+41dZ5P6Y0GHuQ+nERsl1mrW/1xLBB57x7lEs72EYlCGhyqa5/gKKSfcq4 08hg== 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:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=geHZnJ4YC6A5CuAfRT8s8IzbVHVpWu3hzNxbrD2aYsU=; b=bzCal2eupFyA6iR7bMVGXP7Mz6aKaWwnoMWNPeb0gU5XGQ0Im7oLb0/WUrYAHORIWk ritx89HSptc8YqY7sD2BfOlijZf/SkcX3GycByz0TiH25t6tye7SHsuQtsWPINTCp3F0 5NxtDuk/pAA7SKTU1VlI7w5a0vNJh+K93QtbOpQd1WdJtLty215QiQyzLzP3BbxussrW ghWhbyXQ9eMO+R60eEtZaS17E8rtF/BOAnKAnaWRTCqjMNLbXpG5BkisK5WYRAFcOTvh 8IiiN/l3aZ65oAA49x8a7XIxyqhys5TRs25LropJNonvij22mZbA0R4K03UeBstKo9s0 BcpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=F34DNagy; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-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 63-v6si1311154pla.526.2018.02.21.02.15.40; Wed, 21 Feb 2018 02:15:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=F34DNagy; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-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 S932748AbeBUKPj (ORCPT + 3 others); Wed, 21 Feb 2018 05:15:39 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:51312 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932631AbeBUKPh (ORCPT ); Wed, 21 Feb 2018 05:15:37 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180221101535euoutp01ea06a3ba0ada6bd1d7d6e7be691b6e21~VT8AHRvhl3072830728euoutp01k; Wed, 21 Feb 2018 10:15:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180221101535euoutp01ea06a3ba0ada6bd1d7d6e7be691b6e21~VT8AHRvhl3072830728euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1519208135; bh=13ZCF1j6+b+Tj/IRwT76F/jokHFOJvDhgbV9cc+LKso=; h=From:To:Cc:Subject:Date:References:From; b=F34DNagyM9f43M5iiUKlSCFxS1Jc6voShCQVX76IPfPQz/8u/O5TXGlLG4kkIbBBb 4UAmWegfYsA5nDWPf2lGV5Q9uTBnEQ3BYxU8LpjrjmR8diCjSnuHhRfvX7wLlfpfIH 3N5WUkf/eZRNFpbqfC0JJh/7GEZwIlTe4UhS5CUM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180221101533eucas1p2d8a5c18ac6d0af5f1d01d79b0a00b043~VT7_cbMvr1443214432eucas1p21; Wed, 21 Feb 2018 10:15:33 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id CB.81.17380.5C64D8A5; Wed, 21 Feb 2018 10:15:33 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180221101532eucas1p24200cb65dba8209cd99dba5427c9a28d~VT79k9SDM2789827898eucas1p2O; Wed, 21 Feb 2018 10:15:32 +0000 (GMT) X-AuditID: cbfec7f4-713ff700000043e4-11-5a8d46c50ef7 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 3D.E2.04178.4C64D8A5; Wed, 21 Feb 2018 10:15:32 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P4H005K9WHT4SB0@eusync3.samsung.com>; Wed, 21 Feb 2018 10:15:32 +0000 (GMT) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Inki Dae , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 0/6] Exynos5: cleanup clocks handling in power domains Date: Wed, 21 Feb 2018 11:15:21 +0100 Message-id: <20180221101527.25554-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.15.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsWy7djP87pH3XqjDI4fE7XYOGM9q8X1L89Z LSbdn8Bicf78BnaLjz33WC1mnN/HZLH2yF12i8Nv2lkdODw2repk8+jbsorR4/MmuQDmKC6b lNSczLLUIn27BK6MOY/PsBa02VbsO3ibpYGxw6CLkZNDQsBE4uChxawgtpDACkaJeXckuxi5 gOzPjBLbJ1xlhyk6ffQSE0TRMkaJuXOYIewGJomeZfEgNpuAoUTX2y42EFtEwEHi86fXjCCD mAXamCTOHtgP1iws4Cbxd1UTI4jNIqAqseTpNrAFvAK2Evc3fmSEWCYvsfj7TjaQZgmBp6wS R581QF3hIvHtSycThC0s8er4Fqi4jERnx0EmiIZ+Rol//19COTMYJdZ/bIWqspY4fPwi2KPM AnwSk7ZNB/qBAyjOK9HRJgRR4iFx4u9aFgjbUeJLey80XGIlrn39zDyBUXIBI8MqRvHU0uLc 9NRio7zUcr3ixNzi0rx0veT83E2MwKg7/e/4lx2Mu/4kHWIU4GBU4uF9YdATJcSaWFZcmXuI UYKDWUmEt1KoN0qINyWxsiq1KD++qDQntfgQozQHi5I4b5xGXZSQQHpiSWp2ampBahFMlomD U6qBkWHeheMLH2i33LCZuCJ8x6KfNraxNRolaXrzM/aI3pIxPCvAxB7C7G5rdfWu2hy5ta3d b5eEHlnxvPv1mbStR5PDmHdb2L87mscUyaedp1y6TmCm7XqWC8X6Dnu2nPn29rBV6KItHsam 3XWXoy5UOe8Ts5ed0/1pKnOM4Y9yy0xdk1pD9XclSizFGYmGWsxFxYkAssBZ7bYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNJMWRmVeSWpSXmKPExsVy+t/xq7pH3HqjDLpnaVlsnLGe1eL6l+es FpPuT2CxOH9+A7vFx557rBYzzu9jslh75C67xeE37awOHB6bVnWyefRtWcXo8XmTXABzFJdN SmpOZllqkb5dAlfGnMdnWAvabCv2HbzN0sDYYdDFyMkhIWAicfroJaYuRi4OIYEljBL7Pn5n hXCamCS2v37KDlLFJmAo0fW2iw3EFhFwkPj86TUjSBGzQAeTxJ69D8ESwgJuEn9XNTGC2CwC qhJLnm4Da+YVsJW4v/EjI8Q6eYnF33eyTWDkWsDIsIpRJLW0ODc9t9hQrzgxt7g0L10vOT93 EyMwCLYd+7l5B+OljcGHGAU4GJV4eC10eqKEWBPLiitzDzFKcDArifBWCvVGCfGmJFZWpRbl xxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamC0ZFW8UTZLnve63XrmQ4t6 jb8qv6zfu/p/T5uto9DF5+/iJr3lfj6d4WGCUbS8qVHtKe/HwrOmOa2d8eb/H93Df/yfHu8M zHYRrtyX/ttxmpnP63Ve2sr2zT2WBSfnl2362xT7t2cJ5zTNiZcN7htGd8/dvTb/6v0Pmq9/ z9+XJjDreNb6ixNUlFiKMxINtZiLihMBuziOpf4BAAA= X-CMS-MailID: 20180221101532eucas1p24200cb65dba8209cd99dba5427c9a28d X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180221101532eucas1p24200cb65dba8209cd99dba5427c9a28d X-RootMTR: 20180221101532eucas1p24200cb65dba8209cd99dba5427c9a28d References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Hello, This patchset performs cleanup of the clock handling during Exynos power domain power on/off sequences. This has been achieved by moving all clock related operations from Exynos power domain driver to respective Exynos clock controller drivers. Such change is possible after introducinng runtime power-management in common clock framework. Another nice result of this cleanup is removal of deplock warning reported in the following thread (the 'second issue'): https://www.spinics.net/lists/linux-samsung-soc/msg61766.html [ 5.932966] ====================================================== [ 5.937199] usb 5-1: new high-speed USB device number 2 using xhci-hcd [ 5.939073] WARNING: possible circular locking dependency detected [ 5.939110] 4.15.0-rc8-next-20180116 #1121 Tainted: G W [ 5.958143] ------------------------------------------------------ [ 5.964299] kworker/0:1/59 is trying to acquire lock: [ 5.969304] (&genpd->mlock){+.+.}, at: [<6abc3872>] genpd_runtime_resume+0x104/0x260 [ 5.977155] [ 5.977155] but task is already holding lock: [ 5.982926] (prepare_lock){+.+.}, at: [<74cef905>] clk_prepare_lock+0x10/0xf8 [ 5.990143] [ 5.990143] which lock already depends on the new lock. [ 5.990143] [ 5.998309] [ 5.998309] the existing dependency chain (in reverse order) is: [ 6.005739] [ 6.005739] -> #1 (prepare_lock){+.+.}: [ 6.011042] mutex_lock_nested+0x1c/0x24 [ 6.015419] clk_prepare_lock+0x50/0xf8 [ 6.019755] clk_unprepare+0x1c/0x2c [ 6.023841] exynos_pd_power+0x1a8/0x1e4 [ 6.028246] genpd_power_off+0x160/0x274 [ 6.032664] genpd_power_off_work_fn+0x2c/0x40 [ 6.037630] process_one_work+0x2d4/0x8f0 [ 6.042104] worker_thread+0x38/0x584 [ 6.046268] kthread+0x138/0x168 [ 6.049981] ret_from_fork+0x14/0x20 [ 6.054044] (null) [ 6.056794] [ 6.056794] -> #0 (&genpd->mlock){+.+.}: [ 6.062238] __mutex_lock+0x7c/0xa68 [ 6.066278] mutex_lock_nested+0x1c/0x24 [ 6.070703] genpd_runtime_resume+0x104/0x260 [ 6.075557] __rpm_callback+0xc0/0x21c [ 6.079792] rpm_callback+0x20/0x80 [ 6.083774] rpm_resume+0x558/0x7dc [ 6.087762] __pm_runtime_resume+0x60/0x98 [ 6.092367] clk_core_prepare+0x44/0x490 [ 6.096783] clk_prepare+0x20/0x30 [ 6.100674] amba_get_enable_pclk+0x2c/0x60 [ 6.105363] amba_device_try_add+0x8c/0x20c [ 6.110041] amba_deferred_retry_func+0x40/0xbc [ 6.115080] process_one_work+0x2d4/0x8f0 [ 6.119569] worker_thread+0x38/0x584 [ 6.123727] kthread+0x138/0x168 [ 6.127444] ret_from_fork+0x14/0x20 [ 6.131510] (null) [ 6.134263] [ 6.134263] other info that might help us debug this: [ 6.134263] [ 6.142328] Possible unsafe locking scenario: [ 6.142328] [ 6.148178] CPU0 CPU1 [ 6.152656] ---- ---- [ 6.157160] lock(prepare_lock); [ 6.160439] lock(&genpd->mlock); [ 6.166365] lock(prepare_lock); [ 6.172168] lock(&genpd->mlock); [ 6.175517] [ 6.175517] *** DEADLOCK *** [ 6.175517] [ 6.181475] 4 locks held by kworker/0:1/59: [ 6.185580] #0: ((wq_completion)"events"){+.+.}, at: [] process_one_work+0x210/0x8f0 [ 6.194407] #1: ((deferred_retry_work).work){+.+.}, at: [] process_one_work+0x210/0x8f0 [ 6.203422] #2: (deferred_devices_lock){+.+.}, at: [<3e940c1f>] amba_deferred_retry_func+0x1c/0xbc [ 6.212522] #3: (prepare_lock){+.+.}, at: [<74cef905>] clk_prepare_lock+0x10/0xf8 [ 6.220128] [ 6.220128] stack backtrace: [ 6.224438] CPU: 0 PID: 59 Comm: kworker/0:1 Tainted: G W 4.15.0-rc8-next-20180116 #1121 [ 6.233757] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 6.239791] Workqueue: events amba_deferred_retry_func [ 6.244929] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 6.252670] [] (show_stack) from [] (dump_stack+0x98/0xc4) [ 6.259877] [] (dump_stack) from [] (print_circular_bug.constprop.17+0x210/0x32c) [ 6.269077] [] (print_circular_bug.constprop.17) from [] (__lock_acquire+0x155c/0x1ac8) [ 6.278786] [] (__lock_acquire) from [] (lock_acquire+0xe0/0x2bc) [ 6.286558] [] (lock_acquire) from [] (__mutex_lock+0x7c/0xa68) [ 6.294181] [] (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) [ 6.302161] [] (mutex_lock_nested) from [] (genpd_runtime_resume+0x104/0x260) [ 6.311008] [] (genpd_runtime_resume) from [] (__rpm_callback+0xc0/0x21c) [ 6.319484] [] (__rpm_callback) from [] (rpm_callback+0x20/0x80) [ 6.327185] [] (rpm_callback) from [] (rpm_resume+0x558/0x7dc) [ 6.334721] [] (rpm_resume) from [] (__pm_runtime_resume+0x60/0x98) [ 6.342706] [] (__pm_runtime_resume) from [] (clk_core_prepare+0x44/0x490) [ 6.351297] [] (clk_core_prepare) from [] (clk_prepare+0x20/0x30) [ 6.359081] [] (clk_prepare) from [] (amba_get_enable_pclk+0x2c/0x60) [ 6.367229] [] (amba_get_enable_pclk) from [] (amba_device_try_add+0x8c/0x20c) [ 6.376164] [] (amba_device_try_add) from [] (amba_deferred_retry_func+0x40/0xbc) [ 6.385361] [] (amba_deferred_retry_func) from [] (process_one_work+0x2d4/0x8f0) [ 6.394457] [] (process_one_work) from [] (worker_thread+0x38/0x584) [ 6.402497] [] (worker_thread) from [] (kthread+0x138/0x168) [ 6.409852] [] (kthread) from [] (ret_from_fork+0x14/0x20) This patchset affects Exynos5250 and Exynos5420/5422/5800 SoCs. Changes has been tested on Snow Chromebook (Exynos5250), Peach-Pit Chromebook2 (Exynos5420) and Odroid XU3/XU4 (Exynos5422) boards with latest linux-next kernel. If possible I would like to get patches 1-4 merged to current clk-next tree and patches 5-6 queued to next merge cycle. Best regards Marek Szyprowski Samsung R&D Institute Poland Patch summary: Marek Szyprowski (6): soc: samsung: pm_domains: Add blacklisting clock handling clk: samsung: Add Exynos5x sub-CMU clock driver clk: samsung: exynos542x: Move PD-dependent clocks to Exynos5x sub-CMU driver clk: samsung: exynos5250: Move PD-dependent clocks to Exynos5x sub-CMU driver soc: samsung: pm_domains: Deprecate support for clocks ARM: dts: exynos: Remove obsolete clock properties from power domains .../devicetree/bindings/power/pd-samsung.txt | 20 +-- arch/arm/boot/dts/exynos5250.dtsi | 4 - arch/arm/boot/dts/exynos5420.dtsi | 14 -- drivers/clk/samsung/Makefile | 2 + drivers/clk/samsung/clk-exynos5250.c | 51 ++++-- drivers/clk/samsung/clk-exynos5420.c | 121 +++++++++++--- drivers/clk/samsung/clk-exynos5x-subcmu.c | 183 +++++++++++++++++++++ drivers/clk/samsung/clk-exynos5x-subcmu.h | 30 ++++ drivers/soc/samsung/pm_domains.c | 79 +-------- 9 files changed, 350 insertions(+), 154 deletions(-) create mode 100644 drivers/clk/samsung/clk-exynos5x-subcmu.c create mode 100644 drivers/clk/samsung/clk-exynos5x-subcmu.h -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html