Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3710119pxt; Tue, 10 Aug 2021 09:33:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIIUBHmdJekToK9fKP1N1SLLuYPsLyLuXqUEbv0M4xS5QLmPc1Y8AJye3WI+7hMil+Ftq7 X-Received: by 2002:a92:6f0a:: with SMTP id k10mr555174ilc.105.1628613186742; Tue, 10 Aug 2021 09:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628613186; cv=none; d=google.com; s=arc-20160816; b=Xrf425+CrJcV3mubb9q1q0NdENIMaUCARWyc+6VuaCJt7oc5xCciGh8AWjxEAIl12v OrlSTJ6cmSQv8yEIQ8/No5EAzJYMEhxCZsQXteEi+bwu6QhPrQTyvvNvjz1s9lCwRrlm ErVfnCZ9NZRV41YqMpp30i+J4dhaThE3m+HQXCgbPITk97+cMEhbMMO29ffYZ0ARKFCN o5dUSSM0p29IqpFxH3ahCpGZMmbJl79zkifh8XXtL06Q80uW/JdBzOp5g95Zn0L0h/+V r7m3G+qmnnu6b8bibgpTevBkKmpSvzVKaiGr9AGKN3cjS6ORFEPoMCS/MUEScYMmjju1 avCw== 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=qA5eR6Lv7s2kMF3vHtbBg1oyffntMK/ehCQF3DK6W54=; b=jurPgQRIME3hIDr3tI8KrirvIkbNAACrJVXRUmAPzMZGGh3tiUV59ucsrKMCDm8gE8 McAfZnuAUgAJ4LAQKYJge5Jtv8gyM4aFnRgQClc7CnrKMV39HbaMJfT/shXNnGQR8QiD maVLTuzb+gJtNJkzlcha6HbVgrwl4v0WMwETOxtuY9qavsLNNQpyzh4HwsmzauDXzj7P 3Bg95PkTMMI8j8/MkQ97bIKGHiB4SLZvcnK9EUwj/Q0Nc2qz2bHWlYfKknVOOjCvByqv /tzxxopDw6qqiJCUb6VV8UUvm+jWgKZaDBK1LCllkxT0VLLrsGp5i/qeRHNjjLQJJpxU dQPw== 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 y17si3343950ila.114.2021.08.10.09.32.53; Tue, 10 Aug 2021 09:33:06 -0700 (PDT) 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 S241401AbhHJN0F (ORCPT + 99 others); Tue, 10 Aug 2021 09:26:05 -0400 Received: from foss.arm.com ([217.140.110.172]:55352 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241448AbhHJNZn (ORCPT ); Tue, 10 Aug 2021 09:25:43 -0400 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 350041FB; Tue, 10 Aug 2021 06:25:21 -0700 (PDT) Received: from [10.57.9.181] (unknown [10.57.9.181]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8EF013F70D; Tue, 10 Aug 2021 06:25:16 -0700 (PDT) Subject: Re: [PATCH 0/8] cpufreq: Auto-register with energy model To: Quentin Perret Cc: Viresh Kumar , Rafael Wysocki , Vincent Donnefort , Andy Gross , Bjorn Andersson , Cristian Marussi , Fabio Estevam , Kevin Hilman , Matthias Brugger , NXP Linux Team , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Sudeep Holla , linux-pm@vger.kernel.org, Vincent Guittot , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-omap@vger.kernel.org References: From: Lukasz Luba Message-ID: Date: Tue, 10 Aug 2021 14:25:15 +0100 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: 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 8/10/21 1:35 PM, Quentin Perret wrote: > On Tuesday 10 Aug 2021 at 13:06:47 (+0530), Viresh Kumar wrote: >> Provide a cpufreq driver flag so drivers can ask the cpufreq core to register >> with the EM core on their behalf. > > Hmm, that's not quite what this does. This asks the cpufreq core to > use *PM_OPP* to register an EM, which I think is kinda wrong to do from > there IMO. The decision to use PM_OPP or another mechanism to register > an EM belongs to platform specific code (drivers), so it is odd for the > PM_OPP registration to have its own cpufreq flag but not the other ways. > > As mentioned in another thread, the very reason to have PM_EM is to not > depend on PM_OPP, so I'm worried about the direction of travel with this > series TBH. > >> This allows us to get rid of duplicated code >> in the drivers and fix the unregistration part as well, which none of the >> drivers have done until now. > > This series adds more code than it removes, and the unregistration is > not a fix as we don't ever remove the EM tables by design, so not sure > either of these points are valid arguments. > >> This would also make the registration with EM core to happen only after policy >> is fully initialized, and the EM core can do other stuff from in there, like >> marking frequencies as inefficient (WIP). Though this patchset is useful without >> that work being done and should be merged nevertheless. >> >> This doesn't update scmi cpufreq driver for now as it is a special case and need >> to be handled differently. Though we can make it work with this if required. > > Note that we'll have more 'special cases' if other architectures start > using PM_EM, which is what we have been trying to allow since the > beginning, so that's worth keeping in mind. > The way I see this is that the flag in cpufreq avoids mistakes potentially made by driver developer. It will automaticaly register the *simple* EM model via dev_pm_opp_of_register_em() on behalf of drivers (which is already done manually by drivers). The developer would just set the flag similarly to CPUFREQ_IS_COOLING_DEV and be sure it will register at the right time. Well tested flag approach should be safer, easier to understand, maintain. If there is a need for *advanced* EM model, driver developer would have to care about all these things (order, setup-ready-structures, fw channels, freeing, etc) while developing custom registration. The developer won't set this flag in such case, so the core won't try to auto register the EM for that driver. I don't see the dependency of PM_EM on PM_OPP in this series.