From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 699F6C4BA3C for ; Thu, 27 Feb 2020 08:13:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3DCB324687 for ; Thu, 27 Feb 2020 08:13:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DCB324687 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65E116EC12; Thu, 27 Feb 2020 08:13:11 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 209266E431 for ; Wed, 26 Feb 2020 10:07:07 +0000 (UTC) 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 9830B1FB; Wed, 26 Feb 2020 02:07:06 -0800 (PST) Received: from [10.37.12.169] (unknown [10.37.12.169]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D265E3F9E6; Wed, 26 Feb 2020 02:06:56 -0800 (PST) Subject: Re: [PATCH v3 4/4] drm/panfrost: Register to the Energy Model with devfreq device To: Rob Herring References: <20200221194731.13814-1-lukasz.luba@arm.com> <20200221194731.13814-5-lukasz.luba@arm.com> From: Lukasz Luba Message-ID: <96d3287c-4559-7c4a-2f99-0a3aad9e42f6@arm.com> Date: Wed, 26 Feb 2020 10:06:55 +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: Content-Language: en-US X-Mailman-Approved-At: Thu, 27 Feb 2020 08:13:09 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , juri.lelli@redhat.com, Peter Zijlstra , Viresh Kumar , Liviu Dudau , dri-devel , Bjorn Andersson , bsegall@google.com, Alyssa Rosenzweig , Morten Rasmussen , patrick.bellasi@matbug.net, Amit Kucheria , Lorenzo Pieralisi , Vincent Guittot , Kevin Hilman , Andy Gross , Daniel Lezcano , Steven Price , Chanwoo Choi , Ingo Molnar , NXP Linux Team , Zhang Rui , mgorman@suse.de, orjan.eide@arm.com, "open list:THERMAL" , linux-arm-msm , Sascha Hauer , Steven Rostedt , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , linux-omap , Dietmar.Eggemann@arm.com, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , David Airlie , javi.merino@arm.com, Tomeu Vizoso , qperret@google.com, Stephen Boyd , "Rafael J. Wysocki" , "linux-kernel@vger.kernel.org" , Bartlomiej Zolnierkiewicz , Sascha Hauer , Sudeep Holla , Shawn Guo Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Rob, On 2/25/20 8:57 PM, Rob Herring wrote: > On Fri, Feb 21, 2020 at 1:48 PM Lukasz Luba wrote: >> >> Add device to the Energy Model framework. It will create a dedicated >> and unified data structures used i.e. in the thermal framework. >> The power model used in dev_pm_opp subsystem is simplified and created >> based on DT 'dynamic-power-coefficient', volatage and frequency. It is > > typo. I'll fix it. > >> similar to the CPU model used in Energy Aware Scheduler. >> >> Signed-off-by: Lukasz Luba >> --- >> drivers/gpu/drm/panfrost/panfrost_devfreq.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c >> index 413987038fbf..d527a5113950 100644 >> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c >> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c >> @@ -105,6 +105,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) >> } >> pfdev->devfreq.devfreq = devfreq; >> >> + dev_pm_opp_of_register_em(dev, NULL); > > Can't fail? Yes, it can fail but the function does not return anything. It can easily fail, it's looking for "dynamic-power-coefficient" in the device node. The DT binding for the devfreq devices would also be good to add.. I would have to probably change it into returning 'int' and modify all old cpufreq drivers. > >> + >> cooling = of_devfreq_cooling_register(dev->of_node, devfreq); >> if (IS_ERR(cooling)) >> DRM_DEV_INFO(dev, "Failed to register cooling device\n"); >> @@ -118,6 +120,7 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) >> { >> if (pfdev->devfreq.cooling) >> devfreq_cooling_unregister(pfdev->devfreq.cooling); >> + dev_pm_opp_of_unregister_em(&pfdev->pdev->dev); >> dev_pm_opp_of_remove_table(&pfdev->pdev->dev); > > Does it make sense to keep this (and the registration side) as > separate calls? Perhaps there's some ordering requirement with > everything between dev_pm_opp_of_add_table() and > dev_pm_opp_of_register_em()? Yes, dev_pm_opp_of_register_em() uses em_data_callback which operates on OPPs to calculate power values and costs, so the the OPP table should be already there. > > While you're just adding 2 lines, it seems there's a lot of complexity > exposed to the driver just to initialize devfreq/opp. It depends, for example devfreq devices like buses would likely never use the energy model. Potential clients would be GPUs, DSPs, ISPs. Could you help me with defining a DT binding for this "dynamic-power-coefficient" entry? It could be used in different types of devices. Should it be placed in each of these devices documentation file, or in some one common file? Thank you for your comments. Regards, Lukasz _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel