Skip to contentSkip to conversation

MCP limit log messages, 2.6.36-rc4

PATCH Tim Gardner 2 participants 9 messages Sep 15, 2010 – Sep 28, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

I've been getting regular MCP limit log messages on a Dell Studio 1458 (i5 CPU) with an A02 BIOS. With the attached debug hack it prints the following values:

[   33.605098] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 30123, limit 1023
[   38.597998] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 21697, limit 1023
[   43.590917] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 15390, limit 1023
[   48.583821] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 43370, limit 1023
[   53.576740] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 64728, limit 1023

This is an idle machine which starts printing these messages about 30 seconds after boot. Any thoughts?

rtg

Signature · 1 line
Tim Gardner [email protected]
Quoted 1 line

From 89d9d47cc85a7a692f7f5e56549438086c36cc98 Mon Sep 17 00:00:00 2001

From: Tim Gardner <[email protected]>
Date: Wed, 15 Sep 2010 09:35:35 -0600
Subject: [PATCH] intel_ips: Print overage values

---
 drivers/platform/x86/intel_ips.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
drivers/platform/x86/intel_ips.c +20 -6
index 9024480..4b8e6e2 100644
@@ -598,17 +598,31 @@ static bool mcp_exceeded(struct ips_driver *ips)
 {
 	unsigned long flags;
 	bool ret = false;
+	u32 temp_limit;
+	u32 avg_power;
+	const char *msg = "MCP limit exceeded: ";
 
 	spin_lock_irqsave(&ips->turbo_status_lock, flags);
-	if (ips->mcp_avg_temp > (ips->mcp_temp_limit * 100))
-		ret = true;
-	if (ips->cpu_avg_power + ips->mch_avg_power > ips->mcp_power_limit)
+
+	temp_limit = ips->mcp_temp_limit;
+	temp_limit *= 100;
+	if (ips->mcp_avg_temp > temp_limit) {
+		dev_info(&ips->dev->dev,
+			"%sAvg temp %u, limit %u\n", msg, ips->mcp_avg_temp,
+			temp_limit);
 		ret = true;
-	spin_unlock_irqrestore(&ips->turbo_status_lock, flags);
+	}
 
-	if (ret)
+	avg_power = ips->cpu_avg_power;
+	avg_power += ips->mch_avg_power;
+	if (avg_power > ips->mcp_power_limit) {
 		dev_info(&ips->dev->dev,
-			 "MCP power or thermal limit exceeded\n");
+			"%sAvg power %u, limit %u\n", msg, avg_power,
+			ips->mcp_power_limit);
+		ret = true;
+	}
+
+	spin_unlock_irqrestore(&ips->turbo_status_lock, flags);
 
 	return ret;
 }
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 13 lines · Tim Gardner

I've been getting regular MCP limit log messages on a Dell Studio 1458 (i5 CPU) with an A02 BIOS. With the attached debug hack it prints the following values:

[ 33.605098] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
30123, limit 1023
[ 38.597998] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
21697, limit 1023
[ 43.590917] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
15390, limit 1023
[ 48.583821] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
43370, limit 1023
[ 53.576740] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
Quoted 6 lines

64728, limit 1023

This is an idle machine which starts printing these messages about 30 seconds after boot. Any thoughts?

rtg

More clues:

[   13.426064] intel ips 0000:00:1f.6: Warning: CPU TDP doesn't match expected value (found 25, expected 35)
[   13.426086] intel ips 0000:00:1f.6: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   13.426933] intel ips 0000:00:1f.6: IPS driver initialized, MCP temp limit 95
Signature · 1 line
Tim Gardner [email protected]
#2 lore raw
Quoted 21 lines · On Wed, 15 Sep 2010 13:20:00 -0600 Tim Gardner <[email protected]>…
Quoted 13 lines · Tim Gardner

I've been getting regular MCP limit log messages on a Dell Studio 1458 (i5 CPU) with an A02 BIOS. With the attached debug hack it prints the following values:

[ 33.605098] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
30123, limit 1023
[ 38.597998] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
21697, limit 1023
[ 43.590917] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
15390, limit 1023
[ 48.583821] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
43370, limit 1023
[ 53.576740] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
Quoted 6 lines

64728, limit 1023

