lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 19 May 2010 08:11:03 -0500
From:	Nishanth Menon <nm@...com>
To:	Mike Chan <mike@...roid.com>
CC:	"khilman@...prootsystems.com" <khilman@...prootsystems.com>,
	"menage@...gle.com" <menage@...gle.com>,
	"balbir@...ibm.com" <balbir@...ibm.com>,
	"cpufreq@...r.kernel.org" <cpufreq@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>
Subject: Re: [PATCH 4/4] omap: cpu: Power tracking support for cgroup cpuacct

Mike Chan had written, on 05/18/2010 08:30 PM, the following:
> Specify new power field in struct omap_opp, which is
> power exported in milliWatt.
> 
> power_usage function gives power consumed in milliWatt seconds
> 
> Signed-off-by: Mike Chan <mike@...roid.com>
> ---
>  arch/arm/plat-omap/cpu-omap.c             |   23 ++++++++++++++++++++++-
>  arch/arm/plat-omap/include/plat/omap-pm.h |    1 +
>  2 files changed, 23 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
> index d27234d..1381539 100644
> --- a/arch/arm/plat-omap/cpu-omap.c
> +++ b/arch/arm/plat-omap/cpu-omap.c
> @@ -22,6 +22,7 @@
>  #include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/cpuacct.h>
> +#include <linux/math64.h>
>  
>  #include <mach/hardware.h>
>  #include <plat/clock.h>
> @@ -218,10 +219,30 @@ static void omap_cpuacct_freq_show(void *cpuacct_data, struct cgroup_map_cb *cb)
>  	}
>  }
>  
> +
> +/* Returns power (in milliWatt seconds) for cgroup */
> +static u64 omap_cpuacct_power_usage(void *cpuacct_data)
> +{
> +	int i;
> +	u64 *cpuacct_freq = cpuacct_data;
> +	u64 totalpower = 0;
> +
> +	/* mpu_opps table starts at 1 */
> +	for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
> +		totalpower += cpuacct_freq[i] * mpu_opps[i + 1].power;
> +
> +	/* milliwatt seconds */
> +	totalpower = div64_u64(totalpower, NSEC_PER_SEC);
> +
> +	return totalpower;
> +}
> +
> +
>  static struct cpuacct_cpufreq_calls omap_cpuacct_cpufreq = {
>  	.init = omap_cpuacct_freq_init,
>  	.charge = omap_cpuacct_freq_charge,
> -	.show = omap_cpuacct_freq_show,
> +	.cpufreq_show = omap_cpuacct_freq_show,
> +	.power_usage = omap_cpuacct_power_usage,
>  };
>  
>  static int __init omap_cpuacct_init(void)
> diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h
> index 3ee41d7..8f2db6f 100644
> --- a/arch/arm/plat-omap/include/plat/omap-pm.h
> +++ b/arch/arm/plat-omap/include/plat/omap-pm.h
> @@ -31,6 +31,7 @@ struct omap_opp {
>  	unsigned long rate;
>  	u8 opp_id;
>  	u16 min_vdd;
> +	unsigned long power; /* power consumed running at OPP in milliWatts */

this conflicts with the OPP layer implementation. this structure will 
disappear for good.

>  };
>  
>  extern struct omap_opp *mpu_opps;


-- 
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