From: Lukasz Luba <hidden> Date: 2018-12-03 14:31:34
Hi all,
This v2 patch set aims to address the issue with devfreq devices' frequency
during suspend/resume. It extends suspend/resume by calls to Devfreq
framework. In the devfreq framework there is a small refactoring to avoid
code duplication in changging frequency (patch 1) and there are extensions
for suspending devices. The suspending device has now chance to set proper
state when the system is going for suspend. This phase is the right place
to set needed frequences for the next resume process.
It has been tested on Odroid u3 with Exynos 4412.
The patch set draws on Tobias Jakobi's work posted ~2 years ago, who tried
to solve issue with devfreq device's frequency during suspend/resume.
During the discussion on LKML some corner cases and comments appeared
related to the design. This patch set address them keeping in mind
suggestions from Chanwoo Choi.
Tobias's paches:
https://www.spinics.net/lists/linux-samsung-soc/msg56602.html
Changes:
v2:
- refactored patchset and merget patch 1 and 3 as suggested by Chanwoo Choi,
- changed devfreq_{susped|resume}_device functions,
- added doxygen information for new entres in 'struct devfreq',
- devfreq_set_target skipped one argument, now resume_freq is set inside,
- minor changes addresing comments from maintainers regarding the style,
Regards,
Lukasz Luba
Lukasz Luba (5):
devfreq: refactor set_target frequency function
devfreq: add support for suspend/resume of a devfreq device
devfreq: add devfreq_suspend/resume() functions
drivers: power: suspend: call devfreq suspend/resume
arm: dts: exynos4: opp-suspend in DMC and leftbus
arch/arm/boot/dts/exynos4210.dtsi | 2 +
arch/arm/boot/dts/exynos4412.dtsi | 2 +
drivers/base/power/main.c | 3 +
drivers/devfreq/devfreq.c | 155 +++++++++++++++++++++++++++++---------
include/linux/devfreq.h | 13 ++++
5 files changed, 141 insertions(+), 34 deletions(-)
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Lukasz Luba <hidden> Date: 2018-12-03 14:31:36
The refactoring is needed for the new client in devfreq: suspend.
To avoid code duplication, move it to the new local function
devfreq_set_target.
The patch is based on earlier work by Tobias Jakobi.
Suggested-by: Tobias Jakobi <redacted>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <redacted>
---
drivers/devfreq/devfreq.c | 62 +++++++++++++++++++++++++++--------------------
1 file changed, 36 insertions(+), 26 deletions(-)
@@ -285,6 +285,40 @@ static int devfreq_notify_transition(struct devfreq *devfreq,return0;}+staticintdevfreq_set_target(structdevfreq*devfreq,unsignedlongnew_freq,+u32flags)+{+structdevfreq_freqsfreqs;+unsignedlongcur_freq;+interr=0;++if(devfreq->profile->get_cur_freq)+devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);+else+cur_freq=devfreq->previous_freq;++freqs.old=cur_freq;+freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);++err=devfreq->profile->target(devfreq->dev.parent,&new_freq,flags);+if(err){+freqs.new=cur_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);+returnerr;+}++freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);++if(devfreq_update_status(devfreq,new_freq))+dev_err(&devfreq->dev,+"Couldn't update frequency transition information.\n");++devfreq->previous_freq=new_freq;+returnerr;+}+/* Load monitoring helper functions for governors use *//**
@@ -296,8 +330,7 @@ static int devfreq_notify_transition(struct devfreq *devfreq,*/intupdate_devfreq(structdevfreq*devfreq){-structdevfreq_freqsfreqs;-unsignedlongfreq,cur_freq,min_freq,max_freq;+unsignedlongfreq,min_freq,max_freq;interr=0;u32flags=0;
@@ -333,31 +366,8 @@ int update_devfreq(struct devfreq *devfreq)flags|=DEVFREQ_FLAG_LEAST_UPPER_BOUND;/* Use LUB */}-if(devfreq->profile->get_cur_freq)-devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);-else-cur_freq=devfreq->previous_freq;--freqs.old=cur_freq;-freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);+returndevfreq_set_target(devfreq,freq,flags);-err=devfreq->profile->target(devfreq->dev.parent,&freq,flags);-if(err){-freqs.new=cur_freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);-returnerr;-}--freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);--if(devfreq_update_status(devfreq,freq))-dev_err(&devfreq->dev,-"Couldn't update frequency transition information.\n");--devfreq->previous_freq=freq;-returnerr;}EXPORT_SYMBOL(update_devfreq);
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Lukasz,
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
The refactoring is needed for the new client in devfreq: suspend.
To avoid code duplication, move it to the new local function
devfreq_set_target.
The patch is based on earlier work by Tobias Jakobi.
As I already commented, Please remove it. You already mentioned it on cover-letter.
If you want to contain the contribution history of Tobias, you might better
to add 'Signed-off-by' or others.
@@ -285,6 +285,40 @@ static int devfreq_notify_transition(struct devfreq *devfreq,return0;}+staticintdevfreq_set_target(structdevfreq*devfreq,unsignedlongnew_freq,+u32flags)+{+structdevfreq_freqsfreqs;+unsignedlongcur_freq;+interr=0;++if(devfreq->profile->get_cur_freq)+devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);+else+cur_freq=devfreq->previous_freq;++freqs.old=cur_freq;+freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);++err=devfreq->profile->target(devfreq->dev.parent,&new_freq,flags);+if(err){+freqs.new=cur_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);+returnerr;+}++freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);++if(devfreq_update_status(devfreq,new_freq))+dev_err(&devfreq->dev,+"Couldn't update frequency transition information.\n");++devfreq->previous_freq=new_freq;+returnerr;+}+/* Load monitoring helper functions for governors use *//**
@@ -296,8 +330,7 @@ static int devfreq_notify_transition(struct devfreq *devfreq,*/intupdate_devfreq(structdevfreq*devfreq){-structdevfreq_freqsfreqs;-unsignedlongfreq,cur_freq,min_freq,max_freq;+unsignedlongfreq,min_freq,max_freq;interr=0;u32flags=0;
@@ -333,31 +366,8 @@ int update_devfreq(struct devfreq *devfreq)flags|=DEVFREQ_FLAG_LEAST_UPPER_BOUND;/* Use LUB */}-if(devfreq->profile->get_cur_freq)-devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);-else-cur_freq=devfreq->previous_freq;--freqs.old=cur_freq;-freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);+returndevfreq_set_target(devfreq,freq,flags);-err=devfreq->profile->target(devfreq->dev.parent,&freq,flags);-if(err){-freqs.new=cur_freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);-returnerr;-}--freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);--if(devfreq_update_status(devfreq,freq))-dev_err(&devfreq->dev,-"Couldn't update frequency transition information.\n");--devfreq->previous_freq=freq;-returnerr;}EXPORT_SYMBOL(update_devfreq);
Hi Lukasz,
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The refactoring is needed for the new client in devfreq: suspend.
To avoid code duplication, move it to the new local function
devfreq_set_target.
The patch is based on earlier work by Tobias Jakobi.
As I already commented, Please remove it. You already mentioned it on cover-letter.
If you want to contain the contribution history of Tobias, you might better
to add 'Signed-off-by' or others.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
@@ -285,6 +285,40 @@ static int devfreq_notify_transition(struct devfreq *devfreq,return0;}+staticintdevfreq_set_target(structdevfreq*devfreq,unsignedlongnew_freq,+u32flags)+{+structdevfreq_freqsfreqs;+unsignedlongcur_freq;+interr=0;++if(devfreq->profile->get_cur_freq)+devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);+else+cur_freq=devfreq->previous_freq;++freqs.old=cur_freq;+freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);++err=devfreq->profile->target(devfreq->dev.parent,&new_freq,flags);+if(err){+freqs.new=cur_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);+returnerr;+}++freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);++if(devfreq_update_status(devfreq,new_freq))+dev_err(&devfreq->dev,+"Couldn't update frequency transition information.\n");++devfreq->previous_freq=new_freq;+returnerr;+}+/* Load monitoring helper functions for governors use *//**
@@ -296,8 +330,7 @@ static int devfreq_notify_transition(struct devfreq *devfreq,*/intupdate_devfreq(structdevfreq*devfreq){-structdevfreq_freqsfreqs;-unsignedlongfreq,cur_freq,min_freq,max_freq;+unsignedlongfreq,min_freq,max_freq;interr=0;u32flags=0;
@@ -333,31 +366,8 @@ int update_devfreq(struct devfreq *devfreq)flags|=DEVFREQ_FLAG_LEAST_UPPER_BOUND;/* Use LUB */}-if(devfreq->profile->get_cur_freq)-devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);-else-cur_freq=devfreq->previous_freq;--freqs.old=cur_freq;-freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);+returndevfreq_set_target(devfreq,freq,flags);-err=devfreq->profile->target(devfreq->dev.parent,&freq,flags);-if(err){-freqs.new=cur_freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);-returnerr;-}--freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);--if(devfreq_update_status(devfreq,freq))-dev_err(&devfreq->dev,-"Couldn't update frequency transition information.\n");--devfreq->previous_freq=freq;-returnerr;}EXPORT_SYMBOL(update_devfreq);
From: Lukasz Luba <hidden> Date: 2018-12-04 09:37:00
Hi Chanwoo,
On 12/4/18 5:39 AM, Chanwoo Choi wrote:
Hi Lukasz,
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The refactoring is needed for the new client in devfreq: suspend.
To avoid code duplication, move it to the new local function
devfreq_set_target.
The patch is based on earlier work by Tobias Jakobi.
As I already commented, Please remove it. You already mentioned it on cover-letter.
If you want to contain the contribution history of Tobias, you might better
to add 'Signed-off-by' or others.
@@ -285,6 +285,40 @@ static int devfreq_notify_transition(struct devfreq *devfreq,return0;}+staticintdevfreq_set_target(structdevfreq*devfreq,unsignedlongnew_freq,+u32flags)+{+structdevfreq_freqsfreqs;+unsignedlongcur_freq;+interr=0;++if(devfreq->profile->get_cur_freq)+devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);+else+cur_freq=devfreq->previous_freq;++freqs.old=cur_freq;+freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);++err=devfreq->profile->target(devfreq->dev.parent,&new_freq,flags);+if(err){+freqs.new=cur_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);+returnerr;+}++freqs.new=new_freq;+devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);++if(devfreq_update_status(devfreq,new_freq))+dev_err(&devfreq->dev,+"Couldn't update frequency transition information.\n");++devfreq->previous_freq=new_freq;+returnerr;+}+/* Load monitoring helper functions for governors use *//**
@@ -296,8 +330,7 @@ static int devfreq_notify_transition(struct devfreq *devfreq,*/intupdate_devfreq(structdevfreq*devfreq){-structdevfreq_freqsfreqs;-unsignedlongfreq,cur_freq,min_freq,max_freq;+unsignedlongfreq,min_freq,max_freq;interr=0;u32flags=0;
@@ -333,31 +366,8 @@ int update_devfreq(struct devfreq *devfreq)flags|=DEVFREQ_FLAG_LEAST_UPPER_BOUND;/* Use LUB */}-if(devfreq->profile->get_cur_freq)-devfreq->profile->get_cur_freq(devfreq->dev.parent,&cur_freq);-else-cur_freq=devfreq->previous_freq;--freqs.old=cur_freq;-freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_PRECHANGE);+returndevfreq_set_target(devfreq,freq,flags);-err=devfreq->profile->target(devfreq->dev.parent,&freq,flags);-if(err){-freqs.new=cur_freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);-returnerr;-}--freqs.new=freq;-devfreq_notify_transition(devfreq,&freqs,DEVFREQ_POSTCHANGE);--if(devfreq_update_status(devfreq,freq))-dev_err(&devfreq->dev,-"Couldn't update frequency transition information.\n");--devfreq->previous_freq=freq;-returnerr;}EXPORT_SYMBOL(update_devfreq);
From: Lukasz Luba <hidden> Date: 2018-12-03 14:31:38
This patch adds implementation for global suspend/resume for
devfreq framework. System suspend will next use these functions.
The patch is based on earlier work by Tobias Jakobi.
Suggested-by: Tobias Jakobi <redacted>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <redacted>
---
drivers/devfreq/devfreq.c | 42 ++++++++++++++++++++++++++++++++++++++++++
include/linux/devfreq.h | 6 ++++++
2 files changed, 48 insertions(+)
Hi Lukasz,
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
This patch adds implementation for global suspend/resume for
devfreq framework. System suspend will next use these functions.
The patch is based on earlier work by Tobias Jakobi.
@@ -935,6 +935,48 @@ int devfreq_resume_device(struct devfreq *devfreq)EXPORT_SYMBOL(devfreq_resume_device);/**+*devfreq_suspend()-Suspenddevfreqgovernorsanddevices+*+*CalledduringsystemwideSuspend/Hibernatecyclesforsuspendinggovernors+*anddevicespreservingthestateforresume.Onsomeplatformsthedevfreq+*devicemusthaveprecisestate(frequency)afterresumeinordertoprovide+*fullyoperatingsetup.+*/+voiddevfreq_suspend(void)+{+structdevfreq*devfreq;+intret;++mutex_lock(&devfreq_list_lock);+list_for_each_entry(devfreq,&devfreq_list,node){+ret=devfreq_suspend_device(devfreq);+if(ret)+dev_warn(&devfreq->dev,"device suspend failed\n");
When I checked the cpufreq_suspend(), cpufreq_suspend() prints message as 'err' level.
I think that dev_err is more proper than dev_warn.
I'm not sure what is more correct log.
But, 'devfreq->dev' device has the separate suspend/resume function.
So, I think that devfreq_suspend() should print error log containing
that it is error by devfreq framework.
"device suspend failed"
-> "failed to suspend devfreq device"
+ }
+ mutex_unlock(&devfreq_list_lock);
+}
+
+/**
+ * devfreq_resume() - Resume devfreq governors and devices
+ *
+ * Called during system wide Suspend/Hibernate cycle for resuming governors and
+ * devices that are suspended with devfreq_suspend().
+ */
+void devfreq_resume(void)
+{
+ struct devfreq *devfreq;
+ int ret;
+
+ mutex_lock(&devfreq_list_lock);
+ list_for_each_entry(devfreq, &devfreq_list, node) {
+ ret = devfreq_resume_device(devfreq);
+ if (ret)
+ dev_warn(&devfreq->dev, "device resume failed\n");
ditto.
"device resume failed"
-> "failed to resume devfreq device"
quoted hunk
+ }
+ mutex_unlock(&devfreq_list_lock);
+}
+
+/**
* devfreq_add_governor() - Add devfreq governor
* @governor: the devfreq governor to be added
*/
From: Lukasz Luba <hidden> Date: 2018-12-04 09:44:56
Hi Chanwoo,
On 12/4/18 7:19 AM, Chanwoo Choi wrote:
Hi Lukasz,
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
This patch adds implementation for global suspend/resume for
devfreq framework. System suspend will next use these functions.
The patch is based on earlier work by Tobias Jakobi.
@@ -935,6 +935,48 @@ int devfreq_resume_device(struct devfreq *devfreq)EXPORT_SYMBOL(devfreq_resume_device);/**+*devfreq_suspend()-Suspenddevfreqgovernorsanddevices+*+*CalledduringsystemwideSuspend/Hibernatecyclesforsuspendinggovernors+*anddevicespreservingthestateforresume.Onsomeplatformsthedevfreq+*devicemusthaveprecisestate(frequency)afterresumeinordertoprovide+*fullyoperatingsetup.+*/+voiddevfreq_suspend(void)+{+structdevfreq*devfreq;+intret;++mutex_lock(&devfreq_list_lock);+list_for_each_entry(devfreq,&devfreq_list,node){+ret=devfreq_suspend_device(devfreq);+if(ret)+dev_warn(&devfreq->dev,"device suspend failed\n");
When I checked the cpufreq_suspend(), cpufreq_suspend() prints message as 'err' level.
I think that dev_err is more proper than dev_warn.
I'm not sure what is more correct log.
But, 'devfreq->dev' device has the separate suspend/resume function.
So, I think that devfreq_suspend() should print error log containing
that it is error by devfreq framework.
"device suspend failed"
-> "failed to suspend devfreq device"
OK, changed in next v3 patch set.
quoted
+ }
+ mutex_unlock(&devfreq_list_lock);
+}
+
+/**
+ * devfreq_resume() - Resume devfreq governors and devices
+ *
+ * Called during system wide Suspend/Hibernate cycle for resuming governors and
+ * devices that are suspended with devfreq_suspend().
+ */
+void devfreq_resume(void)
+{
+ struct devfreq *devfreq;
+ int ret;
+
+ mutex_lock(&devfreq_list_lock);
+ list_for_each_entry(devfreq, &devfreq_list, node) {
+ ret = devfreq_resume_device(devfreq);
+ if (ret)
+ dev_warn(&devfreq->dev, "device resume failed\n");
ditto.
"device resume failed"
-> "failed to resume devfreq device"
ACK
Regards,
Lukasz
quoted
+ }
+ mutex_unlock(&devfreq_list_lock);
+}
+
+/**
* devfreq_add_governor() - Add devfreq governor
* @governor: the devfreq governor to be added
*/
From: Lukasz Luba <hidden> Date: 2018-12-03 14:31:41
Devfreq framework supports suspend of its devices.
Call the the devfreq interface and allow devfreq devices preserve/restore
their states during suspend/resume.
The patch is based on earlier work by Tobias Jakobi.
Suggested-by: Tobias Jakobi <redacted>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <redacted>
---
drivers/base/power/main.c | 3 +++
1 file changed, 3 insertions(+)
From: Lukasz Luba <hidden> Date: 2018-12-03 14:31:42
Mark the state for devfreq device while entring suspend/resume process.
The patch is based on earlier work by Tobias Jakobi.
Suggested-by: Tobias Jakobi <redacted>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <redacted>
---
arch/arm/boot/dts/exynos4210.dtsi | 2 ++
arch/arm/boot/dts/exynos4412.dtsi | 2 ++
2 files changed, 4 insertions(+)
From: Krzysztof Kozlowski <krzk@kernel.org> Date: 2018-12-03 17:22:58
On Mon, Dec 03, 2018 at 03:31:15PM +0100, Lukasz Luba wrote:
Mark the state for devfreq device while entring suspend/resume process.
The patch is based on earlier work by Tobias Jakobi.
Suggested-by: Tobias Jakobi <redacted>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <redacted>
---
arch/arm/boot/dts/exynos4210.dtsi | 2 ++
arch/arm/boot/dts/exynos4412.dtsi | 2 ++
2 files changed, 4 insertions(+)
Thanks, applied with some minor commit msg changes. In general, please
take care about title prefix (git log --oneline
arch/arm/boot/dts/exynos*) and always explain why you are doing this.
You just mentioned "what" but that is pretty obvious by looking at
commit contents. The commit msg should answer why these should be marked
as opp-suspend and why these values were chosen.
The cover letter just briefly describes "issue with devfreq devices' frequency
during suspend/resume"... but what issue?
Best regards,
Krzysztof
From: Lukasz Luba <hidden> Date: 2018-12-03 17:49:01
Hi Krzysztof,
On 12/3/18 6:22 PM, Krzysztof Kozlowski wrote:
On Mon, Dec 03, 2018 at 03:31:15PM +0100, Lukasz Luba wrote:
quoted
Mark the state for devfreq device while entring suspend/resume process.
The patch is based on earlier work by Tobias Jakobi.
Suggested-by: Tobias Jakobi <redacted>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <redacted>
---
arch/arm/boot/dts/exynos4210.dtsi | 2 ++
arch/arm/boot/dts/exynos4412.dtsi | 2 ++
2 files changed, 4 insertions(+)
Thanks, applied with some minor commit msg changes. In general, please
take care about title prefix (git log --oneline
arch/arm/boot/dts/exynos*) and always explain why you are doing this.
Thank you that you have applied and for the hint.
You just mentioned "what" but that is pretty obvious by looking at
commit contents. The commit msg should answer why these should be marked
as opp-suspend and why these values were chosen.
The cover letter just briefly describes "issue with devfreq devices' frequency
during suspend/resume"... but what issue?
In the cover letter there is sentence:
'The suspending device has now chance to set proper
state when the system is going for suspend. This phase is the right place
to set needed frequences for the next resume process.'
Generally speaking, there is a need of setting the right
frequency/voltage, because we need that frequency during resume,
i.e. for booting CPUs (which are poked earlier during resume than the
buses in this design).
Regards,
Lukasz
From: Lukasz Luba <hidden> Date: 2018-12-03 14:32:00
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
process. Devfreq framework handles opp-suspend DT entry and there is no
need of modyfications in the drivers code. It uses atomic variables to
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
Suggested-by: Tobias Jakobi <redacted>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <redacted>
---
drivers/devfreq/devfreq.c | 51 +++++++++++++++++++++++++++++++++++++++--------
include/linux/devfreq.h | 7 +++++++
2 files changed, 50 insertions(+), 8 deletions(-)
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.
process. Devfreq framework handles opp-suspend DT entry and there is no
ditto.
need of modyfications in the drivers code. It uses atomic variables to
ditto.
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
Sorry. Fix typo 'choi' to 'Choi' as following.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.
quoted
process. Devfreq framework handles opp-suspend DT entry and there is no
ditto.
quoted
need of modyfications in the drivers code. It uses atomic variables to
ditto.
quoted
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
Hi Lukasz,
I add the comment about 'suspend_count'.
On 2018년 12월 04일 14:43, Chanwoo Choi wrote:
Hi,
On 2018년 12월 04일 14:36, Chanwoo Choi wrote:
quoted
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
Sorry. Fix typo 'choi' to 'Choi' as following.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
quoted
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.
quoted
process. Devfreq framework handles opp-suspend DT entry and there is no
ditto.
quoted
need of modyfications in the drivers code. It uses atomic variables to
ditto.
quoted
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
In this patch, if some users call 'devfreq_suspend_device' twice,
'devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_SUSPEND, NULL)'
is called twice but devfreq_set_target() is called only one.
I knew that it is no problem for operation.
But,
I think that you better to use 'suspend_count' as the reference count
of devfreq_suspend/resume_device(). But, if you use 'suspend_count'
in order to check whether this devfreq is suspended or not,
we can reduce the unneeded redundant call when calling it twice.
clock and regulator used the 'reference count' method in order to
remove the redundant call.
@@ -888,14 +909,28 @@ EXPORT_SYMBOL(devfreq_suspend_device); */ int devfreq_resume_device(struct devfreq *devfreq) {+ int ret;+ if (!devfreq) return -EINVAL;- if (!devfreq->governor)- return 0;+ if (devfreq->resume_freq) {+ if (atomic_dec_return(&devfreq->suspend_count) >= 1)+ return 0;
ditto.
quoted
quoted
- return devfreq->governor->event_handler(devfreq,
- DEVFREQ_GOV_RESUME, NULL);
+ ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
+ if (ret)
+ return ret;
+ }
+
+ if (devfreq->governor) {
+ ret = devfreq->governor->event_handler(devfreq,
+ DEVFREQ_GOV_RESUME, NULL);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
EXPORT_SYMBOL(devfreq_resume_device);
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
From: Lukasz Luba <hidden> Date: 2018-12-04 09:53:33
Hi Chanwoo,
On 12/4/18 7:10 AM, Chanwoo Choi wrote:
Hi Lukasz,
I add the comment about 'suspend_count'.
On 2018년 12월 04일 14:43, Chanwoo Choi wrote:
quoted
Hi,
On 2018년 12월 04일 14:36, Chanwoo Choi wrote:
quoted
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
Sorry. Fix typo 'choi' to 'Choi' as following.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
quoted
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.
quoted
process. Devfreq framework handles opp-suspend DT entry and there is no
ditto.
quoted
need of modyfications in the drivers code. It uses atomic variables to
ditto.
quoted
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
In this patch, if some users call 'devfreq_suspend_device' twice,
'devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_SUSPEND, NULL)'
is called twice but devfreq_set_target() is called only one.
I knew that it is no problem for operation.
But,
I think that you better to use 'suspend_count' as the reference count
of devfreq_suspend/resume_device(). But, if you use 'suspend_count'
in order to check whether this devfreq is suspended or not,
we can reduce the unneeded redundant call when calling it twice.
clock and regulator used the 'reference count' method in order to
remove the redundant call.
I think I've got the point. I will move the atomic check just
after the !devfreq check. Something like the code bellow is what you
would like to see?
---8<-----
if (!devfreq)
return -EINVAL;
if (atomic_inc_return(&devfreq->suspend_count) > 1)
return0;
---->8-------
@@ -888,14 +909,28 @@ EXPORT_SYMBOL(devfreq_suspend_device); */ int devfreq_resume_device(struct devfreq *devfreq) {+ int ret;+ if (!devfreq) return -EINVAL;- if (!devfreq->governor)- return 0;+ if (devfreq->resume_freq) {+ if (atomic_dec_return(&devfreq->suspend_count) >= 1)+ return 0;
ditto.
Same approach here:
---8<-----
if (!devfreq)
return -EINVAL;
if (atomic_dec_return(&devfreq->suspend_count) >= 1)
return 0;
---->8-------
Regards,
Lukasz
quoted
quoted
quoted
- return devfreq->governor->event_handler(devfreq,
- DEVFREQ_GOV_RESUME, NULL);
+ ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
+ if (ret)
+ return ret;
+ }
+
+ if (devfreq->governor) {
+ ret = devfreq->governor->event_handler(devfreq,
+ DEVFREQ_GOV_RESUME, NULL);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
EXPORT_SYMBOL(devfreq_resume_device);
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
Hi Lukasz,
On 2018년 12월 04일 18:53, Lukasz Luba wrote:
Hi Chanwoo,
On 12/4/18 7:10 AM, Chanwoo Choi wrote:
quoted
Hi Lukasz,
I add the comment about 'suspend_count'.
On 2018년 12월 04일 14:43, Chanwoo Choi wrote:
quoted
Hi,
On 2018년 12월 04일 14:36, Chanwoo Choi wrote:
quoted
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
Sorry. Fix typo 'choi' to 'Choi' as following.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
quoted
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.
quoted
process. Devfreq framework handles opp-suspend DT entry and there is no
ditto.
quoted
need of modyfications in the drivers code. It uses atomic variables to
ditto.
quoted
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
In this patch, if some users call 'devfreq_suspend_device' twice,
'devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_SUSPEND, NULL)'
is called twice but devfreq_set_target() is called only one.
I knew that it is no problem for operation.
But,
I think that you better to use 'suspend_count' as the reference count
of devfreq_suspend/resume_device(). But, if you use 'suspend_count'
in order to check whether this devfreq is suspended or not,
we can reduce the unneeded redundant call when calling it twice.
clock and regulator used the 'reference count' method in order to
remove the redundant call.
I think I've got the point. I will move the atomic check just
after the !devfreq check. Something like the code bellow is what you
would like to see?
---8<-----
if (!devfreq)
return -EINVAL;
if (atomic_inc_return(&devfreq->suspend_count) > 1)
return0;
@@ -888,14 +909,28 @@ EXPORT_SYMBOL(devfreq_suspend_device); */ int devfreq_resume_device(struct devfreq *devfreq) {+ int ret;+ if (!devfreq) return -EINVAL;- if (!devfreq->governor)- return 0;+ if (devfreq->resume_freq) {+ if (atomic_dec_return(&devfreq->suspend_count) >= 1)+ return 0;
ditto.
Same approach here:
---8<-----
if (!devfreq)
return -EINVAL;
if (atomic_dec_return(&devfreq->suspend_count) >= 1)
return 0;
Looks good to me.
---->8-------
Regards,
Lukasz
quoted
quoted
quoted
quoted
- return devfreq->governor->event_handler(devfreq,
- DEVFREQ_GOV_RESUME, NULL);
+ ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
+ if (ret)
+ return ret;
+ }
+
+ if (devfreq->governor) {
+ ret = devfreq->governor->event_handler(devfreq,
+ DEVFREQ_GOV_RESUME, NULL);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
EXPORT_SYMBOL(devfreq_resume_device);
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
From: Lukasz Luba <hidden> Date: 2018-12-05 11:07:56
Hi Chanwoo,
On 12/5/18 1:09 AM, Chanwoo Choi wrote:
Hi Lukasz,
On 2018년 12월 04일 18:53, Lukasz Luba wrote:
quoted
Hi Chanwoo,
On 12/4/18 7:10 AM, Chanwoo Choi wrote:
quoted
Hi Lukasz,
I add the comment about 'suspend_count'.
On 2018년 12월 04일 14:43, Chanwoo Choi wrote:
quoted
Hi,
On 2018년 12월 04일 14:36, Chanwoo Choi wrote:
quoted
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
Sorry. Fix typo 'choi' to 'Choi' as following.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
quoted
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.
quoted
process. Devfreq framework handles opp-suspend DT entry and there is no
ditto.
quoted
need of modyfications in the drivers code. It uses atomic variables to
ditto.
quoted
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
In this patch, if some users call 'devfreq_suspend_device' twice,
'devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_SUSPEND, NULL)'
is called twice but devfreq_set_target() is called only one.
I knew that it is no problem for operation.
But,
I think that you better to use 'suspend_count' as the reference count
of devfreq_suspend/resume_device(). But, if you use 'suspend_count'
in order to check whether this devfreq is suspended or not,
we can reduce the unneeded redundant call when calling it twice.
clock and regulator used the 'reference count' method in order to
remove the redundant call.
I think I've got the point. I will move the atomic check just
after the !devfreq check. Something like the code bellow is what you
would like to see?
---8<-----
if (!devfreq)
return -EINVAL;
if (atomic_inc_return(&devfreq->suspend_count) > 1)
return0;
@@ -888,14 +909,28 @@ EXPORT_SYMBOL(devfreq_suspend_device); */ int devfreq_resume_device(struct devfreq *devfreq) {+ int ret;+ if (!devfreq) return -EINVAL;- if (!devfreq->governor)- return 0;+ if (devfreq->resume_freq) {+ if (atomic_dec_return(&devfreq->suspend_count) >= 1)+ return 0;
ditto.
Same approach here:
---8<-----
if (!devfreq)
return -EINVAL;
if (atomic_dec_return(&devfreq->suspend_count) >= 1)
return 0;
Looks good to me.
Thank you. The patch set v3 is going to be sent.
Regards,
Lukasz
quoted
---->8-------
Regards,
Lukasz
quoted
quoted
quoted
quoted
- return devfreq->governor->event_handler(devfreq,
- DEVFREQ_GOV_RESUME, NULL);
+ ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
+ if (ret)
+ return ret;
+ }
+
+ if (devfreq->governor) {
+ ret = devfreq->governor->event_handler(devfreq,
+ DEVFREQ_GOV_RESUME, NULL);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
EXPORT_SYMBOL(devfreq_resume_device);
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
From: Lukasz Luba <hidden> Date: 2018-12-04 09:39:20
Hi Chanwoo,
On 12/4/18 6:36 AM, Chanwoo Choi wrote:
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.
quoted
process. Devfreq framework handles opp-suspend DT entry and there is no
ditto.
quoted
need of modyfications in the drivers code. It uses atomic variables to
ditto.
quoted
make sure no race condition affects the process.
The patch is based on earlier work by Tobias Jakobi.
Please remove it from each patch description.
Comments addressed in next v3 patch set. Thank you.
Regards,
Lukasz
@@ -167,6 +170,10 @@ struct devfreq {unsignedlongscaling_max_freq;boolstop_polling;+unsignedlongsuspend_freq;+unsignedlongresume_freq;+atomic_tsuspend_count;+/* information for device frequency transition */unsignedinttotal_trans;unsignedint*trans_table;
From: Pavel Machek <hidden> Date: 2018-12-09 09:00:12
On Tue 2018-12-04 14:36:11, Chanwoo Choi wrote:
Hi Lukasz,
Looks good to me. But, I add the some comments.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo choi <cw00.choi@samsung.com>
On 2018년 12월 03일 23:31, Lukasz Luba wrote:
quoted
The patch prepares devfreq device for handling suspend/resume
functionality. The new fields will store needed information during this
nitpick. Remove unneeded space. There are two spaces between '.' and 'The new'.