This is an idle machine which starts printing these messages about 30 seconds after boot. Any thoughts?

rtg

Quoted 9 lines

More clues:

[   13.426064] intel ips 0000:00:1f.6: Warning: CPU TDP doesn't match 
expected value (found 25, expected 35)
[   13.426086] intel ips 0000:00:1f.6: PCI INT C -> GSI 18 (level,
low) -> IRQ 18
[   13.426933] intel ips 0000:00:1f.6: IPS driver initialized, MCP

temp limit 95

Oh interesting, this looks like a slightly different problem than some others have been seeing. The power limit is listed at 1023 but the reported value is looking at least 100x over that, so we may have a reporting vs limit unit mismatch here.

I'm looking into finding a way to enable the thermal device which would fix another problem we have with bogus thermal limits and reporting, but yours is a separate problem. I'll take a look at the sources and double check my unit calculations...

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#3 lore raw
In reply to Tim Gardner
Quoted 13 lines · On Wed, 15 Sep 2010 11:47:45 -0600 Tim Gardner <[email protected]>…

I've been getting regular MCP limit log messages on a Dell Studio 1458 (i5 CPU) with an A02 BIOS. With the attached debug hack it prints the following values:

[   33.605098] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
30123, limit 1023
[   38.597998] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
21697, limit 1023
[   43.590917] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
15390, limit 1023
[   48.583821] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
43370, limit 1023
[   53.576740] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
Quoted 4 lines

64728, limit 1023

This is an idle machine which starts printing these messages about 30 seconds after boot. Any thoughts?

Actually, it looks like you have some non-upstream patches to the IPS driver, maybe one of Joe's patches to add more debug output when limits are exceeded?

At any rate, I think we're setting the MCP power limit incorrectly. The BIOS must be giving us a limit in 0.1W units (though even then it looks bogus); we need to clamp it to one of the available defaults.

Joe has some code for that as well, I've just asked him to update his patch, which we should get into 2.6.35.x.

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#4 lore raw
Quoted 25 lines · On Thu, 23 Sep 2010 13:48:16 -0700 Jesse Barnes <[email protected]>…
Quoted 13 lines · On Wed, 15 Sep 2010 11:47:45 -0600 Tim Gardner <[email protected]>…

I've been getting regular MCP limit log messages on a Dell Studio 1458 (i5 CPU) with an A02 BIOS. With the attached debug hack it prints the following values:

[   33.605098] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
30123, limit 1023
[   38.597998] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
21697, limit 1023
[   43.590917] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
15390, limit 1023
[   48.583821] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
43370, limit 1023
[   53.576740] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power 
Quoted 4 lines

64728, limit 1023

This is an idle machine which starts printing these messages about 30 seconds after boot. Any thoughts?

Actually, it looks like you have some non-upstream patches to the IPS driver, maybe one of Joe's patches to add more debug output when limits are exceeded?

Quoted 6 lines

At any rate, I think we're setting the MCP power limit incorrectly. The BIOS must be giving us a limit in 0.1W units (though even then it looks bogus); we need to clamp it to one of the available defaults.

Joe has some code for that as well, I've just asked him to update his patch, which we should get into 2.6.35.x.

Just posted some fixes for this to the x86 driver list, in particular the "[PATCH 2/2] IPS driver: verify BIOS provided limits" should help a bit here, but I still have a bug to fix in the i915 driver to really make things work.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#5 lore raw
Quoted 21 lines · Jesse Barnes
Quoted 18 lines · On Thu, 23 Sep 2010 13:48:16 -0700 Jesse Barnes<[email protected]>…
Quoted 15 lines · On Wed, 15 Sep 2010 11:47:45 -0600 Tim Gardner<[email protected]>…

I've been getting regular MCP limit log messages on a Dell Studio 1458 (i5 CPU) with an A02 BIOS. With the attached debug hack it prints the following values:

[   33.605098] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
30123, limit 1023
[   38.597998] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
21697, limit 1023
[   43.590917] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
15390, limit 1023
[   48.583821] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power
43370, limit 1023
[   53.576740] intel ips 0000:00:1f.6: MCP limit exceeded: Avg power

64728, limit 1023

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

This is an idle machine which starts printing these messages about 30 seconds after boot. Any thoughts?

