Re: [PATCH v2 2/2] powercap/rapl: reduce ipi calls

Thomas Gleixner
2016-01-13T09:48:26Z

On Tue, 12 Jan 2016, Jacob Pan wrote:
> @@ -805,30 +809,18 @@ static int rapl_write_data_raw(struct rapl_domain *rd,
> enum rapl_primitives prim,
> unsigned long long value)
> {
> - u64 msr_val;
> - u32 msr;
> struct rapl_primitive_info *rp = &rpi[prim];
> int cpu;
> + u64 bits;
>
> cpu = find_active_cpu_on_package(rd->package_id);
> if (cpu < 0)
> return cpu;
> - msr = rd->msrs[rp->id];
> - if (rdmsrl_safe_on_cpu(cpu, msr, &msr_val)) {
> - dev_dbg(&rd->power_zone.dev,
> - "failed to read msr 0x%x on cpu %d\n", msr, cpu);
> - return -EIO;
> - }
> - value = rapl_unit_xlate(rd, rd->package_id, rp->unit, value, 1);
> - msr_val &= ~rp->mask;
> - msr_val |= value << rp->shift;
> - if (wrmsrl_safe_on_cpu(cpu, msr, msr_val)) {
> - dev_dbg(&rd->power_zone.dev,
> - "failed to write msr 0x%x on cpu %d\n", msr, cpu);
> - return -EIO;
> - }
>
> - return 0;
> + bits = rapl_unit_xlate(rd, rd->package_id, rp->unit, value, 1);
> + bits |= bits << rp->shift;
> +
> + return rmwmsrl_safe_on_cpu(cpu, rd->msrs[rp->id], rp->mask, bits);

So here you actually use that new (misnomed) function, but for

> +static void power_limit_irq_save_cpu(void *info)

and

> +static void power_limit_irq_restore_cpu(void *info)

you use a bog standard smp function call. What's the benefit of adding that
rmw function over a bog standard smp function call if you can only use it for
one instance of the same pattern?

Boris asked you the same question here

https://lkml.kernel.org/r/20151220152749.GA29805@pd.tnic

but you decided to ignore it.

Thanks,

tglx