Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1333482 > unrolled thread

Regard of thermal power allocator's coefficients

Started byLeo Yan <leo.yan@linaro.org>
First post2016-02-14 12:10 +0100
Last post2016-02-19 10:10 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  Regard of thermal power allocator's coefficients Leo Yan <leo.yan@linaro.org> - 2016-02-14 12:10 +0100
    Re: Regard of thermal power allocator's coefficients Eduardo Valentin <edubezval@gmail.com> - 2016-02-14 18:20 +0100
      Re: Regard of thermal power allocator's coefficients Leo Yan <leo.yan@linaro.org> - 2016-02-15 05:50 +0100
        Re: Regard of thermal power allocator's coefficients Javi Merino <javi.merino@arm.com> - 2016-02-18 16:20 +0100
          Re: Regard of thermal power allocator's coefficients Leo Yan <leo.yan@linaro.org> - 2016-02-19 10:10 +0100

#1333482 — Regard of thermal power allocator's coefficients

FromLeo Yan <leo.yan@linaro.org>
Date2016-02-14 12:10 +0100
SubjectRegard of thermal power allocator's coefficients
Message-ID<r22IW-1QV-19@gated-at.bofh.it>
Hi there,

I'm trying to upstreaming IPA patches for 96board Hikey, but so far
there have no standard DT binding for passing IPA coefficients for
power modeling.

So want to firstly to confirm if should we pass coefficients by using
device tree? Is someone working on related work for this?

Here has another more straightforward method is to directly to
include power model's coefficients in thermal sensor driver (such like
drivers/thermal/hisi_thermal.c), but my concern is this method will
include SoC specific data in the common thermal sensor driver,
so is this doable?

Welcome any suggestion.

Thanks,
Leo Yan

[toc] | [next] | [standalone]


#1333523

FromEduardo Valentin <edubezval@gmail.com>
Date2016-02-14 18:20 +0100
Message-ID<r28v0-5Ho-1@gated-at.bofh.it>
In reply to#1333482
Hello Leo,

On Sun, Feb 14, 2016 at 07:00:41PM +0800, Leo Yan wrote:
> Hi there,
> 
> I'm trying to upstreaming IPA patches for 96board Hikey, but so far
> there have no standard DT binding for passing IPA coefficients for
> power modeling.

Thanks for your effort.

> 
> So want to firstly to confirm if should we pass coefficients by using
> device tree? Is someone working on related work for this?

We pass the sustainable power, but not the coefficients. IIRC, the IPA
coefficients were considered (SW) implementation details. Sustainable power,
on the other hand, still describes hardware capabilities.

So, I don't think they will go via DT.

> 
> Here has another more straightforward method is to directly to
> include power model's coefficients in thermal sensor driver (such like
> drivers/thermal/hisi_thermal.c), but my concern is this method will
> include SoC specific data in the common thermal sensor driver,
> so is this doable?

Yeah, unless you are sure that these coefficients are SoC dependent, and
not board dependent, for instance, (or even, use case dependent), I
would prefer you do not leave them configured in the driver.

Keep in mind that power allocator will compute defaults.

Also, userspace software may also tune these parameters, per thermal
zone.

> 
> Welcome any suggestion.
> 
> Thanks,
> Leo Yan

BR,

Eduardo Valentin

[toc] | [prev] | [next] | [standalone]


#1334142

FromLeo Yan <leo.yan@linaro.org>
Date2016-02-15 05:50 +0100
Message-ID<r2jgK-4ln-5@gated-at.bofh.it>
In reply to#1333523
Hi Eduardo,

Thanks for replying.

On Sun, Feb 14, 2016 at 09:12:19AM -0800, Eduardo Valentin wrote:
> On Sun, Feb 14, 2016 at 07:00:41PM +0800, Leo Yan wrote:

[...]

> > So want to firstly to confirm if should we pass coefficients by using
> > device tree? Is someone working on related work for this?
> 
> We pass the sustainable power, but not the coefficients. IIRC, the IPA
> coefficients were considered (SW) implementation details. Sustainable power,
> on the other hand, still describes hardware capabilities.
> 
> So, I don't think they will go via DT.

I'd like clarify one thing: "coefficients" are used to calculate
static leakage and dynamic power but not PID's term constants. They
are quite dependent on silicon's process; this is similiar with
sustainable power. So do you think we should take these "coefficients"
as software paramters?

The code is written in drivers/thermal/hisi_thermal.c like below:

---8<---

struct cluster_power_coefficients cluster_data = {
	.dyn_coeff      = 266,
	.static_cpu     = 14,
	.static_cluster = 5,
};

/* voltage in uV and temperature in mC */
static int get_static_power(cpumask_t *cpumask, int interval,
		unsigned long u_volt, u32 *power)
{
	int nr_cpus = cpumask_weight(cpumask);

	*power  = nr_cpus * cluster_data.static_cpu;
	*power += 2 * cluster_data.static_cluster;

	return 0;
}

static int hisi_thermal_register_cooling_device(struct platform_device *pdev,
						struct hisi_thermal_data *data)
{
	struct device_node *np;

	np = of_find_node_by_name(NULL, "cluster0");
	if (!np) {
		dev_err(&pdev->dev, "Cluster0 node not founds\n");
		return -ENODEV;
	}

	data->cdevs = of_cpufreq_power_cooling_register(np,
			cpu_present_mask, cluster_data.dyn_coeff,
			get_static_power);
	if (IS_ERR(data->cdevs)) {
		dev_err(&pdev->dev,
			"Error registering cooling device: %ld\n",
			PTR_ERR(data->cdevs));
		return PTR_ERR(data->cdevs);
	}

	return 0;
}

Thanks,
Leo Yan

[toc] | [prev] | [next] | [standalone]


#1337457

FromJavi Merino <javi.merino@arm.com>
Date2016-02-18 16:20 +0100
Message-ID<r3yx4-7uQ-21@gated-at.bofh.it>
In reply to#1334142
Hi Leo,

On Mon, Feb 15, 2016 at 12:47:51PM +0800, Leo Yan wrote:
> Hi Eduardo,
> 
> Thanks for replying.
> 
> On Sun, Feb 14, 2016 at 09:12:19AM -0800, Eduardo Valentin wrote:
> > On Sun, Feb 14, 2016 at 07:00:41PM +0800, Leo Yan wrote:
> 
> [...]
> 
> > > So want to firstly to confirm if should we pass coefficients by using
> > > device tree? Is someone working on related work for this?
> > 
> > We pass the sustainable power, but not the coefficients. IIRC, the IPA
> > coefficients were considered (SW) implementation details. Sustainable power,
> > on the other hand, still describes hardware capabilities.
> > 
> > So, I don't think they will go via DT.
> 
> I'd like clarify one thing: "coefficients" are used to calculate
> static leakage and dynamic power but not PID's term constants. They
> are quite dependent on silicon's process; this is similiar with
> sustainable power. So do you think we should take these "coefficients"
> as software paramters?

For the dynamic power coefficient there is a binding in the cpu node
of DT, see Documentation/devicetree/bindings/arm/cpus.txt [0].  If you
use the cpufreq-dt driver, it will be registered automatically for
you.

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/arm/cpus.txt#n249

For static, sadly we don't have anything currently and as far as I'm
aware nobody is working on it.  The main problem with static power is
that there is no single formula that applies for different SoCs.
That's why we left it as a function pointer.

HTH,
Javi

> The code is written in drivers/thermal/hisi_thermal.c like below:
> 
> ---8<---
> 
> struct cluster_power_coefficients cluster_data = {
> 	.dyn_coeff      = 266,
> 	.static_cpu     = 14,
> 	.static_cluster = 5,
> };
> 
> /* voltage in uV and temperature in mC */
> static int get_static_power(cpumask_t *cpumask, int interval,
> 		unsigned long u_volt, u32 *power)
> {
> 	int nr_cpus = cpumask_weight(cpumask);
> 
> 	*power  = nr_cpus * cluster_data.static_cpu;
> 	*power += 2 * cluster_data.static_cluster;
> 
> 	return 0;
> }
> 
> static int hisi_thermal_register_cooling_device(struct platform_device *pdev,
> 						struct hisi_thermal_data *data)
> {
> 	struct device_node *np;
> 
> 	np = of_find_node_by_name(NULL, "cluster0");
> 	if (!np) {
> 		dev_err(&pdev->dev, "Cluster0 node not founds\n");
> 		return -ENODEV;
> 	}
> 
> 	data->cdevs = of_cpufreq_power_cooling_register(np,
> 			cpu_present_mask, cluster_data.dyn_coeff,
> 			get_static_power);
> 	if (IS_ERR(data->cdevs)) {
> 		dev_err(&pdev->dev,
> 			"Error registering cooling device: %ld\n",
> 			PTR_ERR(data->cdevs));
> 		return PTR_ERR(data->cdevs);
> 	}
> 
> 	return 0;
> }
> 
> Thanks,
> Leo Yan
> 