Actually, it looks like you have some non-upstream patches to the IPS driver, maybe one of Joe's patches to add more debug output when limits are exceeded?

Its just a debug hack which I wrote (that I mentioned in the first email) so I could figure out why the driver was complaining.

Quoted 4 lines
Quoted 4 lines

At any rate, I think we're setting the MCP power limit incorrectly. The BIOS must be giving us a limit in 0.1W units (though even then it looks bogus); we need to clamp it to one of the available defaults.

Quoted 8 lines
Quoted 2 lines

Joe has some code for that as well, I've just asked him to update his patch, which we should get into 2.6.35.x.

Just posted some fixes for this to the x86 driver list, in particular the "[PATCH 2/2] IPS driver: verify BIOS provided limits" should help a bit here, but I still have a bug to fix in the i915 driver to really make things work.

I'll be back from Asia by Monday and will give these patches a try.

rtg

Signature · 1 line
Tim Gardner [email protected]
#6 lore raw
Quoted 2 lines · On Fri, 24 Sep 2010 06:46:45 +0800 Tim Gardner <[email protected]>…

Its just a debug hack which I wrote (that I mentioned in the first email) so I could figure out why the driver was complaining.

Oh sorry, missed that. An upstream patch for that would be welcome as well.

Quoted 1 line

I'll be back from Asia by Monday and will give these patches a try.

Great, as I said you may still see spurious "over power" conditions, but that's due to a bug in the i915 driver.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#7 lore raw
Quoted 5 lines · Jesse Barnes
Quoted 2 lines · On Fri, 24 Sep 2010 06:46:45 +0800 Tim Gardner<[email protected]>…

Its just a debug hack which I wrote (that I mentioned in the first email) so I could figure out why the driver was complaining.

Quoted 8 lines

Oh sorry, missed that. An upstream patch for that would be welcome as well.

Quoted 1 line

I'll be back from Asia by Monday and will give these patches a try.

Great, as I said you may still see spurious "over power" conditions, but that's due to a bug in the i915 driver.

With these 3 patches applied the MCP log message noise goes away. The 4th patch (also applied) is the debug patch mentioned in my first email (if you're still interested in it). This is on top of Linus tree at 830c55a673537ca33ef4689fb5f20c2d66d98519 (plus some Ubuntu cruft).

The only 'intel ips' messages left in the log are these:

intel ips 0000:00:1f.6: Warning: CPU TDP doesn't match expected value (found 25, expected 35) intel ips 0000:00:1f.6: PCI INT C -> GSI 18 (level, low) -> IRQ 18
intel ips 0000:00:1f.6: IPS driver initialized, MCP temp limit 95

rtg

Signature · 1 line
Tim Gardner [email protected]
Quoted 1 line

From 64a794b2a2249ce87bc700ff041f1bcfa72d3a11 Mon Sep 17 00:00:00 2001

From: Jesse Barnes <[email protected]>
Date: Mon, 27 Sep 2010 10:35:44 -0700
Subject: [PATCH 1/4] drm/i915: fix GMCH power reporting

The IPS driver needs to know the current power consumption of the GMCH in order to make decisions about when to increase or decrease the CPU and/or GPU power envelope. So fix up the divisions to save the results so the numbers are actually correct (contrary to some earlier comments and code, these functions do not modify the first argument and use it for the result).

---
 drivers/gpu/drm/i915/i915_dma.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +3 -3
index 9d67b48..c74e4e8 100644
@@ -1787,9 +1787,9 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv)
 		}
 	}
 
-	div_u64(diff, diff1);
+	diff = div_u64(diff, diff1);
 	ret = ((m * diff) + c);
-	div_u64(ret, 10);
+	ret = div_u64(ret, 10);
 
 	dev_priv->last_count1 = total_count;
 	dev_priv->last_time1 = now;
@@ -1858,7 +1858,7 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv)
 
 	/* More magic constants... */
 	diff = diff * 1181;
-	div_u64(diff, diffms * 10);
+	diff = div_u64(diff, diffms * 10);
 	dev_priv->gfx_power = diff;
 }
 
Signature · 1 line
1.7.0.4
Quoted 1 line

From 9e473da5e1cad8891bcf718060552767d8173090 Mon Sep 17 00:00:00 2001

