[meego-commits] 5442: Changes to Trunk:Testing/kernel
Arjan van de Ven
arjan at linux.intel.com
Thu Jul 8 22:42:15 UTC 2010
Hi,
I have made the following changes to kernel in project Trunk:Testing. Please review and accept ASAP.
Thank You,
Arjan van de Ven
[This message was auto-generated]
---
Request #5442:
submit: devel:kernel/kernel(r55) -> Trunk:Testing/kernel
Message:
adding a powermanagement accounting patch for powertop
State: new 2010-07-08T10:37:44 arjan
Comment: None
changes files:
--------------
--- kernel.changes
+++ kernel.changes
@@ -0,0 +1,3 @@
+* Thu Jul 08 2010 Arjan van de Ven <arjan at linux.intel.com> - 2.6.35-rc4
+- Add runtime PM accounting patch so that PowerTOP can report per device PM stats
+
new:
----
linux-2.6.35-runtime-pm-accounting.patch
spec files:
-----------
--- kernel-ivi.spec
+++ kernel-ivi.spec
@@ -341,6 +341,7 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+Patch705: linux-2.6.35-runtime-pm-accounting.patch
#
# End of the boot time and power patches
@@ -364,7 +365,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
-Patch705: linux-2.6.35-fatal-signals.patch
+Patch706: linux-2.6.35-fatal-signals.patch
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -683,6 +684,8 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+# linux-2.6.35-runtime-pm-accounting.patch
+%patch705 -p1
#
# End of the boot time and power patches
@@ -707,7 +710,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
# linux-2.6.35-fatal-signals.patch
-%patch705 -p1
+%patch706 -p1
# Drop some necessary files from the source dir into the buildroot
cp $RPM_SOURCE_DIR/config-* .
--- kernel-mrst.spec
+++ kernel-mrst.spec
@@ -342,6 +342,7 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+Patch705: linux-2.6.35-runtime-pm-accounting.patch
#
# End of the boot time and power patches
@@ -365,7 +366,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
-Patch705: linux-2.6.35-fatal-signals.patch
+Patch706: linux-2.6.35-fatal-signals.patch
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -684,6 +685,8 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+# linux-2.6.35-runtime-pm-accounting.patch
+%patch705 -p1
#
# End of the boot time and power patches
@@ -708,7 +711,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
# linux-2.6.35-fatal-signals.patch
-%patch705 -p1
+%patch706 -p1
# Drop some necessary files from the source dir into the buildroot
cp $RPM_SOURCE_DIR/config-* .
--- kernel-n900.spec
+++ kernel-n900.spec
@@ -341,6 +341,7 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+Patch705: linux-2.6.35-runtime-pm-accounting.patch
#
# End of the boot time and power patches
@@ -364,7 +365,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
-Patch705: linux-2.6.35-fatal-signals.patch
+Patch706: linux-2.6.35-fatal-signals.patch
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -683,6 +684,8 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+# linux-2.6.35-runtime-pm-accounting.patch
+%patch705 -p1
#
# End of the boot time and power patches
@@ -707,7 +710,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
# linux-2.6.35-fatal-signals.patch
-%patch705 -p1
+%patch706 -p1
# Drop some necessary files from the source dir into the buildroot
cp $RPM_SOURCE_DIR/config-* .
--- kernel-netbook.spec
+++ kernel-netbook.spec
@@ -341,6 +341,7 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+Patch705: linux-2.6.35-runtime-pm-accounting.patch
#
# End of the boot time and power patches
@@ -364,7 +365,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
-Patch705: linux-2.6.35-fatal-signals.patch
+Patch706: linux-2.6.35-fatal-signals.patch
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -683,6 +684,8 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+# linux-2.6.35-runtime-pm-accounting.patch
+%patch705 -p1
#
# End of the boot time and power patches
@@ -707,7 +710,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
# linux-2.6.35-fatal-signals.patch
-%patch705 -p1
+%patch706 -p1
# Drop some necessary files from the source dir into the buildroot
cp $RPM_SOURCE_DIR/config-* .
--- kernel.spec
+++ kernel.spec
@@ -353,6 +353,7 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+Patch705: linux-2.6.35-runtime-pm-accounting.patch
#
# End of the boot time and power patches
@@ -376,7 +377,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
-Patch705: linux-2.6.35-fatal-signals.patch
+Patch706: linux-2.6.35-fatal-signals.patch
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -725,6 +726,8 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+# linux-2.6.35-runtime-pm-accounting.patch
+%patch705 -p1
#
# End of the boot time and power patches
@@ -749,7 +752,7 @@
# turn on "print fatal signals" by default, so that we can debug /sbin/init
# crashes
# linux-2.6.35-fatal-signals.patch
-%patch705 -p1
+%patch706 -p1
# Drop some necessary files from the source dir into the buildroot
cp $RPM_SOURCE_DIR/config-* .
other changes:
--------------
++++++ config-generic
--- config-generic
+++ config-generic
@@ -3305,7 +3305,7 @@
# CONFIG_LKDTM is not set
# CONFIG_CRYPTO_PCRYPT is not set
-# CONFIG_PM_ADVANCED_DEBUG is not set
+CONFIG_PM_ADVANCED_DEBUG=y
# CONFIG_X86_PCC_CPUFREQ is not set
# CONFIG_I2C_SMBUS is not set
# CONFIG_VGA_SWITCHEROO is not set
++++++ linux-2.6.35-runtime-pm-accounting.patch (new)
--- linux-2.6.35-runtime-pm-accounting.patch
+++ linux-2.6.35-runtime-pm-accounting.patch
+From: Arjan van de Ven <arjan at linux.intel.com>
+Subject: [pm] Add runtime PM statistics
+
+For PowerTOP to be able to report how well the new runtime PM is working
+for the various drivers, the kernel needs to export some basic statistics.
+
+This patch adds two sysfs files in the runtime PM domain that expose
+the total time a device has been active and suspended.
+
+With this PowerTOP can do
+
+Active %age = 100 * (delta in active) / (delta active + delta suspended)
+
+and present the information to the user for all devices in the system.
+
+
+Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
+
+
+diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
+index b0ec0e9..1b36bec 100644
+--- a/drivers/base/power/runtime.c
++++ b/drivers/base/power/runtime.c
+@@ -123,6 +123,24 @@ int pm_runtime_idle(struct device *dev)
+ }
+ EXPORT_SYMBOL_GPL(pm_runtime_idle);
+
++void update_pm_runtime_accounting(struct device *dev)
++{
++ unsigned long now = jiffies;
++ int delta;
++
++ delta = now - dev->power.accounting_timestamp;
++
++ if (delta < 0)
++ delta = 0;
++
++ dev->power.accounting_timestamp = now;
++
++ if (dev->power.runtime_status == RPM_SUSPENDED)
++ dev->power.suspended_jiffies += delta;
++ else
++ dev->power.active_jiffies += delta;
++}
++
+ /**
+ * __pm_runtime_suspend - Carry out run-time suspend of given device.
+ * @dev: Device to suspend.
+@@ -237,6 +255,7 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq)
+ pm_runtime_cancel_pending(dev);
+ }
+ } else {
++ update_pm_runtime_accounting(dev);
+ dev->power.runtime_status = RPM_SUSPENDED;
+ pm_runtime_deactivate_timer(dev);
+
+@@ -411,6 +430,7 @@ int __pm_runtime_resume(struct device *dev, bool from_wq)
+ }
+
+ if (retval) {
++ update_pm_runtime_accounting(dev);
+ dev->power.runtime_status = RPM_SUSPENDED;
+ pm_runtime_cancel_pending(dev);
+ } else {
+@@ -1077,6 +1097,7 @@ void pm_runtime_init(struct device *dev)
+ dev->power.request_pending = false;
+ dev->power.request = RPM_REQ_NONE;
+ dev->power.deferred_resume = false;
++ dev->power.accounting_timestamp = jiffies;
+ INIT_WORK(&dev->power.work, pm_runtime_work);
+
+ dev->power.timer_expires = 0;
+diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
+index a4c33bc..f45c316 100644
+--- a/drivers/base/power/sysfs.c
++++ b/drivers/base/power/sysfs.c
+@@ -6,6 +6,7 @@
+ #include <linux/string.h>
+ #include <linux/pm_runtime.h>
+ #include <asm/atomic.h>
++#include <linux/jiffies.h>
+ #include "power.h"
+
+ /*
+@@ -190,9 +191,34 @@ static ssize_t rtpm_status_show(struct device *dev,
+ return -EIO;
+ }
+
++static ssize_t rtpm_active_time_show(struct device *dev,
++ struct device_attribute *attr, char *buf)
++{
++ int ret;
++ spin_lock_irq(&dev->power.lock);
++ update_pm_runtime_accounting(dev);
++ ret = sprintf(buf, "%i\n", jiffies_to_msecs(dev->power.active_jiffies));
++ spin_unlock_irq(&dev->power.lock);
++ return ret;
++}
++
++static ssize_t rtpm_suspended_time_show(struct device *dev,
++ struct device_attribute *attr, char *buf)
++{
++ int ret;
++ spin_lock_irq(&dev->power.lock);
++ update_pm_runtime_accounting(dev);
++ ret = sprintf(buf, "%i\n",
++ jiffies_to_msecs(dev->power.suspended_jiffies));
++ spin_unlock_irq(&dev->power.lock);
++ return ret;
++}
++
+ static DEVICE_ATTR(runtime_usage, 0444, rtpm_usagecount_show, NULL);
+ static DEVICE_ATTR(runtime_active_kids, 0444, rtpm_children_show, NULL);
+ static DEVICE_ATTR(runtime_status, 0444, rtpm_status_show, NULL);
++static DEVICE_ATTR(runtime_active_time, 0444, rtpm_active_time_show, NULL);
++static DEVICE_ATTR(runtime_suspended_time, 0444, rtpm_suspended_time_show, NULL);
+ static DEVICE_ATTR(runtime_enabled, 0444, rtpm_enabled_show, NULL);
+
+ #endif
+@@ -234,6 +260,8 @@ static struct attribute * power_attrs[] = {
+ &dev_attr_async.attr,
+ #ifdef CONFIG_PM_RUNTIME
+ &dev_attr_runtime_usage.attr,
++ &dev_attr_runtime_suspended_time.attr,
++ &dev_attr_runtime_active_time.attr,
+ &dev_attr_runtime_active_kids.attr,
+ &dev_attr_runtime_status.attr,
+ &dev_attr_runtime_enabled.attr,
+diff --git a/include/linux/pm.h b/include/linux/pm.h
+index 8e258c7..dca597f 100644
+--- a/include/linux/pm.h
++++ b/include/linux/pm.h
+@@ -476,9 +476,15 @@ struct dev_pm_info {
+ enum rpm_request request;
+ enum rpm_status runtime_status;
+ int runtime_error;
++ unsigned long active_jiffies;
++ unsigned long suspended_jiffies;
++ unsigned long accounting_timestamp;
+ #endif
+ };
+
++extern void update_pm_runtime_accounting(struct device *dev);
++
++
+ /*
+ * The PM_EVENT_ messages are also used by drivers implementing the legacy
+ * suspend framework, based on the ->suspend() and ->resume() callbacks common
++++++ series
--- series
+++ series
@@ -186,6 +186,7 @@
#note: need to fix conflicts and merge these two patches into one
#linux-2.6.33-ahci-alpm-accounting.patch
#linux-2.6.33-ahci-fix-oops-on-dummy-port.patch
+linux-2.6.35-runtime-pm-accounting.patch
#
# End of the boot time and power patches
More information about the MeeGo-commits
mailing list