Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1388835imj; Fri, 8 Feb 2019 00:14:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IYPj9HIxn1Y2dFagL4EbjSN9sgpWJj7dRHFZ6dr2JarQEq4h3KjGZciHxy00MUdD7q1/8N4 X-Received: by 2002:a17:902:147:: with SMTP id 65mr21436512plb.116.1549613643669; Fri, 08 Feb 2019 00:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549613643; cv=none; d=google.com; s=arc-20160816; b=PonBcC+lHIyY9trXd4nApo1ooLnAwz0s/9QnkzScYQHLKWvCy37HyqcCuOXRJ72Abn w7Lwxc4+qXKrGoEnOVSbJ90eaeEGtcVYfLv8rY4COstHvV/WA7Cn39rtmX+ApHFjdyxj 4HuzgA3pxTczSU5AsBMrM18PjFZDTk0B4mOiB7POniSrTZo3zI5YxssDTVsZMWBJuO2b bBbe4VscwQKRTFAd6zlpwM6ITtppTGtwe0Et+/WPd5WGRYwUZwfUoej9rnoA3oIBPflc E9MPXSvgbmQjo4i8jSW0GIAwE2xtnJ0qaUKDsVCtlMeEFqBeYs37/dnjGjFuNqVQFOUs 2zLQ== 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=HbT02cYVEeDeRG/H019OSs/fJbaOjdD+nrtCDD9d35c=; b=sMD5nVCMDhxD+y2st9TysfR/9s8Lpm1cX+OunGcRzf4vtOFR3xRftoi9cOSZLmTcJW YM8u0awRKFCWH4i0Oin6ixa8AdnPLFsbApz7WGE1GpeTzPAf7A4hdz+ubi8kqS4B+Pgo /363PE/oWbfVWISoPXFdRnfvtliQhxfkeyLV/Fu0deuL2QJqoIp6FUj1M5aeJUDsy6Fk kZHb3m4qVlcpCVszlMPnD/RBKcBieO2Wl425VzlEo3S71USwBgNz/m+PyPtJ1jckvGk5 oO4jqpDA0oogpIb/Npga5AdANdOacsuX1ngfLWIY/XODK9aNIOdioGe3zuO+u7yfzQzw 1ngw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=mmzqjzhA; 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 h13si1443965pgs.17.2019.02.08.00.13.47; Fri, 08 Feb 2019 00:14:03 -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=mmzqjzhA; 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 S1727307AbfBHIMy (ORCPT + 99 others); Fri, 8 Feb 2019 03:12:54 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:48086 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727200AbfBHIMx (ORCPT ); Fri, 8 Feb 2019 03:12:53 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190208081251euoutp01b7a9dc53567c3575866bcc8d0eb58816~BVVU8B39V2610926109euoutp01j for ; Fri, 8 Feb 2019 08:12:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190208081251euoutp01b7a9dc53567c3575866bcc8d0eb58816~BVVU8B39V2610926109euoutp01j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549613571; bh=HbT02cYVEeDeRG/H019OSs/fJbaOjdD+nrtCDD9d35c=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=mmzqjzhAWUf/a1we6X9fH4Imzim8JpX4teOZndbMYMevuvTykEcjzKqlaQ55gV40Z DcWDChHFT9dOuFo6tMkQoxbEqSOnfxRmbvmwczLDG7UJ4E4dCLGPeUg0WrxHwVJWIT IhF1qW60TBFKp6adrXSfXFtpdBCtDadJCd0c6jxs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190208081250eucas1p2f3b71c3df049a1307c905ac2e7206192~BVVUfRllW2320323203eucas1p2T; Fri, 8 Feb 2019 08:12:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 15.06.04806.20A3D5C5; Fri, 8 Feb 2019 08:12:50 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190208081249eucas1p16730dd936643c8880d1cf35efdb68ec5~BVVTqhtFc0203902039eucas1p1l; Fri, 8 Feb 2019 08:12:49 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190208081249eusmtrp193b4ebdca5e18ef1979817a81edf58a6~BVVTbxmUM3196731967eusmtrp1g; Fri, 8 Feb 2019 08:12:49 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-ac-5c5d3a028abb Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 3C.DB.04128.10A3D5C5; Fri, 8 Feb 2019 08:12:49 +0000 (GMT) Received: from [106.116.147.30] (unknown [106.116.147.30]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190208081249eusmtip181c21b0992b26e357c02bab3eadb5c11~BVVS03eUA2308723087eusmtip1r; Fri, 8 Feb 2019 08:12:49 +0000 (GMT) Subject: Re: [PATCH 0/2] cpufreq/opp: rework regulator initialization To: Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, "Rafael J . Wysocki" , Nishanth Menon , Stephen Boyd , Bartlomiej Zolnierkiewicz , Dave Gerlach , Wolfram Sang From: Marek Szyprowski Message-ID: Date: Fri, 8 Feb 2019 09:12:48 +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: <20190208064957.zhyue42kpgaoslwm@vireshk-i7> Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTYRj2O5ftuFocp+mnhtEKw3tixLFCisoGEkghdJnU0tM03bQdL2kE QyttqIWLWmtdIHAppji8YbLqaJ2c5rXElZjlKFJHoA7KRHI7Vv57nvd93vd5n4+PQCVdeBCR qc6jNWpFtlQgwlpf/xqIQnanynfYFrZSTYZGnLK7ynFqpMMkoOYruwFlGLAi1OzPtwjV1zuM U8ujTRjV5JJRtW+M6D6RzFJ3XSAbH+0UyJrfl2GyquY6IOuxOTAZN9aGyOYtIcnCk6K96XR2 ZgGtiUk4I8oYMo8gueNRFxt+9wEtqA/VAYKA5E5o/xyiAyJCQj4B8PniJM6TBQArJ1oEPJkH cO5x9Qrx9kxonU8RvmEGcOSTFePJDwBbZr6hbpUveQh+Le0Tuj38yHD43U67NSj5CoF2dsmz SUDGQp1T58FiMgHarDW4G2PkNniFM3v2bCTl8FZ/t5DX+MCeuw7Mjb3JePhxoNMzi5KbYZvT hPI4AH5wPPRcB8lRIdRPmYX82QdhQ0kdwmNfOM01r9Y3wV59BcYPlAJYZjAKe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JLT7EaAr0 20RmKdHkfGACySuJNzQ1NLewNDQ3Njc2s1AS5z1vUBklJJCeWJKanZpakFoE08fEwSnVwMjG P6ds+ZyokxYe69KObWxfsKayccvKX0IKtxxS7hvyhH75bq19srTngbyRoHbnpVbx7vBUVp3c mzJmy06nmLEE9l52Krh2ZBGHzrHP7WanpPkMcv/INEX8mfLyxqWKnwk1O0qWpgto69ev7ni+ ZXe8m0sld876bdOMd3mxlc5u/CA3r6LsvxJLcUaioRZzUXEiAAPk5w7oAgAA X-CMS-MailID: 20190208081249eucas1p16730dd936643c8880d1cf35efdb68ec5 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 Viresh, On 2019-02-08 07:49, Viresh Kumar wrote: > On 07-02-19, 13:22, Marek Szyprowski wrote: >> 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. CPUfreq is suspended very early during system suspend and thus it does nothing when CPUs are being offlined. > 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. cpufreq is still in suspended state (it is being 'resume' very late in the system resume procedure), so if driver doesn't explicitly change any opp in ->init(), then cpufreq core waits until everything is resumed. To sum up, this seems to be fine, beside the issue with regulator initialization I've addressed in this patchset. > We guarantee that the resources are available during probe but not > during resume, that's where the problem is. Yes, so I've changed cpufreq-dt to the common approach, in which the driver keeps all needed resources for the whole lifetime of the device. > @Rafael any suggestions on how to fix this ? Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland