[PATCH 1/3][RFC] devfreq: Core updates to support devices which can idle

2012-08-17 Thread Rajagopal Venkat
Prepare devfreq core framework to support devices which
can idle. When device idleness is detected perhaps through
runtime-pm, need some mechanism to suspend devfreq load
monitoring and resume when device is back online. Present
code continues monitoring unless device is removed from
devfreq core.

This patch introduces following updates,

- move device load monitoring logic to ondemand governor as
  it is specific to ondemand.
- devfreq core interacts with governors via events to perform
  specific actions. These events include start/stop devfreq,
  and frequency limit changes outside devfreq. This sets ground
  for adding suspend/resume events.
- use per device work instead of global work to monitor device
  load. This enables suspend/resume of device devfreq and
  reduces monitoring code complexity.
- Force devfreq users to set min/max supported frequencies in
  device profile to help governors to predict target frequecy
  with in limits.

The devfreq apis are not modified and are kept intact.

Signed-off-by: Rajagopal Venkat 
---
 Documentation/ABI/testing/sysfs-class-devfreq |  33 +-
 drivers/devfreq/devfreq.c | 418 --
 drivers/devfreq/governor.h|   6 +-
 drivers/devfreq/governor_performance.c|  34 +--
 drivers/devfreq/governor_powersave.c  |  31 +-
 drivers/devfreq/governor_simpleondemand.c | 216 +++--
 drivers/devfreq/governor_userspace.c  | 142 -
 include/linux/devfreq.h   |  56 ++--
 8 files changed, 398 insertions(+), 538 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-class-devfreq 
b/Documentation/ABI/testing/sysfs-class-devfreq
index 23d78b5..c083433 100644
--- a/Documentation/ABI/testing/sysfs-class-devfreq
+++ b/Documentation/ABI/testing/sysfs-class-devfreq
@@ -21,27 +21,32 @@ Description:
The /sys/class/devfreq/.../cur_freq shows the current
frequency of the corresponding devfreq object.
 
-What:  /sys/class/devfreq/.../central_polling
+What:  /sys/class/devfreq/.../max_freq
 Date:  September 2011
 Contact:   MyungJoo Ham 
 Description:
-   The /sys/class/devfreq/.../central_polling shows whether
-   the devfreq ojbect is using devfreq-provided central
-   polling mechanism or not.
+   The /sys/class/devfreq/.../max_freq shows the current
+   max frequency of the corresponding devfreq object. This
+   max frequency is guaranteed to be with in device
+   operating frequency limits.
 
-What:  /sys/class/devfreq/.../polling_interval
+What:  /sys/class/devfreq/.../min_freq
 Date:  September 2011
 Contact:   MyungJoo Ham 
 Description:
-   The /sys/class/devfreq/.../polling_interval shows and sets
-   the requested polling interval of the corresponding devfreq
-   object. The values are represented in ms. If the value is
-   less than 1 jiffy, it is considered to be 0, which means
-   no polling. This value is meaningless if the governor is
-   not polling; thus. If the governor is not using
-   devfreq-provided central polling
-   (/sys/class/devfreq/.../central_polling is 0), this value
-   may be useless.
+   The /sys/class/devfreq/.../min_freq shows the current
+   min frequency of the corresponding devfreq object. This
+   min frequency is guaranteed to be with in device
+   operating frequency limits.
+
+What:  /sys/class/devfreq/.../ondemand/polling_interval
+Date:  September 2011
+Contact:   MyungJoo Ham 
+Description:
+   The /sys/class/devfreq/.../ondemand/polling_interval shows
+   and sets the requested polling interval of the corresponding
+   devfreq object if ondemand governor is in effect. The values
+   are represented in ms.
 
 What:  /sys/class/devfreq/.../userspace/set_freq
 Date:  September 2011
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 70c31d4..5aa23a8 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -11,7 +11,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -20,28 +19,12 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include "governor.h"
 
 struct class *devfreq_class;
 
-/*
- * devfreq_work periodically monitors every registered device.
- * The minimum polling interval is one jiffy. The polling interval is
- * determined by the minimum polling period among all polling devfreq
- * devices. The resolution of polling interval is one jiffy.
- */
-static bool polling;
-static struct workqueue_struct *devfreq_wq;
-static struct delayed_work devfreq_work;
-
-/* wait removing if this is to be removed */
-static struct 

[PATCH 3/3][RFC] devfreq: Add current freq callback in device profile

2012-08-17 Thread Rajagopal Venkat
Devfreq returns governor predicted frequency as current
frequency via sysfs interface. But device may not support
all frequencies that governor predicts. As per the design
its driver responsibility to maintain current frequency
at which device is operating. So add a callback in device
profile to fix this.

Signed-off-by: Rajagopal Venkat 
---
 drivers/devfreq/devfreq.c | 14 --
 include/linux/devfreq.h   |  6 +++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 375b5aa1..798e8ca 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -176,7 +176,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
devfreq->dev.release = devfreq_dev_release;
devfreq->profile = profile;
devfreq->governor = governor;
-   devfreq->previous_freq = profile->initial_freq;
devfreq->governor_data = data;
devfreq->nb.notifier_call = devfreq_notifier_call;
devfreq->min_freq = profile->min_freq;
@@ -272,7 +271,18 @@ static ssize_t show_governor(struct device *dev,
 static ssize_t show_freq(struct device *dev,
 struct device_attribute *attr, char *buf)
 {
-   return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq);
+   int ret;
+   unsigned long freq;
+   struct devfreq *devfreq = to_devfreq(dev);
+
+   if (devfreq->profile->get_cur_freq) {
+   ret = devfreq->profile->get_cur_freq(devfreq->dev.parent,
+   &freq);
+   if (!ret)
+   return sprintf(buf, "%lu\n", freq);
+   }
+
+   return sprintf(buf, "");
 }
 
 static ssize_t store_min_freq(struct device *dev, struct device_attribute 
*attr,
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 7c6517f..43f111f 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -76,6 +76,8 @@ struct devfreq_dev_status {
  * explained above with "DEVFREQ_FLAG_*" macros.
  * @get_dev_status The device should provide the current performance
  * status to devfreq, which is used by governors.
+ * @get_cur_freq   The device should provide the current frequency
+ * at which it is operating.
  * @exit   An optional callback that is called when devfreq
  * is removing the devfreq object due to error or
  * from devfreq_remove_device() call. If the user
@@ -91,6 +93,7 @@ struct devfreq_dev_profile {
int (*target)(struct device *dev, unsigned long *freq, u32 flags);
int (*get_dev_status)(struct device *dev,
  struct devfreq_dev_status *stat);
+   int (*get_cur_freq)(struct device *dev, unsigned long *freq);
void (*exit)(struct device *dev);
 };
 
@@ -119,7 +122,6 @@ struct devfreq_governor {
  * @nb notifier block used to notify devfreq object that it should
  * reevaluate operable frequencies. Devfreq users may use
  * devfreq.nb to the corresponding register notifier call chain.
- * @previous_freq  previously configured frequency value.
  * @governor_data  Private data of the governor. The devfreq framework
  * does not touch this.
  * @min_freq   Limit minimum frequency requested by user (0: none)
@@ -142,8 +144,6 @@ struct devfreq {
const struct devfreq_governor *governor;
struct notifier_block nb;
 
-   unsigned long previous_freq;
-
void *governor_data; /* private data for governors */
 
unsigned long min_freq;
-- 
1.7.11.3


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


[PATCH 2/3][RFC] devfreq: Add suspend and resume apis

2012-08-17 Thread Rajagopal Venkat
This patch adds suspend and resume apis needed
for devices which can idle. Suspend/resume apis
are called from driver to suspend/resume devfreq
load monitoring of that device.

Signed-off-by: Rajagopal Venkat 
---
 drivers/devfreq/devfreq.c | 30 ++
 drivers/devfreq/governor_simpleondemand.c | 15 +++
 include/linux/devfreq.h   | 16 
 3 files changed, 61 insertions(+)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 5aa23a8..375b5aa1 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -233,6 +233,36 @@ int devfreq_remove_device(struct devfreq *devfreq)
 }
 EXPORT_SYMBOL(devfreq_remove_device);
 
+/**
+ * devfreq_suspend_device() - Suspend devfreq of a device.
+ * @devfreqthe devfreq instance to be suspended
+ */
+int devfreq_suspend_device(struct devfreq *devfreq)
+{
+   if (!devfreq)
+   return -EINVAL;
+
+   devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_SUSPEND);
+
+   return 0;
+}
+EXPORT_SYMBOL(devfreq_suspend_device);
+
+/**
+ * devfreq_resume_device() - Resume devfreq of a device.
+ * @devfreqthe devfreq instance to be resumed
+ */
+int devfreq_resume_device(struct devfreq *devfreq)
+{
+   if (!devfreq)
+   return -EINVAL;
+
+   devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_RESUME);
+
+   return 0;
+}
+EXPORT_SYMBOL(devfreq_resume_device);
+
 static ssize_t show_governor(struct device *dev,
 struct device_attribute *attr, char *buf)
 {
diff --git a/drivers/devfreq/governor_simpleondemand.c 
b/drivers/devfreq/governor_simpleondemand.c
index 7c70c30..95e4db9 100644
--- a/drivers/devfreq/governor_simpleondemand.c
+++ b/drivers/devfreq/governor_simpleondemand.c
@@ -221,6 +221,21 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
ondemand_exit(df);
break;
 
+   case DEVFREQ_GOV_SUSPEND:
+   if (delayed_work_pending(&data->work)) {
+   data->stop_queuing = true;
+   cancel_delayed_work_sync(&data->work);
+   }
+   break;
+
+   case DEVFREQ_GOV_RESUME:
+   if (!delayed_work_pending(&data->work)) {
+   data->stop_queuing = false;
+   queue_delayed_work(devfreq_wq, &data->work,
+   msecs_to_jiffies(df->profile->polling_ms));
+   }
+   break;
+
case DEVFREQ_GOV_LIMITS:
if (delayed_work_pending(&data->work)) {
mutex_lock(&df->lock);
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 600cc2e..7c6517f 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -56,6 +56,8 @@ struct devfreq_dev_status {
 #define DEVFREQ_GOV_START  0x1
 #define DEVFREQ_GOV_STOP   0x2
 #define DEVFREQ_GOV_LIMITS 0x3
+#define DEVFREQ_GOV_SUSPEND0x4
+#define DEVFREQ_GOV_RESUME 0x5
 
 /**
  * struct devfreq_dev_profile - Devfreq's user device profile
@@ -155,6 +157,10 @@ extern struct devfreq *devfreq_add_device(struct device 
*dev,
  void *data);
 extern int devfreq_remove_device(struct devfreq *devfreq);
 
+extern int devfreq_suspend_device(struct devfreq *devfreq);
+
+extern int devfreq_resume_device(struct devfreq *devfreq);
+
 /* Helper functions for devfreq user device driver with OPP. */
 extern struct opp *devfreq_recommended_opp(struct device *dev,
   unsigned long *freq, u32 flags);
@@ -207,6 +213,16 @@ static int devfreq_remove_device(struct devfreq *devfreq)
return 0;
 }
 
+static int devfreq_suspend_device(struct devfreq *devfreq)
+{
+   return 0;
+}
+
+extern int devfreq_resume_device(struct devfreq *devfreq)
+{
+   return 0;
+}
+
 static struct opp *devfreq_recommended_opp(struct device *dev,
   unsigned long *freq, u32 flags)
 {
-- 
1.7.11.3


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


[PATCH 0/3][RFC] devfreq: Add support for devices which can idle

2012-08-17 Thread Rajagopal Venkat
This patchset updates devfreq core to add support for devices
which can idle. When device idleness is detected perhaps
through runtime-pm, need some mechanism to suspend devfreq
load monitoring and resume when device is back online.

patch 1 adds core design changes mainly moving monitoring
logic to ondemand governor, introducing per device work
and events for core to governor communication.
patch 2 adds devfreq suspend and resume apis.
patch 3 does current frequency bug fix.

The existing devfreq apis are kept intact. Two new apis
devfreq_suspend_device() and devfreq_resume_device() are
added to support suspend/resume of device devfreq.

--
Rajagopal Venkat (3):
  devfreq: core updates to support devices which can idle
  devfreq: Add suspend and resume apis
  devfreq: Add current freq callback in device profile

 Documentation/ABI/testing/sysfs-class-devfreq |  33 +-
 drivers/devfreq/devfreq.c | 448 ++
 drivers/devfreq/governor.h|   6 +-
 drivers/devfreq/governor_performance.c|  34 +-
 drivers/devfreq/governor_powersave.c  |  31 +-
 drivers/devfreq/governor_simpleondemand.c | 231 +++--
 drivers/devfreq/governor_userspace.c  | 142 
 include/linux/devfreq.h   |  78 +++--
 8 files changed, 467 insertions(+), 536 deletions(-)

-- 
1.7.11.3


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


Re: Change in floating point performance across kernels

2012-08-17 Thread Mans Rullgard
On 17 August 2012 00:37, Michael Hope  wrote:
> Hi there.  I'm seeing a huge improvement in the SPEC floating point
> benchmarks between a hacked Ubuntu Precise 3.2.14 kernel and Linus
> 3.5.  Does anyone know why off the top of their head?

Hacked how?  How big a change?  What does perf say?

-- 
Mans Rullgard / mru

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


Re: Can't view the lava information from android-build for some builds

2012-08-17 Thread Paul Sokolovsky
Hello,

On Fri, 17 Aug 2012 11:18:36 +0800
YongQin Liu  wrote:

> Hi,
> 
> Just found that I can't view the lava result on android-build page for
> some build.
> but not all of them, I still can view some the information of some
> builds before.
> say the builds of
> https://android-build.linaro.org/builds/~linaro-android/snowball-jb-gcc47-igloo-stable-blob/.
> For the build #28 even I click the " login to LAVA " link and logged
> in, I still get this information like the NG.png attachment file.
> But for the build #26, I can see the lava information listed. Like the
> attached OK.png file

I was not logged into LAVA when I started, logged in from build details
page, and am able to see test results for both #26 and #28 (also tried
#25-#29). So, my guess would be that browser caches content - I saw
such issue on few occasions on android-build.linaro.org . So, please
try Shift+Reload in browser (i.e. click reload button with shift held),
or Ctrl+R few times in row and see if it helps. If you still see that
issue, I'd suggest opening bug at
https://bugs.launchpad.net/linaro-android-infrastructure and Infra's
maintenance engineers will look into it.


-- 
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev