Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3427295pxt; Tue, 10 Aug 2021 03:28:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcLmr9QbnlWwZokFIkFQhtD2luS7+89mCvA9yiXWw3N/H2fm2o9Vz5PmvovfOPnOTxQrEi X-Received: by 2002:aa7:c45a:: with SMTP id n26mr4219435edr.218.1628591302044; Tue, 10 Aug 2021 03:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628591302; cv=none; d=google.com; s=arc-20160816; b=pSlRlYx1EvkjvwRqbhdYL1/snneyva6A0WAWrrB2HCp62O6zdSc95ljnrCXsyO2nf7 Avc02Pw5TiivW9cUypA1L0rnlwhnEKepoS+XHI0I34rjzyZ0ZfQkgWPJHppaQM2AUOXP OJn3uLHFOAnAwnYnsFgts50pxv03bq7S1BlPLf3fnJqBqI4rK6aOXEYBKoKrO7vl+pkG 7+qxzIXbUMufiodZI5dyVs2Ap4nrCMmbnOe8wds1ACgWoZN1DTi4+F58aie7UbTX0t8a aOGL7bBCQZD9+UuJy5AyQID8Ohm9lI5qxS+JqLbuM1AJcUQPW7n2sAFPxvUtDJkeMPeV IQMQ== 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=bwr4d58eD2Tzhlzn4TyYH4EO3kW9EhDTiWqHEHgx+cw=; b=uPmoNzafR8fx6iZJyEkQM6zs53c4TAylzEQFqfgDaaamE8vr1zV6jGBbFgEnTXb1GH 5WFbKrpZ/PfB11GgzDknXT+EK1DqlQjyrkqB4TfI9CWwxZtyXoCE7xak82nhzFF47JTx dsulZfnavlibvn/WMwAtDXpdNYF0c1jDlc+SdFtq8NYOPqe51y2Z+uBPijeR+OTFP/Wc oxWD9qEh/Ot67SFd3Ce+ysgJGLKiEkxjsfBavJzDYKjQuTw1y/xYtmK2jxbuOsV+kQFH n/36XLPm+7/s46QY3SrKmIHJaGrOcqIlVYDplMHslaWPoKmpZND7Z8NVu/1HNrWusA/3 F6DA== 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 de56si20079349ejc.111.2021.08.10.03.27.54; Tue, 10 Aug 2021 03:28:22 -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 S239155AbhHJJfu (ORCPT + 99 others); Tue, 10 Aug 2021 05:35:50 -0400 Received: from foss.arm.com ([217.140.110.172]:52084 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234188AbhHJJft (ORCPT ); Tue, 10 Aug 2021 05:35:49 -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 DF9611063; Tue, 10 Aug 2021 02:35:26 -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 5F9EB3F718; Tue, 10 Aug 2021 02:35:22 -0700 (PDT) Subject: Re: [PATCH 0/8] cpufreq: Auto-register with energy model To: Viresh Kumar Cc: Andy Gross , Rafael Wysocki , Vincent Donnefort , 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: <6449a61f-a5fc-0b81-65b2-7bf77b8a71aa@arm.com> <20210810092705.ctf43hwhzdepmcrv@vireshk-i7> From: Lukasz Luba Message-ID: <765a5fd5-1109-1af1-b339-624561070890@arm.com> Date: Tue, 10 Aug 2021 10:35:21 +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: <20210810092705.ctf43hwhzdepmcrv@vireshk-i7> 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 10:27 AM, Viresh Kumar wrote: > On 10-08-21, 10:17, Lukasz Luba wrote: >> Hi Viresh, >> >> I like the idea, only small comments here in the cover letter. >> >> On 8/10/21 8:36 AM, Viresh Kumar wrote: >>> Provide a cpufreq driver flag so drivers can ask the cpufreq core to register >>> with the EM core on their behalf. 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. >> >> The EM is never freed for CPUs by design. The unregister function was >> introduced for devfreq devices. > > I see. So if a cpufreq driver unregisters and registers again, it will > be required to use the entries created by the registration itself, > right ? Technically speaking, it is better to unregister and free any > related resources and parse everything again. > > Lets say, just for fun, I want to test two copies of a cpufreq driver It's good that it's just for fun ;) > (providing different set of freq-tables). I build both of them as > modules, insert the first version, remove it, insert the second one. > Ideally, this should just work as expected. But I don't think it will > in this case as you never parse the EM stuff again. The EM is directly used by scheduler in the hot-path, there are no checks even if the EM if for CPUs. We are sure it's is for CPUs and is always there for all CPUs. I'm currently working on a EM v2 which would have stronger mechanisms and do better job in this field. The patches are under internal review and hopefully ready to post by the end of month. > > Again, since the routine is there already, I think it is better/fine > to just use it. True, it doesn't harm, so I commented it in the patch 1/8 that it could stay. > >>> 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. >> >> The scmi cpufreq driver uses direct EM API, which provides flexibility >> and should stay as is. > > Right, so I left it as is for now. >