From: Jesse Barnes <[email protected]>
Date: Thu, 23 Sep 2010 23:03:03 +0200
Subject: [PATCH 2/4] IPS driver: don't toggle CPU turbo on unsupported CPUs

If the CPU doesn't support turbo, don't try to enable/disable it.

---
 drivers/platform/x86/intel_ips.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
drivers/platform/x86/intel_ips.c +9 -5
index 9024480..06136f5 100644
@@ -51,7 +51,6 @@
  * TODO:
  *   - handle CPU hotplug
  *   - provide turbo enable/disable api
- *   - make sure we can write turbo enable/disable reg based on MISC_EN
  *
  * Related documents:
  *   - CDI 403777, 403778 - Auburndale EDS vol 1 & 2
@@ -325,6 +324,7 @@ struct ips_driver {
 	bool gpu_preferred;
 	bool poll_turbo_status;
 	bool second_cpu;
+	bool turbo_toggle_allowed;
 	struct ips_mcp_limits *limits;
 
 	/* Optional MCH interfaces for if i915 is in use */
@@ -461,7 +461,8 @@ static void ips_enable_cpu_turbo(struct ips_driver *ips)
 	if (ips->__cpu_turbo_on)
 		return;
 
-	on_each_cpu(do_enable_cpu_turbo, ips, 1);
+	if (ips->turbo_toggle_allowed)
+		on_each_cpu(do_enable_cpu_turbo, ips, 1);
 
 	ips->__cpu_turbo_on = true;
 }
@@ -498,7 +499,8 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips)
 	if (!ips->__cpu_turbo_on)
 		return;
 
-	on_each_cpu(do_disable_cpu_turbo, ips, 1);
+	if (ips->turbo_toggle_allowed)
+		on_each_cpu(do_disable_cpu_turbo, ips, 1);
 
 	ips->__cpu_turbo_on = false;
 }
@@ -1333,8 +1335,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
 	 * turbo manually or we'll get an illegal MSR access, even though
 	 * turbo will still be available.
 	 */
-	if (!(misc_en & IA32_MISC_TURBO_EN))
-		; /* add turbo MSR write allowed flag if necessary */
+	if (misc_en & IA32_MISC_TURBO_EN)
+		ips->turbo_toggle_allowed = true;
+	else
+		ips->turbo_toggle_allowed = false;
 
 	if (strstr(boot_cpu_data.x86_model_id, "CPU       M"))
 		limits = &ips_sv_limits;
Signature · 1 line
1.7.0.4
Quoted 1 line

From edf5aff209bcf4a6d8ddaca2ebe6252b783c78d0 Mon Sep 17 00:00:00 2001

From: Jesse Barnes <[email protected]>
Date: Thu, 23 Sep 2010 23:29:06 +0200
Subject: [PATCH 3/4] IPS driver: verify BIOS provided limits

They're optional. If not present or sane, we should use the CPU defaults.

---
 drivers/platform/x86/intel_ips.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
drivers/platform/x86/intel_ips.c +23 -0
index 06136f5..308c7f5 100644
@@ -665,6 +665,27 @@ static bool mch_exceeded(struct ips_driver *ips)
 }
 
 /**
+ * verify_limits - verify BIOS provided limits
+ * @ips: IPS structure
+ *
+ * BIOS can optionally provide non-default limits for power and temp.  Check
+ * them here and use the defaults if the BIOS values are not provided or
+ * are otherwise unusable.
+ */
+static void verify_limits(struct ips_driver *ips)
+{
+	if (ips->mcp_power_limit < ips->limits->mcp_power_limit ||
+	    ips->mcp_power_limit > 35000)
+		ips->mcp_power_limit = ips->limits->mcp_power_limit;
+
+	if (ips->mcp_temp_limit < ips->limits->core_temp_limit ||
+	    ips->mcp_temp_limit < ips->limits->mch_temp_limit ||
+	    ips->mcp_temp_limit > 150)
+		ips->mcp_temp_limit = min(ips->limits->core_temp_limit,
+					  ips->limits->mch_temp_limit);
+}
+
+/**
  * update_turbo_limits - get various limits & settings from regs
  * @ips: IPS driver struct
  *
@@ -688,6 +709,7 @@ static void update_turbo_limits(struct ips_driver *ips)
 	ips->mcp_temp_limit = thm_readw(THM_PTL);
 	ips->mcp_power_limit = thm_readw(THM_MPPC);
 
+	verify_limits(ips);
 	/* Ignore BIOS CPU vs GPU pref */
 }
 
