From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754528AbaLVLqA (ORCPT ); Mon, 22 Dec 2014 06:46:00 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:21263 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754132AbaLVLp6 (ORCPT ); Mon, 22 Dec 2014 06:45:58 -0500 X-AuditID: cbfec7f5-b7fc86d0000066b7-a2-549804747262 From: Krzysztof Kozlowski To: Mike Turquette , Stephen Boyd , linux-kernel@vger.kernel.org Cc: Rajendra Nayak , Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH] clk: Fix __GFP_FS allocation with irqs disabled Date: Mon, 22 Dec 2014 12:45:47 +0100 Message-id: <1419248747-3367-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOJMWRmVeSWpSXmKPExsVy+t/xy7olLDNCDL71K1psnLGe1eL1C0OL s01v2C0u75rDZrH2yF12i6cTLrJZPOvfw2jx40w3i8WCjY8YHTg9Lvf1MnncubaHzaNvyypG j+M3tjN5fN4kF8AaxWWTkpqTWZZapG+XwJWx4O8ipoJLShXNGxuZGxjvyHYxcnJICJhILO89 zwxhi0lcuLeerYuRi0NIYCmjxK7u+YwgCSGBPiaJl2u4QGw2AWOJzcuXsIHYIgL5ErPW3WYB aWAW+Mso0XyzASwhLOAg8fbWfRYQm0VAVWLBtntgNq+Am8Se/tPsENvkJE4em8w6gZF7ASPD KkbR1NLkguKk9FwjveLE3OLSvHS95PzcTYyQwPm6g3HpMatDjAIcjEo8vB2rpoUIsSaWFVfm HmKU4GBWEuE9/Hl6iBBvSmJlVWpRfnxRaU5q8SFGJg5OqQZGHvd1+z/vvLkgK8KF5fOyVdkr gi4bfbcT8Ey4Yrfnbm7bghCZhTu/Wbl9/un8Xb3zXFPV+aq7TAdDe5K14lR4nuW5PFdimFT7 /6W6marfoWUfdL9Il/w7JHDjlPO27SLH1fwby2f1r0+21alnTNp67/LTX5fWTBVb2pTntekp V7Nn3k15SaX1SizFGYmGWsxFxYkAdsCakfoBAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allocation of memory for cached clock parents during s3c-sdhci probe was done with interrupts disabled which lead to lockdep warning: [ 2.254980] s3c-sdhci 12530000.sdhci: clock source 2: mmc_busclk.2 (50000000 Hz) [ 2.560726] ------------[ cut here ]------------ [ 2.565341] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:2744 lockdep_trace_alloc+0xec/0x118() [ 2.574439] DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) [ 2.579821] Modules linked in: [ 2.583038] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 3.18.0-next-20141216-00002-g4ff197fc1902-dirty #1318 [ 2.593796] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 2.599892] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 2.607612] [] (show_stack) from [] (dump_stack+0x70/0xbc) [ 2.614822] [] (dump_stack) from [] (warn_slowpath_common+0x74/0xb0) [ 2.622885] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40) [ 2.631569] [] (warn_slowpath_fmt) from [] (lockdep_trace_alloc+0xec/0x118) [ 2.640246] [] (lockdep_trace_alloc) from [] (__kmalloc+0x3c/0x1cc) [ 2.648240] [] (__kmalloc) from [] (clk_fetch_parent_index+0xb8/0xd4) [ 2.656390] [] (clk_fetch_parent_index) from [] (clk_calc_new_rates+0xe0/0x1fc) [ 2.665415] [] (clk_calc_new_rates) from [] (clk_calc_new_rates+0x1b4/0x1fc) [ 2.674181] [] (clk_calc_new_rates) from [] (clk_set_rate+0x50/0xc8) [ 2.682265] [] (clk_set_rate) from [] (sdhci_cmu_set_clock+0x68/0x16c) [ 2.690503] [] (sdhci_cmu_set_clock) from [] (sdhci_do_set_ios+0xf0/0x64c) [ 2.699095] [] (sdhci_do_set_ios) from [] (sdhci_set_ios+0x20/0x2c) [ 2.707080] [] (sdhci_set_ios) from [] (mmc_power_up+0x118/0x1fc) [ 2.714889] [] (mmc_power_up) from [] (mmc_start_host+0x44/0x6c) [ 2.722615] [] (mmc_start_host) from [] (mmc_add_host+0x58/0x7c) [ 2.730341] [] (mmc_add_host) from [] (sdhci_add_host+0x968/0xd94) [ 2.738240] [] (sdhci_add_host) from [] (sdhci_s3c_probe+0x354/0x52c) [ 2.746406] [] (sdhci_s3c_probe) from [] (platform_drv_probe+0x48/0xa4) [ 2.754733] [] (platform_drv_probe) from [] (driver_probe_device+0x13c/0x37c) [ 2.763585] [] (driver_probe_device) from [] (__driver_attach+0x94/0x98) [ 2.772003] [] (__driver_attach) from [] (bus_for_each_dev+0x54/0x88) [ 2.780163] [] (bus_for_each_dev) from [] (bus_add_driver+0xe4/0x200) [ 2.788322] [] (bus_add_driver) from [] (driver_register+0x78/0xf4) [ 2.796308] [] (driver_register) from [] (do_one_initcall+0xac/0x1f0) [ 2.804473] [] (do_one_initcall) from [] (kernel_init_freeable+0x10c/0x1d8) [ 2.813153] [] (kernel_init_freeable) from [] (kernel_init+0x28/0x108) [ 2.821398] [] (kernel_init) from [] (ret_from_fork+0x14/0x2c) [ 2.828939] ---[ end trace 03cc00e539849d1f ]--- The memory for cached parents was not allocated during __clk_init() because the clock has only one parent and commit 9ca1c5a4bf41 ("clk: cache parent clocks only for muxes") made allocation skipped in such case. Be consequent also in clk_fetch_parent_index(): don't cache parents if there is only one. Signed-off-by: Krzysztof Kozlowski Fixes: 9ca1c5a4bf41 ("clk: cache parent clocks only for muxes") Cc: --- drivers/clk/clk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index f4963b7d4e17..35079302a650 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1150,6 +1150,12 @@ static int clk_fetch_parent_index(struct clk *clk, struct clk *parent) { int i; + if (clk->num_parents == 1) { + if (IS_ERR_OR_NULL(clk->parent)) + clk->parent = __clk_lookup(clk->parent_names[0]); + return 0; + } + if (!clk->parents) { clk->parents = kcalloc(clk->num_parents, sizeof(struct clk *), GFP_KERNEL); -- 1.9.1