Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314315 > unrolled thread

[PATCH 3/3] powercap, intel_rapl, Add ignore_max_time_window_check module parameter for broken BIOSes

Started byPrarit Bhargava <prarit@redhat.com>
First post2016-01-21 17:20 +0100
Last post2016-01-22 01:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] powercap, intel_rapl, Add ignore_max_time_window_check module parameter for broken BIOSes Prarit Bhargava <prarit@redhat.com> - 2016-01-21 17:20 +0100
    Re: [PATCH 3/3] powercap, intel_rapl, Add  ignore_max_time_window_check module parameter for broken BIOSes Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com> - 2016-01-22 01:40 +0100

#1314315 — [PATCH 3/3] powercap, intel_rapl, Add ignore_max_time_window_check module parameter for broken BIOSes

FromPrarit Bhargava <prarit@redhat.com>
Date2016-01-21 17:20 +0100
Subject[PATCH 3/3] powercap, intel_rapl, Add ignore_max_time_window_check module parameter for broken BIOSes
Message-ID<qTq7M-7IN-1@gated-at.bofh.it>
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_time_window_check module
parameter to avoid the maximum time window check in set_time_window().

[v2]: change name to max_time_window_check, fix (val == 0) check

Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
Cc: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
Cc: Mathias Krause <minipli@googlemail.com>
Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/powercap/intel_rapl.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index 14753e5..939026d 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -505,13 +505,24 @@ static int get_max_time_window(struct powercap_zone *power_zone, int id,
 
 	if (rapl_read_data_raw(rd, MAX_TIME_WINDOW, true, &val))
 		ret = -EIO;
-	else
+	else {
 		*data = val;
-
+		if (val == 0)
+			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_time_window_check;
+module_param(ignore_max_time_window_check, int, 0444);
+MODULE_PARM_DESC(ignore_max_time_window_check, "Ignore maximum time window check.  A bug should be reported to your hardware or BIOS vendor if this parameter is used.");
+
 static int set_time_window(struct powercap_zone *power_zone, int id,
 								u64 window)
 {
@@ -532,7 +543,8 @@ static int set_time_window(struct powercap_zone *power_zone, int id,
 	 * The MSR_RAPL_POWER_UNIT register, read during initialization,
 	 * does contain the smallest unit of time that can be measured.
 	 */
-	if ((window > max_window) || (window < rp->time_unit)) {
+	if ((!ignore_max_time_window_check && (window > max_window)) ||
+	    (window < rp->time_unit)) {
 		ret = -EINVAL;
 		goto out;
 	}
-- 
1.7.9.3

[toc] | [next] | [standalone]


#1314666 — Re: [PATCH 3/3] powercap, intel_rapl, Add ignore_max_time_window_check module parameter for broken BIOSes

FromSeiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
Date2016-01-22 01:40 +0100
SubjectRe: [PATCH 3/3] powercap, intel_rapl, Add ignore_max_time_window_check module parameter for broken BIOSes
Message-ID<qTxVE-4xd-1@gated-at.bofh.it>
In reply to#1314315
On 2016-01-22 01:15, 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_time_window_check module
> parameter to avoid the maximum time window check in set_time_window().
> 
> [v2]: change name to max_time_window_check, fix (val == 0) check
> 
> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> Cc: Prarit Bhargava <prarit@redhat.com>
> Cc: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
> Cc: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
> Cc: Mathias Krause <minipli@googlemail.com>
> Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> ---
>  drivers/powercap/intel_rapl.c |   18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
> index 14753e5..939026d 100644
> --- a/drivers/powercap/intel_rapl.c
> +++ b/drivers/powercap/intel_rapl.c
> @@ -505,13 +505,24 @@ static int get_max_time_window(struct powercap_zone *power_zone, int id,
>  
>  	if (rapl_read_data_raw(rd, MAX_TIME_WINDOW, true, &val))
>  		ret = -EIO;
> -	else
> +	else {
>  		*data = val;
> -
> +		if (val == 0)
> +			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");

                                                                                                                                                                                                                                                                                 The correct name is ignore_max_time_window_check here.

--
Seiichi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web