Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1421295pxb; Thu, 4 Mar 2021 10:49:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgGe9q7kscWNVi5B1PuFktcW6y9k45MN1rEvfCwAeBE0JIod2LC+4PV6dzxDNeLWk2ABoT X-Received: by 2002:a17:906:35cf:: with SMTP id p15mr5779282ejb.379.1614883751797; Thu, 04 Mar 2021 10:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614883751; cv=none; d=google.com; s=arc-20160816; b=bPS+W28x3ORcO3u3qaoXemEmv2Ofhwolf/gWiOkPynM9oWMYSgFTAuMTz4tvmuKOer iDTsavibWHLh1qLCv01cXYsnjOQ/yu+/Pf7OzQSkm35v7rw+1PGJoQ1pfhrZdpE/EXaJ rmlQ/9IVqX0aUTtVsltunuPLfg6U9y+cxV5S0uHGMv1LZ48C6dA0FUJvlRv5B/1Kx1Vf oySbrlLsKi5/Ss6G3r95DxwTJIElxrNXEssSLM2jN+Kd+HW3gjWFzKVHH7QFY3obxE7u Pql/pm50q4ir1j45XTR82SGqZAqgqhh0lzHi+8kIQeQRrAHB9KI0Wq+4ru0D1f34aWcY 6wxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=XHTiMwwnGTr4oHAFfPAplJhFqt/Exsw9k3c36+MePsQ=; b=Yu/T9xvD6phhCoHxmySDPftOY7KhlyswqP9AdL5c8dGsFDNsWk1Hy7LZvdumEmUZ2X V9JfP6Rqk0sK3sqSPcs2DDdAlXSzrO6LAUBeN+yJlkLQS1h4XwtaHMT/GxPDYJPbVkx0 sBoRQX5Hgejn0/wCmuBqyyNv/tSDBpm3vG2hDJKI9BV/mAhvtTleWZ/DWRm9HXdQb16o M0CeR87s3VAArIDse3o4jFpneGeoQHvYfVyGnwTE0pYk9jhSSi2Lf/St6QeIfEGGkb1F HPf9JeIu/qaKPeaoPfZq+nPifAuHUNoEzn1z9ZlsaskZfRR3qe5fjc5kYvibn8MdZUW8 O+zQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si170313eds.530.2021.03.04.10.48.49; Thu, 04 Mar 2021 10:49:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239114AbhCDRN4 (ORCPT + 99 others); Thu, 4 Mar 2021 12:13:56 -0500 Received: from foss.arm.com ([217.140.110.172]:41858 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239072AbhCDRNZ (ORCPT ); Thu, 4 Mar 2021 12:13:25 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6110231B; Thu, 4 Mar 2021 09:12:38 -0800 (PST) Received: from [10.57.19.206] (unknown [10.57.19.206]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 427663F7D7; Thu, 4 Mar 2021 09:12:34 -0800 (PST) Subject: Re: [PATCH] devfreq: Register devfreq as a cooling device To: Daniel Lezcano Cc: cwchoi00@gmail.com, kyungmin.park@samsung.com, myungjoo.ham@samsung.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chanwoo Choi , Qiang Yu , David Airlie , Daniel Vetter , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , "open list:DRM DRIVERS FOR LIMA" , "moderated list:DRM DRIVERS FOR LIMA" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR MSM ADRENO GPU" References: <20210304125034.28404-1-daniel.lezcano@linaro.org> <5f06e0c5-b2d9-5e11-01b6-fdd0dac635a7@arm.com> <8d153937-c5fc-1de2-d510-d3f91f7a9724@linaro.org> From: Lukasz Luba Message-ID: <71bc8b07-ea0e-17a9-8c7f-d20669e9da12@arm.com> Date: Thu, 4 Mar 2021 17:12:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <8d153937-c5fc-1de2-d510-d3f91f7a9724@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/4/21 4:53 PM, Daniel Lezcano wrote: > > Hi Lukasz, > > thanks for commenting this patch, > > On 04/03/2021 14:47, Lukasz Luba wrote: >> Hi Daniel, >> >> On 3/4/21 12:50 PM, Daniel Lezcano wrote: >>> Currently the default behavior is to manually having the devfreq >>> backend to register themselves as a devfreq cooling device. >>> >>> There are no so many and actually it makes more sense to register the >>> devfreq device when adding it. >>> >>> Consequently, every devfreq becomes a cooling device like cpufreq is. >>> >>> Having a devfreq being registered as a cooling device can not mitigate >>> a thermal zone if it is not bound to this one. Thus, the current >>> configurations are not impacted by this change. >> >> There are also different type of devices, which register into devfreq >> framework like NoC buses, UFS/eMMC, jpeg and video accelerators, ISP, >> etc. >> In some platforms there are plenty of those devices and they all would >> occupy memory due to private freq_table in devfreq_cooling, function: >> devfreq_cooling_gen_tables(). >> >> IIRC in OdroidXU4 there are ~20 devfreq devs for NoC buses. > > I'm curious, do you have a pointer to such kernels having all those > devfreq ? Sure, it's mainline code, you can build it with exynos_defconfig. You can check the DT files to find them arch/arm/boot/dts/exynos*. (this particular OdroidXU4 is Exynos5422, but it grabs some generic dt files). Here is the mainline kernel content of /sys/class/devfreq/ ---------------------------------------------------------- sys/class/devfreq / 10c20000.memory-controller soc:bus-g2d soc:bus-mfc 11800000.gpu soc:bus-g2d-acp soc:bus-mscl soc:bus-disp1 soc:bus-gen soc:bus-noc soc:bus-disp1-fimd soc:bus-gscl-scaler soc:bus-peri soc:bus-fsys-apb soc:bus-jpeg soc:bus-wcore soc:bus-fsys2 soc:bus-jpeg-apb ---------------------------------------------------------- IIRC some Odroid kernel maintained by Hardkernel had more devices in this dir. Here is how these bus devices print themselves during boot: ---------------------------------------------------------- [ 8.674840] exynos-bus: new bus device registered: soc:bus-wcore ( 88700 KHz ~ 532000 KHz) [ 8.686412] exynos-bus: new bus device registered: soc:bus-noc ( 66600 KHz ~ 111000 KHz) [ 8.696080] exynos-bus: new bus device registered: soc:bus-fsys-apb (111000 KHz ~ 222000 KHz) [ 8.706590] exynos-bus: new bus device registered: soc:bus-fsys2 ( 75000 KHz ~ 200000 KHz) [ 8.717661] exynos-bus: new bus device registered: soc:bus-mfc ( 83250 KHz ~ 333000 KHz) [ 8.728139] exynos-bus: new bus device registered: soc:bus-gen ( 88700 KHz ~ 266000 KHz) [ 8.737551] exynos-bus: new bus device registered: soc:bus-peri ( 66600 KHz ~ 66600 KHz) [ 8.748625] exynos-bus: new bus device registered: soc:bus-g2d ( 83250 KHz ~ 333000 KHz) [ 8.759427] exynos-bus: new bus device registered: soc:bus-g2d-acp ( 66500 KHz ~ 266000 KHz) [ 8.770366] exynos-bus: new bus device registered: soc:bus-jpeg ( 75000 KHz ~ 300000 KHz) [ 8.781135] exynos-bus: new bus device registered: soc:bus-jpeg-apb ( 83250 KHz ~ 166500 KHz) [ 8.791366] exynos-bus: new bus device registered: soc:bus-disp1-fimd (120000 KHz ~ 200000 KHz) [ 8.802418] exynos-bus: new bus device registered: soc:bus-disp1 (120000 KHz ~ 300000 KHz) [ 8.813050] exynos-bus: new bus device registered: soc:bus-gscl-scaler (150000 KHz ~ 300000 KHz) [ 8.825308] exynos-bus: new bus device registered: soc:bus-mscl ( 84000 KHz ~ 666000 KHz) ---------------------------------------------------------- > >> It's true that they will not affect thermal zones, but unnecessarily, >> they all will show up in the /sys/class/thermal/ as >> thermal-devfreq-X >> >> >> IMO the devfreq shouldn't be tight with devfreq cooling thermal. > > The energy model is tied with a cooling device initialization. > > So if we want to do power limitation, the energy model must be > initialized with the device, thus the cooling device also. > > That is the reason why I'm ending up with this change. Chanwoo > suggestion makes sense and that will allow to move the initialization to > devfreq which is more sane but it does not solve the initial problem > with the energy model. Make sense, the 'is_cooling_device' does the job. Regards, Lukasz