Re: [PATCH 10/15] hwmon, fam15h_power: add compute unit accumulated power

From: Huang Rui
Date: Fri Aug 28 2015 - 06:43:55 EST


On Fri, Aug 28, 2015 at 10:03:35AM +0200, Ingo Molnar wrote:
>
> * Huang Rui <ray.huang@xxxxxxx> wrote:
>
> > @@ -249,6 +254,21 @@ static int fam15h_power_init_data(struct pci_dev *f4,
> >
> > data->max_cu_acc_power = tmp;
> >
> > + cores_per_cu = amd_get_cores_per_cu();
> > + cu_num = boot_cpu_data.x86_max_cores / cores_per_cu;
> > +
> > + WARN_ON_ONCE(cu_num > MAX_CUS);
> > +
> > + for (cpu = 0; cpu < cu_num * cores_per_cu; cpu += cores_per_cu) {
>
> so 'cu_num * cores_per_cu' is really a roundabout way to say
> boot_cpu_data.x86_max_cores?
>

Oh, yes. :)
I will update it at v2.

> > + cu = cpu / cores_per_cu;
> > + if (rdmsrl_safe_on_cpu(cpu, MSR_F15H_CU_PWR_ACCUMULATOR,
> > + &data->cu_acc_power[cu])) {
> > + pr_err("Failed to read compute unit power accumulator MSR on core%d\n",
> > + cpu);
>
> Please don't break printk lines mid-line - ignore checkpatch in this case.
>

OK, I got it.

> Also, the message talks about 'core', while a CPU ID is printed.
>

Yes, but actually this value is for the compute unit which the core
belongs to.
E.X. the MSR_F15H_CU_PWR_ACCUMULATOR value is the same between core 0
and core 1. Because they belong to the same compute unit.

Thanks,
Rui
--
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/