Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp417648ybv; Thu, 13 Feb 2020 03:01:29 -0800 (PST) X-Google-Smtp-Source: APXvYqx8hqOceIghpRhfmPZYwQa5QrURC/6ZOtk+iWyYxNh9H2DuHyKS2c1wocz12bwS5OyEMJ+I X-Received: by 2002:aca:1011:: with SMTP id 17mr2553695oiq.72.1581591689068; Thu, 13 Feb 2020 03:01:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581591689; cv=none; d=google.com; s=arc-20160816; b=aYLhOKVfSDPHd+8CgS4WQXYFv0zbQ0/yR7CCt20l50URc3rDuo8VNuPl6Nag9yf2zi Ca4U9k1yU2jJ2Y+yK+LyIS3v1HIcA/N/ftVVifYliIjPHr/Z6H5/5JSAZfvy3STq5ZwC aPwKhChEkoDYxnaIfABEWy4kWbURlSl90IVYoSdIbN87HrW5LPnXaQvKG0ok7/vJ6af5 LxiXzycUPOPNtQmm6tXu4YU1yCJAaJOVHqwVxkdHTJh0/mN/kekzXIn/F+RSptz5r9oj mIeJ912vXn088hmOqI7Iiqa1cwdEEc+zu1XsefWNa5UTu0vrNe+Ox4jjM4G3Ggk8eFDz dIyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=MKEcM+er6Uv4LTqVrOU+6nzDAP9uqUKzxiP/GJbunM8=; b=WO9BZfBwU6boPJWzJZNKUxupWmFIX0A3FiesKcZp4y2Jep7TUxwLqld2n0VC85fiUa tP86i8w28xQSwOKY09Jl8eMwohXodh26jRBTG3/6ETN5Zimj4RAndJkg/4hGX4E3urNH /gFKB5tXmTBGnm2i4iAdpF31PjHWEfypa8cJpraO78swKJITD5pCOzuAv01cX6F/7uAz FgRUKjHVm7pQMgT9yUlgVp32D0vdq+6STNyKliYBW2m5/a5xWn4ZiyymxmzFLB6ze0SC PFzJEMdeIVymRC77nS9v4/p8TUgL7sS9QcozHlifm2Gal4uAw3CV6Qwup+inw11SBbVq PROw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si949980oij.139.2020.02.13.03.01.16; Thu, 13 Feb 2020 03:01:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729794AbgBMLAI (ORCPT + 99 others); Thu, 13 Feb 2020 06:00:08 -0500 Received: from foss.arm.com ([217.140.110.172]:44918 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgBMLAI (ORCPT ); Thu, 13 Feb 2020 06:00:08 -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 46A8F1FB; Thu, 13 Feb 2020 03:00:07 -0800 (PST) Received: from [192.168.0.7] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 875E83F6CF; Thu, 13 Feb 2020 03:00:00 -0800 (PST) Subject: Re: [PATCH v2 1/4] PM / EM: add devices to Energy Model To: lukasz.luba@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-imx@nxp.com Cc: Morten.Rasmussen@arm.com, Chris.Redpath@arm.com, ionela.voinescu@arm.com, javi.merino@arm.com, cw00.choi@samsung.com, b.zolnierkie@samsung.com, rjw@rjwysocki.net, sudeep.holla@arm.com, viresh.kumar@linaro.org, nm@ti.com, sboyd@kernel.org, rui.zhang@intel.com, amit.kucheria@verdurent.com, daniel.lezcano@linaro.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, qperret@google.com, bsegall@google.com, mgorman@suse.de, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, kernel@pengutronix.de, khilman@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org, robh@kernel.org, matthias.bgg@gmail.com, steven.price@arm.com, tomeu.vizoso@collabora.com, alyssa.rosenzweig@collabora.com, airlied@linux.ie, daniel@ffwll.ch, liviu.dudau@arm.com, lorenzo.pieralisi@arm.com, patrick.bellasi@matbug.net References: <20200206134640.11367-1-lukasz.luba@arm.com> <20200206134640.11367-2-lukasz.luba@arm.com> From: Dietmar Eggemann Message-ID: <62a54ec9-0491-367d-0a36-7ea32c449acc@arm.com> Date: Thu, 13 Feb 2020 11:59:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200206134640.11367-2-lukasz.luba@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/02/2020 14:46, lukasz.luba@arm.com wrote: > From: Lukasz Luba [..] > @@ -26,7 +28,7 @@ framework, and interested clients reading the data from it:: s/::/: ? > | Thermal (IPA) | | Scheduler (EAS) | | Other | > +---------------+ +-----------------+ +---------------+ > | | em_pd_energy() | > - | | em_cpu_get() | > + | em_get_pd() | em_cpu_get() | > +---------+ | +---------+ em_get_pd() and em_cpu_get()? Why not em_pd_get()? em_cpu_get() is a specific em_get_pd(). right? [...] > @@ -85,13 +89,20 @@ API. > 2.3 Accessing performance domains > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > +There is two API functions which provide the access to the energy model: > +em_cpu_get() which takes CPU id as an argument and em_get_pd() with device > +pointer as an argument. It depends on the subsystem which interface it is > +going to use, but in case of CPU devices both functions return the same > +performance domain. There is probably a reason why we need this specific function for CPU devices? The reason should be described. People might ask why em_get_pd() is not sufficient. [...] > - * A "performance domain" represents a group of CPUs whose performance is > - * scaled together. All CPUs of a performance domain must have the same > - * micro-architecture. Performance domains often have a 1-to-1 mapping with > - * CPUFreq policies. > + * In case of CPU device, a "performance domain" represents a group of CPUs > + * whose performance is scaled together. All CPUs of a performance domain > + * must have the same micro-architecture. Performance domains often have > + * a 1-to-1 mapping with CPUFreq policies. > + * In case of other devices the 'priv' field is unused. > */ > struct em_perf_domain { > - struct em_cap_state *table; > - int nr_cap_states; > - unsigned long cpus[0]; > + struct em_perf_state *table; > + int nr_perf_states; > + void *priv; In case you go back to the variable length field plus type field to distingush EM devices, keep cpus[0] as the name. [..] > /** > - * em_pd_energy() - Estimates the energy consumed by the CPUs of a perf. domain > + * em_pd_energy() - Estimates the energy consumed by the CPUs of a perf. > + domain Why this change? [...] > @@ -141,12 +210,12 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states, > */ > opp_eff = freq / power; > if (opp_eff >= prev_opp_eff) > - pr_warn("pd%d: hertz/watts ratio non-monotonically decreasing: em_cap_state %d >= em_cap_state%d\n", > - cpu, i, i - 1); > + dev_warn(dev, "energy_model: hertz/watts ratio non-monotonically decreasing: em_perf_state %d >= em_perf_state%d\n", s/energy_model/EM ? [...]