Re: [RFC v02 5/5] Introduce Intel RAPL power capping driver

From: Joe Perches
Date: Wed Aug 07 2013 - 12:26:42 EST


On Wed, 2013-08-07 at 09:12 -0700, Srinivas Pandruvada wrote:
> RAPL(Running Average Power Limit) interface provides platform software
> with the ability to monitor, control, and get notifications on SOC
> power consumptions.

trivial notes:

> diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
[]
> +#define POWER_LIMIT1_MASK 0x7FFF
> +#define POWER_LIMIT1_ENABLE BIT(15)
> +#define POWER_LIMIT1_CLAMP BIT(16)
> +
> +#define POWER_LIMIT2_MASK (0x7FFFULL<<32)
> +#define POWER_LIMIT2_ENABLE (0x1ULL<<47)
> +#define POWER_LIMIT2_CLAMP (0x1ULL<<48)
> +#define POWER_PKG_LOCK (0x1ULL<<63)

Maybe it's time add a generic bitops.h macro

#define BIT_ULL(nr) (1ULL << (nr))

[]

> +/* called after domain detection and package level data are set */
> +static void rapl_init_domains(struct rapl_pkg *rp)
> +{
> + int i;
> + struct rapl_domain *rd = rp->domains;
> +
> + for (i = 0; i < RAPL_DOMAIN_MAX; i++) {
> + unsigned int mask = rp->domain_map & (1 << i);
> + switch (mask) {
> + case 1 << RAPL_DOMAIN_PKG:

Maybe use defines or BIT(RAPL_DOMAIN_PKG)

Other than that the code seems to read pretty easily.

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