@@ -1157,6 +1179,7 @@ static irqreturn_t ips_irq_handler(int irq, void *arg)
 				STS_PTL_SHIFT;
 			ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >>
 				STS_PPL_SHIFT;
+			verify_limits(ips);
 			spin_unlock(&ips->turbo_status_lock);
 
 			thm_writeb(THM_SEC, SEC_ACK);
Signature · 1 line
1.7.0.4
Quoted 1 line

From 2e5b2a568595db18f189a8dec1ba6e92c913e2e4 Mon Sep 17 00:00:00 2001

From: Tim Gardner <[email protected]>
Date: Wed, 15 Sep 2010 09:35:35 -0600
Subject: [PATCH 4/4] intel_ips: Print overage values

---
 drivers/platform/x86/intel_ips.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
drivers/platform/x86/intel_ips.c +20 -6
index 308c7f5..10930b7 100644
@@ -600,17 +600,31 @@ static bool mcp_exceeded(struct ips_driver *ips)
 {
 	unsigned long flags;
 	bool ret = false;
+	u32 temp_limit;
+	u32 avg_power;
+	const char *msg = "MCP limit exceeded: ";
 
 	spin_lock_irqsave(&ips->turbo_status_lock, flags);
-	if (ips->mcp_avg_temp > (ips->mcp_temp_limit * 100))
-		ret = true;
-	if (ips->cpu_avg_power + ips->mch_avg_power > ips->mcp_power_limit)
+
+	temp_limit = ips->mcp_temp_limit;
+	temp_limit *= 100;
+	if (ips->mcp_avg_temp > temp_limit) {
+		dev_info(&ips->dev->dev,
+			"%sAvg temp %u, limit %u\n", msg, ips->mcp_avg_temp,
+			temp_limit);
 		ret = true;
-	spin_unlock_irqrestore(&ips->turbo_status_lock, flags);
+	}
 
-	if (ret)
+	avg_power = ips->cpu_avg_power;
+	avg_power += ips->mch_avg_power;
+	if (avg_power > ips->mcp_power_limit) {
 		dev_info(&ips->dev->dev,
-			 "MCP power or thermal limit exceeded\n");
+			"%sAvg power %u, limit %u\n", msg, avg_power,
+			ips->mcp_power_limit);
+		ret = true;
+	}
+
+	spin_unlock_irqrestore(&ips->turbo_status_lock, flags);
 
 	return ret;
 }
Signature · 1 line
1.7.0.4
#8 lore raw
Quoted 20 lines · On Tue, 28 Sep 2010 10:34:21 -0600 Tim Gardner <[email protected]>…
Quoted 5 lines · Jesse Barnes
Quoted 2 lines · On Fri, 24 Sep 2010 06:46:45 +0800 Tim Gardner<[email protected]>…

Its just a debug hack which I wrote (that I mentioned in the first email) so I could figure out why the driver was complaining.

Quoted 8 lines

Oh sorry, missed that. An upstream patch for that would be welcome as well.

Quoted 1 line

I'll be back from Asia by Monday and will give these patches a try.

Great, as I said you may still see spurious "over power" conditions, but that's due to a bug in the i915 driver.

With these 3 patches applied the MCP log message noise goes away. The 4th patch (also applied) is the debug patch mentioned in my first email (if you're still interested in it). This is on top of Linus tree at 830c55a673537ca33ef4689fb5f20c2d66d98519 (plus some Ubuntu cruft).

Quoted 6 lines

The only 'intel ips' messages left in the log are these:

intel ips 0000:00:1f.6: Warning: CPU TDP doesn't match expected value (found 25, expected 35)
intel ips 0000:00:1f.6: PCI INT C -> GSI 18 (level, low) -> IRQ 18 intel ips 0000:00:1f.6: IPS driver initialized, MCP temp limit 95

All looks good.

Patch is a nice improvement too; please send it over to the x86 platform driver list and cc Matthew Garrett so he can apply it.

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center