From patchwork Mon Feb 26 12:53:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 129644 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp167156lja; Mon, 26 Feb 2018 04:54:12 -0800 (PST) X-Google-Smtp-Source: AH8x226ybnu9mLSqZeoi9ZmcyAqD1klBjFWLPAN0ebXN2x7AgF+KD/EP2v/xuuWOPgpN0pWYKM05 X-Received: by 10.98.117.139 with SMTP id q133mr10408098pfc.64.1519649651920; Mon, 26 Feb 2018 04:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519649651; cv=none; d=google.com; s=arc-20160816; b=kNaVI186zxD8MJt1IWxdU0pKkSwiykrqojzB7ChO+uVZbVPg8z5H4IWlehflRD2gKc z99XmwE2x2M5Uu4JwrUA/XigZAtk86k37pJokgT61Y+OxH3mc4wU3bpi8JWfBEYy2eGb Bvq01A8GJotUKEIJgLST9A04qONzdFnT3aw31PMeUsBvJUy0ehgUG1Ku6r69Kf5APYP8 fh5PJalwg30Pu6NToU3u+8O66AvgPeq8uPJuelQbc8B2rvwrXUAgBH8eK+TLpzY2TMON G7+YTIyAp37LViEtGbkEQW353iO6QB1TGxGpKqyEoaJIypDVnbZAhrcyFoJxFpoqntWG Mvlw== 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=clK9FJFd2XjNY3OgZpH0oIcAElJatIoKIfar/PlqAxQ=; b=bidGNtUNsw94sX9C8c3t4SYogWfhh9qT+FCnrun6BQmr990rujnMlCSKfYLyC7CYM8 zfzCbiGQUJpCErHXYhI0mBQQ94zfYI7Ibf+YQWoiGVM9U4xlcBUzbBCNRhGjarNc+lRq 6c75isH30E07nDJ1soiUXx3Fy/6xL5uiAiX0Jl/C5xTMZESEXvEwFFITbjJbRJ3cbmfq FiKYHIaXetanNcETzfHRvBLR4mNcqTuuBMXtmjzAwqAdyAHJIOts2MBGYLSwG0fbM/Hf yKoRkk26XjIJJI+EucVC5LMRAQ8Y5ZDKje18EErFxeNtr2vL5fHp6WK7ochiGQXh2gBe ymBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=ediOWq3x; 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 b2si5504382pgt.458.2018.02.26.04.54.11; Mon, 26 Feb 2018 04:54:11 -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=ediOWq3x; 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 S1752597AbeBZMyK (ORCPT + 3 others); Mon, 26 Feb 2018 07:54:10 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39375 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752420AbeBZMyH (ORCPT ); Mon, 26 Feb 2018 07:54:07 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180226125404euoutp012fde3d344e865bea02c7483ca4a747d4~W4UzMou2y1566615666euoutp01K; Mon, 26 Feb 2018 12:54:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180226125404euoutp012fde3d344e865bea02c7483ca4a747d4~W4UzMou2y1566615666euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1519649644; bh=5U4cGIjd2iSpTMyonFEdprULf5Q4hE8sqrsejtQbqic=; h=From:To:Cc:Subject:Date:References:From; b=ediOWq3xwZ8gZAu39To9ypXt8Ev7nSzmoyKWgb3c1yReBaHsBiisyquIv70u69MeP efuPbHyPMoS6EtjEmdjlKQQ/sa0kHwIjaktgXCQurxUYtcG2S0CpBTEQ6xeIpNnIGR vp83ap6Hx9Xms4ENdabDT6pewDwMBU6SrbLKVRiM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180226125402eucas1p1cdbc122d551b0467c8c6f79e63566aac~W4Ux_-Srg0049100491eucas1p1S; Mon, 26 Feb 2018 12:54:02 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 73.78.10409.A63049A5; Mon, 26 Feb 2018 12:54:02 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180226125401eucas1p2c8025c8d6472d2826bb90ea2db84c566~W4UwuF_px0420004200eucas1p2J; Mon, 26 Feb 2018 12:54:01 +0000 (GMT) X-AuditID: cbfec7f5-b45ff700000028a9-d6-5a94036a7d50 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8E.FC.04183.963049A5; Mon, 26 Feb 2018 12:54:01 +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 <0P4R0055KD5X67D0@eusync3.samsung.com>; Mon, 26 Feb 2018 12:54:01 +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 v2 0/6] Exynos5: cleanup clocks handling in power domains Date: Mon, 26 Feb 2018 13:53:49 +0100 Message-id: <20180226125355.9052-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.15.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIIsWRmVeSWpSXmKPExsWy7djPc7pZzFOiDGYslbTYOGM9q8X1L89Z LSbdn8Bicf78BnaLjz33WC1mnN/HZLH2yF12i8Nv2lkdODw2repk8+jbsorR4/MmuQDmKC6b lNSczLLUIn27BK6MTevPsRRctK2YO/0KSwPjXoMuRg4OCQETiW/tAl2MXBxCAisYJZquz2GF cD4zSkxZeJCli5ETrOhR7x9GiMQyRol/D2cxQTgNTBLbmn4zg1SxCRhKdL3tYgOxRQQcJD5/ eg3WwSzQxiRx9sB+JpCEsICnxJU9F1hAdrMIqEp8e2ABEuYVsJGY9/UmG8Q2eYnF33dC2U9Z Jfq+hEDYLhJnZ7+DukhY4tXxLewQtozE5cndLCC7JAT6ga77/5IJwpnBKLH+YytUlbXE4eMX WUFsZgE+iUnbpjNDAoBXoqNNCML0kGg7oQZR7Sjx9/NCVpCwkECsxLw/IhMYJRcwMqxiFE8t Lc5NTy02zkst1ytOzC0uzUvXS87P3cQIjLjT/45/3cG470/SIUYBDkYlHt4fdyZHCbEmlhVX 5h5ilOBgVhLhXbkYKMSbklhZlVqUH19UmpNafIhRmoNFSZw3TqMuSkggPbEkNTs1tSC1CCbL xMEp1cBous9vi5HOxk2FPHJBMZPO2tvmiD+WOHx5qWe47ynmecGHy/ZfmLlF+OgFxwk6ZxM/ qNwNW7zn3CnOoAL+D2ff5Sm9e79821o/4+js5o1hrOxvxFb+tevyMeQVLpzL2vzDutTv3IrQ F13376Q1S1SGWr6VurN0cnQg87ddEWI5KfEq7EfNJmxXYinOSDTUYi4qTgQAlUaiE7QCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFJMWRmVeSWpSXmKPExsVy+t/xq7qZzFOiDHZ0KFtsnLGe1eL6l+es FpPuT2CxOH9+A7vFx557rBYzzu9jslh75C67xeE37awOHB6bVnWyefRtWcXo8XmTXABzFJdN SmpOZllqkb5dAlfGpvXnWAou2lbMnX6FpYFxr0EXIyeHhICJxKPeP4xdjFwcQgJLGCWmrLgI 5TQxSSzdeooNpIpNwFCi620XmC0i4CDx+dNrsCJmgQ4miT17H4IlhAU8Ja7sucDSxcjBwSKg KvHtgQVImFfARmLe15tsENvkJRZ/38k2gZFrASPDKkaR1NLi3PTcYiO94sTc4tK8dL3k/NxN jMAQ2Hbs55YdjF3vgg8xCnAwKvHwLvg5KUqINbGsuDL3EKMEB7OSCO/KxZOjhHhTEiurUovy 44tKc1KLDzFKc7AoifOeN6iMEhJITyxJzU5NLUgtgskycXBKNTDu/zfD8FxWZ04uo4/g9s76 uSFxoVKnEmzNGD/U8Fgu1s5eWx639Ebgum0OB6U7tR905FXULDzk2zqxPmh5w4w+tq5bExp+ nCnb27bH7cUcDfOU84o2zy6VM01XVtqQ594U5VJ44dHDvonXgwR3db/3b3favWWCim6UHcvv e+9NBfy1pfPPliqxFGckGmoxFxUnAgDF7UG4/QEAAA== X-CMS-MailID: 20180226125401eucas1p2c8025c8d6472d2826bb90ea2db84c566 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180226125401eucas1p2c8025c8d6472d2826bb90ea2db84c566 X-RootMTR: 20180226125401eucas1p2c8025c8d6472d2826bb90ea2db84c566 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 Changelog: v2: - fixed minor style issues pointed by Krzysztof Kozlowski Patch summary: Marek Szyprowski (6): soc: samsung: pm_domains: Add blacklisting clock handling clk: samsung: Add Exynos5 sub-CMU clock driver clk: samsung: exynos5420: Move PD-dependent clocks to Exynos5 sub-CMU driver clk: samsung: exynos5250: Move PD-dependent clocks to Exynos5 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-exynos5-subcmu.c | 188 +++++++++++++++++++++ drivers/clk/samsung/clk-exynos5-subcmu.h | 26 +++ drivers/clk/samsung/clk-exynos5250.c | 51 ++++-- drivers/clk/samsung/clk-exynos5420.c | 121 ++++++++++--- drivers/soc/samsung/pm_domains.c | 79 +-------- 9 files changed, 351 insertions(+), 154 deletions(-) create mode 100644 drivers/clk/samsung/clk-exynos5-subcmu.c create mode 100644 drivers/clk/samsung/clk-exynos5-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