From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752102AbbLRF4P (ORCPT ); Fri, 18 Dec 2015 00:56:15 -0500 Received: from mgwym03.jp.fujitsu.com ([211.128.242.42]:64878 "EHLO mgwym03.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbbLRF4O (ORCPT ); Fri, 18 Dec 2015 00:56:14 -0500 Subject: Re: [PATCH 3/3] powercap, intel_rapl, Add ignore_max_window_check module parameter for broken BIOSes To: Prarit Bhargava , References: <1450184532-21150-1-git-send-email-prarit@redhat.com> <1450184532-21150-4-git-send-email-prarit@redhat.com> CC: "Rafael J. Wysocki" , Radivoje Jovanovic , Mathias Krause , Ajay Thomas From: Seiichi Ikarashi Organization: Fujitsu Limited Message-ID: <56739E8C.9070201@jp.fujitsu.com> Date: Fri, 18 Dec 2015 14:50:04 +0900 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1450184532-21150-4-git-send-email-prarit@redhat.com> Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015-12-15 22:02, Prarit Bhargava wrote: > Some systems erroneously set the maximum time window field of > MSR_PKG_POWER_INFO register to 0. This results in a user not being able > to set the time windows for the package. In some cases, however, RAPL > will still continue to work with a small window (albeit through some > trial and error). This patch adds a ignore_max_window_check module > parameter to avoid the maximum time window check in set_time_window(). > > Cc: "Rafael J. Wysocki" > Cc: Prarit Bhargava > Cc: Radivoje Jovanovic > Cc: Seiichi Ikarashi > Cc: Mathias Krause > Cc: Ajay Thomas > Signed-off-by: Prarit Bhargava > --- > drivers/powercap/intel_rapl.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c > index 14753e5..3cdb8ee 100644 > --- a/drivers/powercap/intel_rapl.c > +++ b/drivers/powercap/intel_rapl.c > @@ -508,10 +508,22 @@ static int get_max_time_window(struct powercap_zone *power_zone, int id, > else > *data = val; > > + if (val == 0) If rapl_read_data_raw() fails, "val" becomes indefinite. So this check and warn should be performed only if rapl_read_data_raw() succeeds. > + pr_warn_once(FW_BUG "intel_rapl: Maximum Time Window is zero. This is a BIOS bug that should be reported to your hardware or BIOS vendor. The value of zero may prevent Intel RAPL from functioning properly. Most bugs can be avoided by setting the ignore_max_window_check module parameter.\n"); > + > put_online_cpus(); > return ret; > } > > +/* Some BIOSes incorrectly program the maximum time window in the > + * MSR_PKG_POWER_INFO register. Some of these systems still have functional > + * RAPL registers, etc., so give the user the option of disabling the maximum > + * time window check. > + */ > +static int ignore_max_window_check; > +module_param(ignore_max_window_check, int, 0444); > +MODULE_PARM_DESC(ignore_max_window_check, "Ignore maximum window check. A bug should be reported to your hardware or BIOS vendor if this parameter is used."); Don't you need to use "time_window" instead of just "window" in these names?