Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1501143imj; Fri, 8 Feb 2019 02:31:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IbgLojVynkPXc05VKBlR7CPvTTU5aUZBLlON0/jWy6FfCAojSBWWK3QSteIqcJ5jNEh8C4P X-Received: by 2002:a63:df16:: with SMTP id u22mr14451702pgg.175.1549621918352; Fri, 08 Feb 2019 02:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549621918; cv=none; d=google.com; s=arc-20160816; b=km2hqP8UVpIaU1CCLelyZDpYrBtvSvuQngyzkn3XcApNuFKMZI0xlKKugU1fdr1GFF RR4RUi6sQeQRYQx8PRWBaiiKhow2dvFaOQJVJs5nwGIhKMxe7vTrnPgF+ZlmOiBVw7tO /cQrkbNTaM3SUNEzWJOb4eww+eSPv9hhISy6u+9nJcX8QBYdmp8d7DSUGGkqkkmaDYVC impfQv6meScM1Nfbr7y6aW3374uI0ud4g9opW8Ioa7eWKlqlc8D2Q47WvqTUgVGnu2oG xIKsXwLAJoYhrGnBlwyf4QrFUb9oyUuvsiD9O3HRArNUbwn/KlU575Mt6RpztED3dibZ WKQQ== 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:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=b5dtEXpUuO482dXGRtsPGjqikcOpi8AUfz1v7iJ03II=; b=baPHTCD2t8xOlaOmE594pkXwVjUhBSi+WEJTsXskkzJDz0Q1OLa5qMqhwWcz9N7CUD +ypwcjy0KU/qvlS9CyfAycTeoIxEO1kDZ9zlBg0rTTu4sCxQf8zNp/oDfsYFx7XgPMaV qxA1e8O/DByUMBIpnAu70kuVvjb1I1AkYvXNdsHhKyiOTYWqZqLHI8Utrdr6GSchooyQ eac1KbJpj2ruWjmbIbDWDi55Xq9HkOSVV0oFglL9Jfd5X/SEnwuM1XYNhwP3Ct2GnGJs fEmA6jBjP3h46g2A/jmcd+daa/qItjUcJ+BSdIJqARRa5jJdUpgzVT3jl+GNGgWaCpv7 WL4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Eb7ls8Uc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 g69si1901378pfg.225.2019.02.08.02.31.42; Fri, 08 Feb 2019 02:31:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Eb7ls8Uc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726704AbfBHKbd (ORCPT + 99 others); Fri, 8 Feb 2019 05:31:33 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:44900 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726456AbfBHKbd (ORCPT ); Fri, 8 Feb 2019 05:31:33 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190208103131euoutp02550257853fb87ba70d699c54cad4a04b~BXOZjcUu33264532645euoutp02B for ; Fri, 8 Feb 2019 10:31:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190208103131euoutp02550257853fb87ba70d699c54cad4a04b~BXOZjcUu33264532645euoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549621891; bh=b5dtEXpUuO482dXGRtsPGjqikcOpi8AUfz1v7iJ03II=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=Eb7ls8UcExOGVqfHiv6IQPON6HNzsHCnWEQUJeTXFCKL2PY9PCuvfMd6B5YvPFH85 gTB/A/tSYzqSD75ABH61swdurWVheeLJFBXsXkhV6PxaoZf2TynSEFyfHufK/GtMsW R/fFggH92XyIEICYl+oDlSkyqfMhzmjAo/eMb04g= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190208103130eucas1p22b38d281c664e0704fd80c473d72e082~BXOYwfGy60307803078eucas1p2C; Fri, 8 Feb 2019 10:31:30 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 5E.5E.04441.28A5D5C5; Fri, 8 Feb 2019 10:31:30 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190208103129eucas1p2749484db501f58287147ef95b9b72c45~BXOX6Hqqg3184231842eucas1p2B; Fri, 8 Feb 2019 10:31:29 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190208103129eusmtrp132ab81c31f506e13f419992f154945e7~BXOX46P3B1064210642eusmtrp1x; Fri, 8 Feb 2019 10:31:29 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-11-5c5d5a821500 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 05.C7.04284.18A5D5C5; Fri, 8 Feb 2019 10:31:29 +0000 (GMT) Received: from [106.116.147.30] (unknown [106.116.147.30]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190208103128eusmtip1b82f8d443cd942fe4548c1cf07709087~BXOXQX5l-3170931709eusmtip1h; Fri, 8 Feb 2019 10:31:28 +0000 (GMT) Subject: Re: [PATCH 0/2] cpufreq/opp: rework regulator initialization To: "Rafael J. Wysocki" , Viresh Kumar Cc: Linux Kernel Mailing List , Linux PM , Linux Samsung SoC , "Rafael J . Wysocki" , Nishanth Menon , Stephen Boyd , Bartlomiej Zolnierkiewicz , Dave Gerlach , Wolfram Sang From: Marek Szyprowski Message-ID: Date: Fri, 8 Feb 2019 11:31:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJKsWRmVeSWpSXmKPExsWy7djPc7pNUbExBvPv81hsnLGe1eLm1w5W i8u75rBZfO49wmgx4/w+Jos3P84yWcz9MpXZ4szpS6wW/65tZLHY+NXDYuWJWcwO3B6bVnWy edy5tofNY8vVdhaPvi2rGD1OnnrC4nH8xnYmj8+b5ALYo7hsUlJzMstSi/TtErgy+q8XF8zV rTjcdp+pgbFDrYuRk0NCwESi6fhMpi5GLg4hgRWMEn0vvrJCOF8YJX5tOgHlfGaUWLxiBxtM y+Lb3YwQieWMEl82TmeHcN4zStzr38UEUiUs4CrxrPkMO4gtIhAqsaxxA1gRs0ATs0RPwwpm kASbgKFE19susLG8AnYSM3ecAbNZBFQkXq2YAtYsKhAjMeXcEXaIGkGJkzOfsIDYnAKBEs03 OsDmMAvIS2x/OwfKFpe49WQ+2EcSArfYJfpf/GOGuNtFov/YRHYIW1ji1fEtULaMxOnJPSwQ Dc2MEu0zZrFDOD2MElvnwHxtLXH4+EVgcHAArdCUWL9LHyLsKHHq8Eo2kLCEAJ/EjbeCEEfw SUzaNp0ZIswr0dEmBFGtJjHr+Dq4tQcvXG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4Q1NDcwtLQ3Njc2MzCyVx3vMGlVFCAumJJanZqakFqUUwfUwcnFINjLOW dSpoyq39LD3l6ffpRd5py5Y3c5bYnI5qqT90fVaCWvb5d4FzjhwWYG3dvvb4qQWLddYvKHlt vfevbRvjq5CZm9N5haP0V8u4sTck8E21NprC0LTy/5KYL+I5MSU8D79enHCq8de7GN1Zcx5M kKs7N29268QTvo9fzc/4tlXRPdvHK2NK2BUlluKMREMt5qLiRAC/OMOa7QIAAA== X-CMS-MailID: 20190208103129eucas1p2749484db501f58287147ef95b9b72c45 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190207122255eucas1p1cdebed838c799eca46cce6a654a26187 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190207122255eucas1p1cdebed838c799eca46cce6a654a26187 References: <20190207122227.19873-1-m.szyprowski@samsung.com> <20190208064957.zhyue42kpgaoslwm@vireshk-i7> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, On 2019-02-08 11:22, Rafael J. Wysocki wrote: > On Fri, Feb 8, 2019 at 7:50 AM Viresh Kumar wrote: >> On 07-02-19, 13:22, Marek Szyprowski wrote: >>> Dear All, >>> >>> Recent commit 9ac6cb5fbb17 ("i2c: add suspended flag and accessors for >>> i2c adapters") added a visible warning for an attempt to do i2c transfer >>> over a suspended i2c bus. This revealed a long standing issue in the >>> cpufreq-dt driver, which gives a following warning during system >>> suspend/resume cycle: >>> >>> --->8--- >>> Enabling non-boot CPUs ... >>> CPU1 is up >>> CPU2 is up >>> CPU3 is up >>> ------------[ cut here ]------------ >>> WARNING: CPU: 4 PID: 29 at drivers/i2c/i2c-core-base.c:1869 __i2c_transfer+0x6f8/0xa50 >>> Modules linked in: >>> CPU: 4 PID: 29 Comm: cpuhp/4 Tainted: G W 5.0.0-rc4-next-20190131-00024-g54b06b29cc65 #5324 >>> Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) >>> [] (unwind_backtrace) from [] (show_stack+0x10/0x14) >>> [] (show_stack) from [] (dump_stack+0x90/0xc8) >>> [] (dump_stack) from [] (__warn+0xf8/0x124) >>> [] (__warn) from [] (warn_slowpath_null+0x40/0x48) >>> [] (warn_slowpath_null) from [] (__i2c_transfer+0x6f8/0xa50) >>> [] (__i2c_transfer) from [] (i2c_transfer+0x70/0xe4) >>> [] (i2c_transfer) from [] (regmap_i2c_read+0x48/0x64) >>> [] (regmap_i2c_read) from [] (_regmap_raw_read+0xf8/0x450) >>> [] (_regmap_raw_read) from [] (_regmap_bus_read+0x38/0x68) >>> [] (_regmap_bus_read) from [] (_regmap_read+0x60/0x250) >>> [] (_regmap_read) from [] (regmap_read+0x3c/0x5c) >>> [] (regmap_read) from [] (regulator_is_enabled_regmap+0x20/0x90) >>> [] (regulator_is_enabled_regmap) from [] (_regulator_is_enabled+0x34/0x40) >>> [] (_regulator_is_enabled) from [] (create_regulator+0x1a4/0x25c) >>> [] (create_regulator) from [] (_regulator_get+0xe4/0x278) >>> [] (_regulator_get) from [] (dev_pm_opp_set_regulators+0xa0/0x1c0) >>> [] (dev_pm_opp_set_regulators) from [] (cpufreq_init+0x98/0x2d0) >>> [] (cpufreq_init) from [] (cpufreq_online+0xc8/0x71c) >>> [] (cpufreq_online) from [] (cpuhp_cpufreq_online+0x8/0x10) >>> [] (cpuhp_cpufreq_online) from [] (cpuhp_invoke_callback+0xf4/0xebc) >>> [] (cpuhp_invoke_callback) from [] (cpuhp_thread_fun+0x1d8/0x320) >>> [] (cpuhp_thread_fun) from [] (smpboot_thread_fn+0x194/0x340) >>> [] (smpboot_thread_fn) from [] (kthread+0x124/0x160) >>> [] (kthread) from [] (ret_from_fork+0x14/0x20) >>> Exception stack(0xe897dfb0 to 0xe897dff8) >>> dfa0: 00000000 00000000 00000000 00000000 >>> dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 >>> dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 >>> irq event stamp: 3865 >>> hardirqs last enabled at (3873): [] vprintk_emit+0x228/0x2a4 >>> hardirqs last disabled at (3880): [] vprintk_emit+0x12c/0x2a4 >>> softirqs last enabled at (3052): [] __do_softirq+0x3a4/0x66c >>> softirqs last disabled at (3043): [] irq_exit+0x140/0x168 >>> ---[ end trace db48b455d924fec2 ]--- >>> CPU4 is up >>> CPU5 is up >>> CPU6 is up >>> CPU7 is up >>> --->8--- >>> >>> This is a scenario that triggers the above issue: >>> >>> 1. system disables non-boot cpu's at the end of system suspend procedure, >>> 2. this in turn deinitializes cpufreq drivers for the disabled cpus, >>> 3. early in the system resume procedure all cpus are got back to online >>> state, >>> 4. this in turn causes cpufreq to be initialized for the newly onlined >>> cpus, >>> 5. cpufreq-dt acquires all its resources (clocks, regulators) during >>> ->init() callback, >>> 6. getting regulator require to check its state, what in turn requires >>> i2c transfer, >>> 7. during system early resume stage this is not really possible. >>> >>> The issue is caused by cpufreq-dt driver not keeping its resources for >>> the whole driver lifetime and relying that they can be always acquired >>> at any system context. This problem has been observed on Samsung >>> Exynos based Odroid XU3/XU4 boards, but it happens on all boards, which >>> have separate regulators for different CPU clusters. >> Why don't you get similar problem during suspend? I think you can get >> it when the CPUs are offlined as I2C would have gone by then. The >> cpufreq or OPP core can try and run some regulator or genpd or clk >> calls to disable resources, etc. Even if doesn't happen, it certainly >> can. >> >> Also at resume the cpufreq core may try to change the frequency right >> from ->init() on certain cases, though not everytime and so the >> problem can come despite of this series. >> >> We guarantee that the resources are available during probe but not >> during resume, that's where the problem is. >> >> @Rafael any suggestions on how to fix this ? > There are cpufreq driver suspend and resume callbacks, maybe use them? > > The driver could do the I2C transactions in its suspend/resume > callbacks and do nothing in online/offline if those are part of > system-wide suspend/resume. This is exactly what I suggested, when I wrote to handle it in cpufreq suspend/resume. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland