From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752649AbbJWNha (ORCPT ); Fri, 23 Oct 2015 09:37:30 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:40274 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751074AbbJWNh2 (ORCPT ); Fri, 23 Oct 2015 09:37:28 -0400 Subject: Re: [PATCH v2 05/10] hwmon: (fam15h_power) Add compute unit accumulated power To: Borislav Petkov , Huang Rui References: <1445308109-17970-1-git-send-email-ray.huang@amd.com> <1445308109-17970-6-git-send-email-ray.huang@amd.com> <20151023132702.GC2844@pd.tnic> Cc: Peter Zijlstra , Jean Delvare , Andy Lutomirski , Andreas Herrmann , Thomas Gleixner , Ingo Molnar , "Rafael J. Wysocki" , Len Brown , John Stultz , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org, x86@kernel.org, Andreas Herrmann , Aravind Gopalakrishnan , Fengguang Wu , Aaron Lu , Tony Li From: Guenter Roeck Message-ID: <562A3812.6060805@roeck-us.net> Date: Fri, 23 Oct 2015 06:37:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151023132702.GC2844@pd.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> Signed-off-by: Huang Rui >> Cc: Guenter Roeck >> Cc: Peter Zijlstra >> Cc: Ingo Molnar >> --- >> 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