Re: [PATCH v2 05/10] hwmon: (fam15h_power) Add compute unit accumulated power

From: Guenter Roeck
Date: Fri Oct 23 2015 - 09:37:33 EST


On 10/23/2015 06:27 AM, Borislav Petkov wrote:
On Tue, Oct 20, 2015 at 10:28:24AM +0800, Huang Rui wrote:
This patch adds a member in fam15h_power_data which specifies the
compute unit accumulated power. It adds do_read_registers_on_cu to do
all the read to all MSRs and run it on one of the online cores on each
compute unit with smp_call_function_many(). This behavior can decrease
IPI numbers.

Suggested-by: Borislav Petkov <bp@xxxxxxxxx>
Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
Cc: Guenter Roeck <linux@xxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
---
drivers/hwmon/fam15h_power.c | 68 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 67 insertions(+), 1 deletion(-)


[ ... ]

+static void do_read_registers_on_cu(void *_data)
+{
+ struct fam15h_power_data *data = _data;
+ int cpu, cu, cores_per_cu;
+
+ cpu = smp_processor_id();
+
+ cores_per_cu = amd_get_cores_per_cu();
+ cu = cpu / cores_per_cu;
+
+ WARN_ON(rdmsrl_safe(MSR_F15H_CU_PWR_ACCUMULATOR,
+ &data->cu_acc_power[cu]));

I guess the WARN_ON's here should be WARN_ON_ONCE() - otherwise dmesg is
filling up very quickly.

I don't really understand why WARN_ON (or WARN_ON_ONCE)
would be warranted here in the first place.

Guenter

--
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/