msm:rq_stats: Add hotplug disable attribute

Register for suspend and resume notifications from kernel. This should
be done as part of core_initcall so as to receive notification as close
as possible to the actual event. Add hotplug_disable attribute to
rq-stats node. Set/clear this attribute based on the suspend/resume events.

CRS-fixed: 452456
Change-Id: I76fee349b57f47df40785e9c2503e2e1cc6e064e
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
This commit is contained in:
Archana Sathyakumar 2013-02-20 10:35:35 -07:00 committed by Stephen Boyd
parent 0c040d1a73
commit a6e6c81490
2 changed files with 45 additions and 0 deletions

View file

@ -31,6 +31,7 @@
#include <linux/tick.h>
#include <asm/smp_plat.h>
#include "acpuclock.h"
#include <linux/suspend.h>
#define MAX_LONG_SIZE 24
#define DEFAULT_RQ_POLL_JIFFIES 1
@ -206,6 +207,34 @@ static int cpu_hotplug_handler(struct notifier_block *nb,
return NOTIFY_OK;
}
static int system_suspend_handler(struct notifier_block *nb,
unsigned long val, void *data)
{
switch (val) {
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
rq_info.hotplug_disabled = 0;
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
rq_info.hotplug_disabled = 1;
break;
default:
return NOTIFY_DONE;
}
return NOTIFY_OK;
}
static ssize_t hotplug_disable_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
unsigned int val = 0;
val = rq_info.hotplug_disabled;
return snprintf(buf, MAX_LONG_SIZE, "%d\n", val);
}
static struct kobj_attribute hotplug_disabled_attr = __ATTR_RO(hotplug_disable);
static void def_work_fn(struct work_struct *work)
{
int64_t diff;
@ -310,6 +339,7 @@ static struct attribute *rq_attrs[] = {
&def_timer_ms_attr.attr,
&run_queue_avg_attr.attr,
&run_queue_poll_ms_attr.attr,
&hotplug_disabled_attr.attr,
NULL,
};
@ -358,6 +388,7 @@ static int __init msm_rq_stats_init(void)
rq_info.def_timer_jiffies = DEFAULT_DEF_TIMER_JIFFIES;
rq_info.rq_poll_last_jiffy = 0;
rq_info.def_timer_last_jiffy = 0;
rq_info.hotplug_disabled = 0;
ret = init_rq_attribs();
rq_info.init = 1;
@ -380,3 +411,16 @@ static int __init msm_rq_stats_init(void)
return ret;
}
late_initcall(msm_rq_stats_init);
static int __init msm_rq_stats_early_init(void)
{
/* Bail out if this is not an SMP Target */
if (!is_smp()) {
rq_info.init = 0;
return -ENOSYS;
}
pm_notifier(system_suspend_handler, 0);
return 0;
}
core_initcall(msm_rq_stats_early_init);

View file

@ -19,6 +19,7 @@ struct rq_data {
unsigned long rq_poll_total_jiffies;
unsigned long def_timer_last_jiffy;
unsigned int def_interval;
unsigned int hotplug_disabled;
int64_t def_start_time;
struct attribute_group *attr_group;
struct kobject *kobj;