Skip to contentSkip to conversation

Quiet power limit notification

PATCH New Fenghua Yu 4 participants 9 messages May 15, 2013 – Jun 25, 2013

Subsystems (2)
lore
Share & tools
lore

Fenghua Yu

author
#0 lore raw

cover Quiet power limit notification

From: Fenghua Yu <[email protected]>

Power Limit Notification (X86_FEATURE_PLN) was added in Sandy Bridge to give the OS the option of knowing when the package has reached a configured power threshold.

Linux-2.6.36 enabled this feature:
0199114c31798af5b83841b21759b64171060d9b (x86, hwmon: Package Level Thermal/Power: power limit)

It enabld the interrupt, and the interrupt hander
added to the MCE log and printed to the console:

printk(KERN_CRIT "CPU%d: %s power limit notification (total events = %lu) printk(KERN_INFO "CPU%d: %s power limit normal\n"

However, these events are quite routine on some systems under some conditions, alarming customers and provoking un-necessary customer support calls.

So the MCE log entry was deleted in Linux-3.3:

29e9bf1841e4f9df13b4992a716fece7087dd237
(x86, mce, therm_throt: Don't report power limit and package level thermal throttle events in mcelog)

Here we delete the corresponding kernel console messages, and then we disable the interrupt by default -- allowing it to be enabled by cmdline for diagnosis purposes.

https://bugzilla.kernel.org/show_bug.cgi?id=36182

This pair of patches applies cleanly back to Linux-3.3.

#1 lore raw

cover Quiet power limit notification

[Re-sending for Fenghua, as his e-mail seems to have got lost.
In case you receive multiple copies, the patches are unchanged.]

thanks,
-Len Brown
Intel Open Source Technology Center
---

Power Limit Notification (X86_FEATURE_PLN) was added in Sandy Bridge to give the OS the option of knowing when the package has reached a configured power threshold.

Linux-2.6.36 enabled this feature:
0199114c31798af5b83841b21759b64171060d9b (x86, hwmon: Package Level Thermal/Power: power limit)

It enabld the interrupt, and the interrupt hander
added to the MCE log and printed to the console:

printk(KERN_CRIT "CPU%d: %s power limit notification (total events = %lu) printk(KERN_INFO "CPU%d: %s power limit normal\n"

However, these events are quite routine on some systems under some conditions, alarming customers and provoking un-necessary customer support calls.

So the MCE log entry was deleted in Linux-3.3:

29e9bf1841e4f9df13b4992a716fece7087dd237
(x86, mce, therm_throt: Don't report power limit and package level thermal throttle events in mcelog)

Here we delete the corresponding kernel console messages, and then we disable the interrupt by default -- allowing it to be enabled by cmdline for diagnosis purposes.

https://bugzilla.kernel.org/show_bug.cgi?id=36182

This pair of patches applies cleanly back to Linux-3.3.

Documentation/kernel-parameters.txt | 2 ++
arch/x86/kernel/cpu/mcheck/therm_throt.c | 43 ++++++++++++++++++++++++++-----------------

 2 files changed, 28 insertions(+), 17 deletions(-)

[1/2] x86 thermal: Disable power limit notification interrupt by default [2/2] x86 thermal: Delete power-limit-notification console messages

#2 lore raw

cover Rewrite power limit notification interrupt handling

[Excluse duplicates -- for some reason these didn't hit list archives or patchwork]

The "Power Limit Notification" (X86_FEATURE_PLN) was added in Sandy Bridge to give the OS the option of knowing when the package has reached a configured power threshold.

Linux-2.6.36 enabled this feature:
0199114c31798af5b83841b21759b64171060d9b (x86, hwmon: Package Level Thermal/Power: power limit)

It enabld the interrupt, and the interrupt hander
added to the MCE log and printed to the console:

printk(KERN_CRIT "CPU%d: %s power limit notification (total events = %lu) printk(KERN_INFO "CPU%d: %s power limit normal\n"

However, these events are quite routine on some systems under some conditions, alarming customers and provoking un-necessary customer support calls.

So the MCE log entry was deleted in Linux-3.3:

29e9bf1841e4f9df13b4992a716fece7087dd237
(x86, mce, therm_throt: Don't report power limit and package level thermal throttle events in mcelog)

Here we delete the corresponding kernel console messages, and then we disable the interrupt by default -- allowing it to be enabled by cmdline for diagnosis purposes.

https://bugzilla.kernel.org/show_bug.cgi?id=36182

This pair of patches applies cleanly back to Linux-3.3.

Documentation/kernel-parameters.txt | 2 ++
arch/x86/kernel/cpu/mcheck/therm_throt.c | 43 ++++++++++++++++++++++++++-----------------

 2 files changed, 28 insertions(+), 17 deletions(-)

This pair of patches applies cleanly back to Linux-3.3.

Fenghua Yu (2):
[1/2] x86 thermal: Delete power-limit-notification console messages [2/2] x86 thermal: Disable power limit notification interrupt by default

#3 lore raw

PATCH 1/2 x86 thermal: Delete power-limit-notification console messages

In reply to Len Brown

From: Fenghua Yu <[email protected]>

Package power limits are common on some systems under some conditions -- so printing console messages when limits are reached
causes unnecessary customer concern and support calls.

Note that even with these console messages gone, the events can still be observed via system counters:

$ grep TRM /proc/interrupts

Shows total thermal interrupts, which includes both power limit notifications and thermal throttling interrupts.

$ grep . /sys/devices/system/cpu/cpu*/thermal_throttle/*

Will show what caused those interrupts, core and package throttling and power limit notifications.

https://bugzilla.kernel.org/show_bug.cgi?id=36182

---
 arch/x86/kernel/cpu/mcheck/therm_throt.c | 9 ---------
 1 file changed, 9 deletions(-)
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -9
index 47a1870..68fa890 100644
@@ -181,11 +181,6 @@ static int therm_throt_process(bool new_event, int event, int level)
 				this_cpu,
 				level == CORE_LEVEL ? "Core" : "Package",
 				state->count);
-		else
-			printk(KERN_CRIT "CPU%d: %s power limit notification (total events = %lu)\n",
-				this_cpu,
-				level == CORE_LEVEL ? "Core" : "Package",
-				state->count);
 		return 1;
 	}
 	if (old_event) {
@@ -193,10 +188,6 @@ static int therm_throt_process(bool new_event, int event, int level)
 			printk(KERN_INFO "CPU%d: %s temperature/speed normal\n",
 				this_cpu,
 				level == CORE_LEVEL ? "Core" : "Package");
-		else
-			printk(KERN_INFO "CPU%d: %s power limit normal\n",
-				this_cpu,
-				level == CORE_LEVEL ? "Core" : "Package");
 		return 1;
 	}
 
Signature · 1 line
1.8.3.rc2
#4 lore raw

PATCH 2/2 x86 thermal: Disable power limit notification interrupt by default

From: Fenghua Yu <[email protected]>

The package power limit notification interrupt is primarily for system diagnosis, and should not be blindly enabled on every system by default -- particuarly since Linux does nothing in the handler except count how many times it has been called...

Add a new kernel cmdline parameter "int_pln_enable" for situations where users want to oberve these events via existing system counters:

$ grep TRM /proc/interrupts
$ grep . /sys/devices/system/cpu/cpu*/thermal_throttle/*

https://bugzilla.kernel.org/show_bug.cgi?id=36182

---
 Documentation/kernel-parameters.txt      |  2 ++
 arch/x86/kernel/cpu/mcheck/therm_throt.c | 34 ++++++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 8 deletions(-)
Documentation/kernel-parameters.txt +2 -0
index 8ccbf27..217165b 100644
@@ -1130,6 +1130,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	inport.irq=	[HW] Inport (ATI XL and Microsoft) busmouse driver
 			Format: <irq>
 
+	int_pln_enable  [x86] Enable power limit notification interrupt
+
 	intel_iommu=	[DMAR] Intel IOMMU driver (DMAR) option
 		on
 			Enable intel iommu driver.
arch/x86/kernel/cpu/mcheck/therm_throt.c +26 -8
index 68fa890..f7feb2e 100644
@@ -210,6 +210,15 @@ static int thresh_event_valid(int event)
 	return 1;
 }
 
+static bool int_pln_enable;
+static int __init int_pln_enable_setup(char *s)
+{
+	int_pln_enable = true;
+
+	return 1;
+}
+__setup("int_pln_enable", int_pln_enable_setup);
+
 #ifdef CONFIG_SYSFS
 /* Add/Remove thermal_throttle interface for CPU device: */
 static __cpuinit int thermal_throttle_add_dev(struct device *dev,
@@ -222,7 +231,7 @@ static __cpuinit int thermal_throttle_add_dev(struct device *dev,
 	if (err)
 		return err;
 
-	if (cpu_has(c, X86_FEATURE_PLN))
+	if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
 		err = sysfs_add_file_to_group(&dev->kobj,
 					      &dev_attr_core_power_limit_count.attr,
 					      thermal_attr_group.name);
@@ -230,7 +239,7 @@ static __cpuinit int thermal_throttle_add_dev(struct device *dev,
 		err = sysfs_add_file_to_group(&dev->kobj,
 					      &dev_attr_package_throttle_count.attr,
 					      thermal_attr_group.name);
-		if (cpu_has(c, X86_FEATURE_PLN))
+		if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
 			err = sysfs_add_file_to_group(&dev->kobj,
 					&dev_attr_package_power_limit_count.attr,
 					thermal_attr_group.name);
@@ -343,7 +352,7 @@ static void intel_thermal_interrupt(void)
 				CORE_LEVEL) != 0)
 		mce_log_therm_throt_event(msr_val);
 
-	if (this_cpu_has(X86_FEATURE_PLN))
+	if (this_cpu_has(X86_FEATURE_PLN) && int_pln_enable)
 		therm_throt_process(msr_val & THERM_STATUS_POWER_LIMIT,
 					POWER_LIMIT_EVENT,
 					CORE_LEVEL);
@@ -353,7 +362,7 @@ static void intel_thermal_interrupt(void)
 		therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT,
 					THERMAL_THROTTLING_EVENT,
 					PACKAGE_LEVEL);
-		if (this_cpu_has(X86_FEATURE_PLN))
+		if (this_cpu_has(X86_FEATURE_PLN) && int_pln_enable)
 			therm_throt_process(msr_val &
 					PACKAGE_THERM_STATUS_POWER_LIMIT,
 					POWER_LIMIT_EVENT,
@@ -461,9 +470,13 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
 	apic_write(APIC_LVTTHMR, h);
 
 	rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
-	if (cpu_has(c, X86_FEATURE_PLN))
+	if (cpu_has(c, X86_FEATURE_PLN) && !int_pln_enable)
+		wrmsr(MSR_IA32_THERM_INTERRUPT,
+			(l | (THERM_INT_LOW_ENABLE
+			| THERM_INT_HIGH_ENABLE)) & ~THERM_INT_PLN_ENABLE, h);
+	else if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
 		wrmsr(MSR_IA32_THERM_INTERRUPT,
-		      l | (THERM_INT_LOW_ENABLE
+			l | (THERM_INT_LOW_ENABLE
 			| THERM_INT_HIGH_ENABLE | THERM_INT_PLN_ENABLE), h);
 	else
 		wrmsr(MSR_IA32_THERM_INTERRUPT,
@@ -471,9 +484,14 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
 
 	if (cpu_has(c, X86_FEATURE_PTS)) {
 		rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h);
-		if (cpu_has(c, X86_FEATURE_PLN))
+		if (cpu_has(c, X86_FEATURE_PLN) && !int_pln_enable)
 			wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT,
-			      l | (PACKAGE_THERM_INT_LOW_ENABLE
+				(l | (PACKAGE_THERM_INT_LOW_ENABLE
+				| PACKAGE_THERM_INT_HIGH_ENABLE))
+				& ~PACKAGE_THERM_INT_PLN_ENABLE, h);
+		else if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
+			wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT,
+				l | (PACKAGE_THERM_INT_LOW_ENABLE
 				| PACKAGE_THERM_INT_HIGH_ENABLE
 				| PACKAGE_THERM_INT_PLN_ENABLE), h);
 		else
Signature · 1 line
1.8.3.rc2
#5 lore raw

RE: [PATCH 1/2] x86 thermal: Delete power-limit-notification console messages

In reply to Len Brown

Hi Len/Fenghua,

Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Len Brown
Sent: Wednesday, May 22, 2013 1:05 AM
To: Zhang, Rui
Cc: [email protected]; Yu, Fenghua
Subject: [PATCH 1/2] x86 thermal: Delete power-limit-notification console messages

Quoted 6 lines

From: Fenghua Yu <[email protected]>

Package power limits are common on some systems under some conditions - -
so printing console messages when limits are reached
causes unnecessary customer concern and support calls.

We are facing the exact similar situation here, but on the Thermal throttling events. So, basically I am in support of this removal patch.

Quoted 8 lines

Note that even with these console messages gone, the events can still be observed via system counters:

$ grep TRM /proc/interrupts

Shows total thermal interrupts, which includes both power limit notifications and thermal throttling interrupts.

Yes, On the other hand, we can use these counters, and not print those console messages.

Quoted 7 lines
$ grep . /sys/devices/system/cpu/cpu*/thermal_throttle/*

Will show what caused those interrupts, core and package throttling and power limit notifications.

https://bugzilla.kernel.org/show_bug.cgi?id=36182

Thanks for the link ;)

Quoted 13 lines
---
 arch/x86/kernel/cpu/mcheck/therm_throt.c | 9 ---------
 1 file changed, 9 deletions(-)
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -0
index 47a1870..68fa890 100644

arch/x86/kernel/cpu/mcheck/therm_throt.c static int therm_throt_process(bool new_event, int · line 184

Quoted 4 lines
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -0
@@ -181,11 +181,6 @@ static int therm_throt_process(bool new_event, int
 event, int level)
 				this_cpu,
 				level == CORE_LEVEL ? "Core" : "Package",
 				state->count);

Here, can we remove the other print also ?
(The thermal throttling prints)

Thanks,
Durga

Quoted 30 lines
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -5
-		else
-			printk(KERN_CRIT "CPU%d: %s power limit
 notification (total events = %lu)\n",
-				this_cpu,
-				level == CORE_LEVEL ? "Core" : "Package",
-				state->count);
 		return 1;
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -4
 	}
 	if (old_event) {
@@ -193,10 +188,6 @@ static int therm_throt_process(bool new_event, int
 event, int level)
 			printk(KERN_INFO "CPU%d: %s temperature/speed
 normal\n",
 				this_cpu,
 				level == CORE_LEVEL ? "Core" : "Package");
-		else
-			printk(KERN_INFO "CPU%d: %s power limit
 normal\n",
-				this_cpu,
-				level == CORE_LEVEL ? "Core" : "Package");
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -1
 		return 1;
 	}
 
--

1.8.3.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

RE: [PATCH 1/2] x86 thermal: Delete power-limit-notification console messages

Quoted 22 lines

From: R, Durgadoss
Hi Len/Fenghua,

Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Len Brown
Sent: Wednesday, May 22, 2013 1:05 AM
To: Zhang, Rui
Cc: [email protected]; Yu, Fenghua
Subject: [PATCH 1/2] x86 thermal: Delete power-limit-notification

console

arch/x86/kernel/cpu/mcheck/therm_throt.c static int therm_throt_process(bool new_event,

Quoted 10 lines

messages

From: Fenghua Yu <[email protected]>

arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -0
index 47a1870..68fa890 100644
@@ -181,11 +181,6 @@ static int therm_throt_process(bool new_event,

int

Quoted 7 lines

arch/x86/kernel/cpu/mcheck/therm_throt.c static int therm_throt_process(bool new_event, int event, int level) · line 183

Quoted 4 lines
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -0
 event, int level)
 				this_cpu,
 				level == CORE_LEVEL ? "Core" : "Package",
 				state->count);

Here, can we remove the other print also ?
(The thermal throttling prints)

The thermal throttling is legacy code and users could use the printed info already. Adding Andi who wrote the thermal throttling code and may have more insight.

Thanks.

-Fenghua

#7 lore raw

Re: [PATCH 1/2] x86 thermal: Delete power-limit-notification console messages

In reply to Len Brown
Quoted 16 lines · Len Brown

From: Fenghua Yu <[email protected]>

Package power limits are common on some systems under some conditions -- so printing console messages when limits are reached
causes unnecessary customer concern and support calls.

Note that even with these console messages gone, the events can still be observed via system counters:

$ grep TRM /proc/interrupts

Shows total thermal interrupts, which includes both power limit notifications and thermal throttling interrupts.

$ grep . /sys/devices/system/cpu/cpu*/thermal_throttle/*
Quoted 7 lines

Will show what caused those interrupts, core and package throttling and power limit notifications.

https://bugzilla.kernel.org/show_bug.cgi?id=36182

who should take these two patches?

thanks,
rui

Quoted 31 lines
---
 arch/x86/kernel/cpu/mcheck/therm_throt.c | 9 ---------
 1 file changed, 9 deletions(-)
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -9
index 47a1870..68fa890 100644
@@ -181,11 +181,6 @@ static int therm_throt_process(bool new_event, int event, int level)
 				this_cpu,
 				level == CORE_LEVEL ? "Core" : "Package",
 				state->count);
-		else
-			printk(KERN_CRIT "CPU%d: %s power limit notification (total events = %lu)\n",
-				this_cpu,
-				level == CORE_LEVEL ? "Core" : "Package",
-				state->count);
 		return 1;
 	}
 	if (old_event) {
@@ -193,10 +188,6 @@ static int therm_throt_process(bool new_event, int event, int level)
 			printk(KERN_INFO "CPU%d: %s temperature/speed normal\n",
 				this_cpu,
 				level == CORE_LEVEL ? "Core" : "Package");
-		else
-			printk(KERN_INFO "CPU%d: %s power limit normal\n",
-				this_cpu,
-				level == CORE_LEVEL ? "Core" : "Package");
 		return 1;
 	}
 
#8 lore raw

RE: [PATCH 1/2] x86 thermal: Delete power-limit-notification console messages

Quoted 26 lines

From: Zhang, Rui
Sent: Monday, May 27, 2013 7:17 PM

Quoted 3 lines · Len Brown

From: Fenghua Yu <[email protected]>

Package power limits are common on some systems under some conditions

--

Quoted 18 lines

so printing console messages when limits are reached causes unnecessary customer concern and support calls.

Note that even with these console messages gone, the events can still be observed via system counters:

$ grep TRM /proc/interrupts

Shows total thermal interrupts, which includes both power limit notifications and thermal throttling interrupts.

$ grep . /sys/devices/system/cpu/cpu*/thermal_throttle/*

Will show what caused those interrupts, core and package throttling and power limit notifications.

https://bugzilla.kernel.org/show_bug.cgi?id=36182

Quoted 7 lines
Quoted 2 lines

who should take these two patches?

thanks,
rui

I don't see the patches in upstream or tip trees. Are the patches on track in upstream?

Thanks.

-Fenghua