From b76b3479dab948bea0a98b6d263eb56d8f358528 Mon Sep 17 00:00:00 2001 From: Kamil Konieczny Date: Thu, 5 Dec 2019 15:55:25 +0100 Subject: PM / devfreq: Change time stats to 64-bit Change time stats counting to bigger type by using 64-bit jiffies. This will make devfreq stats code look similar to cpufreq stats and prevents overflow (for HZ = 1000 after 49.7 days). Signed-off-by: Kamil Konieczny Acked-by: Chanwoo Choi Signed-off-by: Chanwoo Choi --- include/linux/devfreq.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index fb376b5b7281..95816a8e3d26 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -177,8 +177,8 @@ struct devfreq { /* information for device frequency transition */ unsigned int total_trans; unsigned int *trans_table; - unsigned long *time_in_state; - unsigned long last_stat_updated; + u64 *time_in_state; + u64 last_stat_updated; struct srcu_notifier_head transition_notifier_list; -- cgit v1.2.3 From 1ebd0bc0e8adbfa548335d016ead922cc85fcecd Mon Sep 17 00:00:00 2001 From: Kamil Konieczny Date: Fri, 6 Dec 2019 13:46:39 +0900 Subject: PM / devfreq: Move statistics to separate struct devfreq_stats Count time and transitions between devfreq frequencies in separate struct devfreq_stats for improved code readability and maintenance. Signed-off-by: Kamil Konieczny Reviewed-by: Matthias Kaehlcke [cw00.choi: Fix the merge conflict in trasn_stat_store and use 'devfreq->stats.*' style for consistent coding style and restore the clean-up code of 'devfreq->profile->*'] Signed-off-by: Chanwoo Choi --- include/linux/devfreq.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 95816a8e3d26..9e73c84adf50 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -107,6 +107,20 @@ struct devfreq_dev_profile { unsigned int max_state; }; +/** + * struct devfreq_stats - Statistics of devfreq device behavior + * @total_trans: Number of devfreq transitions. + * @trans_table: Statistics of devfreq transitions. + * @time_in_state: Statistics of devfreq states. + * @last_update: The last time stats were updated. + */ +struct devfreq_stats { + unsigned int total_trans; + unsigned int *trans_table; + u64 *time_in_state; + u64 last_update; +}; + /** * struct devfreq - Device devfreq structure * @node: list node - contains the devices with devfreq that have been @@ -132,10 +146,7 @@ struct devfreq_dev_profile { * @suspend_freq: frequency of a device set during suspend phase. * @resume_freq: frequency of a device set in resume phase. * @suspend_count: suspend requests counter for a device. - * @total_trans: Number of devfreq transitions - * @trans_table: Statistics of devfreq transitions - * @time_in_state: Statistics of devfreq states - * @last_stat_updated: The last time stat updated + * @stats: Statistics of devfreq device behavior * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY @@ -174,11 +185,8 @@ struct devfreq { unsigned long resume_freq; atomic_t suspend_count; - /* information for device frequency transition */ - unsigned int total_trans; - unsigned int *trans_table; - u64 *time_in_state; - u64 last_stat_updated; + /* information for device frequency transitions */ + struct devfreq_stats stats; struct srcu_notifier_head transition_notifier_list; -- cgit v1.2.3 From 54cb5740526a2f30d57f146d8a17364c59287187 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sat, 14 Dec 2019 08:03:11 -0800 Subject: PM / devfreq: Fix multiple kernel-doc warnings Fix kernel-doc warnings in devfreq files. Also fix a typo. Signed-off-by: Randy Dunlap Signed-off-by: Chanwoo Choi --- include/linux/devfreq.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 9e73c84adf50..c6f82d4bec9f 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -136,6 +136,7 @@ struct devfreq_stats { * devfreq.nb to the corresponding register notifier call chain. * @work: delayed work for load monitoring. * @previous_freq: previously configured frequency value. + * @last_status: devfreq user device info, performance statistics * @data: Private data of the governor. The devfreq framework does not * touch this. * @user_min_freq_req: PM QoS minimum frequency request from user (via sysfs) @@ -151,7 +152,7 @@ struct devfreq_stats { * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY * - * This structure stores the devfreq information for a give device. + * This structure stores the devfreq information for a given device. * * Note that when a governor accesses entries in struct devfreq in its * functions except for the context of callbacks defined in struct -- cgit v1.2.3