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

From: Thomas Gleixner
Date: Wed Jan 13 2016 - 17:03:40 EST


On Wed, 13 Jan 2016, Srinivas Pandruvada wrote:
> On Wed, 2016-01-13 at 22:26 +0100, Borislav Petkov wrote:
> > rmwmsrl_safe_on_cpu(policy->cpu, MSR_IA32_PERF_CTL,
> > ÂÂÂÂINTEL_PERF_CTL_MASK,
> > ÂÂÂÂ(u32)sfi_cpufreq_array[next_perf_state].ctr
> > l_val & INTEL_PERF_CTL_MASK);
> >
> > Yikes!
> >
> > So yes, it can work but it is ugly, hard to parse and use, not
> > generic
> > enough, etc, etc.
> >
> > So thanks, but no thanks.
> >
> I agree, in some cases it will not make much sense to use read-
> modify_write calls, the user may decide whether it makes sense or not.
> But such interface is not new to Linux kernel:
>
> regmap_update_bits(), which is referenced for 346 times.
>
> Are you saying that any such calls are not useful?

There are certainly cases when such calls are useful. And those cases are when
we have a sufficiently big occurence of similar code which is sufficiently
complex to justify the library code and the export.

Thanks,

tglx