[toc] | [prev] | [next] | [standalone]


#1338004

FromLeo Yan <leo.yan@linaro.org>
Date2016-02-19 10:10 +0100
Message-ID<r3Pey-2KN-9@gated-at.bofh.it>
In reply to#1337457
Hi Javi,

On Thu, Feb 18, 2016 at 03:19:26PM +0000, Javi Merino wrote:
> On Mon, Feb 15, 2016 at 12:47:51PM +0800, Leo Yan wrote:

[...]

> > > > So want to firstly to confirm if should we pass coefficients by using
> > > > device tree? Is someone working on related work for this?
> > > 
> > > We pass the sustainable power, but not the coefficients. IIRC, the IPA
> > > coefficients were considered (SW) implementation details. Sustainable power,
> > > on the other hand, still describes hardware capabilities.
> > > 
> > > So, I don't think they will go via DT.
> > 
> > I'd like clarify one thing: "coefficients" are used to calculate
> > static leakage and dynamic power but not PID's term constants. They
> > are quite dependent on silicon's process; this is similiar with
> > sustainable power. So do you think we should take these "coefficients"
> > as software paramters?
> 
> For the dynamic power coefficient there is a binding in the cpu node
> of DT, see Documentation/devicetree/bindings/arm/cpus.txt [0].  If you
> use the cpufreq-dt driver, it will be registered automatically for
> you.
> 
> [0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/arm/cpus.txt#n249
> 
> For static, sadly we don't have anything currently and as far as I'm
> aware nobody is working on it.  The main problem with static power is
> that there is no single formula that applies for different SoCs.
> That's why we left it as a function pointer.

Thanks for pointing out; I recognized Punit has committed patch for
dynamic coefficient finally.

So far we also simplize power model on Hikey with only dynamic
coefficient, later will send out patch for review.

Thanks,
Leo Yan

> 
> HTH,
> Javi
> 
> > The code is written in drivers/thermal/hisi_thermal.c like below:
> > 
> > ---8<---
> > 
> > struct cluster_power_coefficients cluster_data = {
> > 	.dyn_coeff      = 266,
> > 	.static_cpu     = 14,
> > 	.static_cluster = 5,
> > };
> > 
> > /* voltage in uV and temperature in mC */
> > static int get_static_power(cpumask_t *cpumask, int interval,
> > 		unsigned long u_volt, u32 *power)
> > {
> > 	int nr_cpus = cpumask_weight(cpumask);
> > 
> > 	*power  = nr_cpus * cluster_data.static_cpu;
> > 	*power += 2 * cluster_data.static_cluster;
> > 
> > 	return 0;
> > }
> > 
> > static int hisi_thermal_register_cooling_device(struct platform_device *pdev,
> > 						struct hisi_thermal_data *data)
> > {
> > 	struct device_node *np;
> > 
> > 	np = of_find_node_by_name(NULL, "cluster0");
> > 	if (!np) {
> > 		dev_err(&pdev->dev, "Cluster0 node not founds\n");
> > 		return -ENODEV;
> > 	}
> > 
> > 	data->cdevs = of_cpufreq_power_cooling_register(np,
> > 			cpu_present_mask, cluster_data.dyn_coeff,
> > 			get_static_power);
> > 	if (IS_ERR(data->cdevs)) {
> > 		dev_err(&pdev->dev,
> > 			"Error registering cooling device: %ld\n",
> > 			PTR_ERR(data->cdevs));
> > 		return PTR_ERR(data->cdevs);
> > 	}
> > 
> > 	return 0;
> > }
> > 
> > Thanks,
> > Leo Yan
> > 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web