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(-)
I don't really understand why WARN_ON (or WARN_ON_ONCE)+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.