* [PATCH v2] cpuidle: ladder: Add per CPU PM QoS resume latency support
@ 2017-10-27 2:01 Ramesh Thomas
2017-10-27 7:59 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Ramesh Thomas @ 2017-10-27 2:01 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-pm, rafael.j.wysocki, alex.shi, daniel.lezcano
Individual CPUs may have special requirements to not enter
deep idle states. For example, a CPU running real time
applications would not want to enter deep idle states to
avoid latency impacts. At the same time other CPUs that
do not have such a requirement could allow deep idle
states to save power.
This was already implemented in the menu governor.
Implementing similar changes in the ladder governor which
gets selected when CONFIG_NO_HZ and CONFIG_NO_HZ_IDLE are not
set. Refer following commits for the menu governor changes.
commit 9908859acaa9 ("cpuidle/menu: add per CPU PM QoS resume
latency consideration")
commit 6dbf5cea05a7 ("cpuidle: menu: Avoid taking spinlock for
accessing QoS values")
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
---
v2:
- use PM_QOS_RESUME_LATENCY_NO_CONSTRAINT for "no constraint" value
Should be applied over https://patchwork.kernel.org/patch/10024157/
drivers/cpuidle/governors/ladder.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index ce1a2ff..1ad8745 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -17,6 +17,7 @@
#include <linux/pm_qos.h>
#include <linux/jiffies.h>
#include <linux/tick.h>
+#include <linux/cpu.h>
#include <asm/io.h>
#include <linux/uaccess.h>
@@ -67,10 +68,16 @@ static int ladder_select_state(struct cpuidle_driver *drv,
struct cpuidle_device *dev)
{
struct ladder_device *ldev = this_cpu_ptr(&ladder_devices);
+ struct device *device = get_cpu_device(dev->cpu);
struct ladder_device_state *last_state;
int last_residency, last_idx = ldev->last_state_idx;
int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0;
int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
+ int resume_latency = dev_pm_qos_raw_read_value(device);
+
+ if (resume_latency < latency_req &&
+ resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
+ latency_req = resume_latency;
/* Special case when user has set very strict latency requirement */
if (unlikely(latency_req == 0)) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpuidle: ladder: Add per CPU PM QoS resume latency support
2017-10-27 2:01 [PATCH v2] cpuidle: ladder: Add per CPU PM QoS resume latency support Ramesh Thomas
@ 2017-10-27 7:59 ` Rafael J. Wysocki
2017-11-04 2:48 ` Ramesh Thomas
0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-10-27 7:59 UTC (permalink / raw)
To: ramesh.thomas
Cc: Linux Kernel Mailing List, Linux PM, Rafael Wysocki, Alex Shi,
Daniel Lezcano
On Fri, Oct 27, 2017 at 4:01 AM, Ramesh Thomas <ramesh.thomas@intel.com> wrote:
> Individual CPUs may have special requirements to not enter
> deep idle states. For example, a CPU running real time
> applications would not want to enter deep idle states to
> avoid latency impacts. At the same time other CPUs that
> do not have such a requirement could allow deep idle
> states to save power.
>
> This was already implemented in the menu governor.
> Implementing similar changes in the ladder governor which
> gets selected when CONFIG_NO_HZ and CONFIG_NO_HZ_IDLE are not
> set. Refer following commits for the menu governor changes.
>
> commit 9908859acaa9 ("cpuidle/menu: add per CPU PM QoS resume
> latency consideration")
> commit 6dbf5cea05a7 ("cpuidle: menu: Avoid taking spinlock for
> accessing QoS values")
>
> Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
> ---
>
> v2:
> - use PM_QOS_RESUME_LATENCY_NO_CONSTRAINT for "no constraint" value
> Should be applied over https://patchwork.kernel.org/patch/10024157/
>
> drivers/cpuidle/governors/ladder.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
> index ce1a2ff..1ad8745 100644
> --- a/drivers/cpuidle/governors/ladder.c
> +++ b/drivers/cpuidle/governors/ladder.c
> @@ -17,6 +17,7 @@
> #include <linux/pm_qos.h>
> #include <linux/jiffies.h>
> #include <linux/tick.h>
> +#include <linux/cpu.h>
>
> #include <asm/io.h>
> #include <linux/uaccess.h>
> @@ -67,10 +68,16 @@ static int ladder_select_state(struct cpuidle_driver *drv,
> struct cpuidle_device *dev)
> {
> struct ladder_device *ldev = this_cpu_ptr(&ladder_devices);
> + struct device *device = get_cpu_device(dev->cpu);
> struct ladder_device_state *last_state;
> int last_residency, last_idx = ldev->last_state_idx;
> int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0;
> int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
> + int resume_latency = dev_pm_qos_raw_read_value(device);
> +
> + if (resume_latency < latency_req &&
> + resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
> + latency_req = resume_latency;
>
> /* Special case when user has set very strict latency requirement */
> if (unlikely(latency_req == 0)) {
> --
> 2.7.4
>
Looks good to me.
I'll queue it up if nobody objects.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpuidle: ladder: Add per CPU PM QoS resume latency support
2017-10-27 7:59 ` Rafael J. Wysocki
@ 2017-11-04 2:48 ` Ramesh Thomas
0 siblings, 0 replies; 3+ messages in thread
From: Ramesh Thomas @ 2017-11-04 2:48 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux Kernel Mailing List, Linux PM, Rafael Wysocki, Alex Shi,
Daniel Lezcano
On 2017-10-27 at 09:59:38 +0200, Rafael J. Wysocki wrote:
> On Fri, Oct 27, 2017 at 4:01 AM, Ramesh Thomas <ramesh.thomas@intel.com> wrote:
> > Individual CPUs may have special requirements to not enter
> > deep idle states. For example, a CPU running real time
> > applications would not want to enter deep idle states to
> > avoid latency impacts. At the same time other CPUs that
> > do not have such a requirement could allow deep idle
> > states to save power.
> >
> > This was already implemented in the menu governor.
> > Implementing similar changes in the ladder governor which
> > gets selected when CONFIG_NO_HZ and CONFIG_NO_HZ_IDLE are not
> > set. Refer following commits for the menu governor changes.
> >
> > commit 9908859acaa9 ("cpuidle/menu: add per CPU PM QoS resume
> > latency consideration")
> > commit 6dbf5cea05a7 ("cpuidle: menu: Avoid taking spinlock for
> > accessing QoS values")
> >
> > Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
> > ---
> >
> > v2:
> > - use PM_QOS_RESUME_LATENCY_NO_CONSTRAINT for "no constraint" value
> > Should be applied over https://patchwork.kernel.org/patch/10024157/
> >
> > drivers/cpuidle/governors/ladder.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
> > index ce1a2ff..1ad8745 100644
> > --- a/drivers/cpuidle/governors/ladder.c
> > +++ b/drivers/cpuidle/governors/ladder.c
> > @@ -17,6 +17,7 @@
> > #include <linux/pm_qos.h>
> > #include <linux/jiffies.h>
> > #include <linux/tick.h>
> > +#include <linux/cpu.h>
> >
> > #include <asm/io.h>
> > #include <linux/uaccess.h>
> > @@ -67,10 +68,16 @@ static int ladder_select_state(struct cpuidle_driver *drv,
> > struct cpuidle_device *dev)
> > {
> > struct ladder_device *ldev = this_cpu_ptr(&ladder_devices);
> > + struct device *device = get_cpu_device(dev->cpu);
> > struct ladder_device_state *last_state;
> > int last_residency, last_idx = ldev->last_state_idx;
> > int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0;
> > int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
> > + int resume_latency = dev_pm_qos_raw_read_value(device);
> > +
> > + if (resume_latency < latency_req &&
> > + resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
> > + latency_req = resume_latency;
> >
> > /* Special case when user has set very strict latency requirement */
> > if (unlikely(latency_req == 0)) {
> > --
> > 2.7.4
> >
>
> Looks good to me.
>
> I'll queue it up if nobody objects.
>
Hi Rafael,
This patch would apply as is over your new PM QoS changes. If you need me
to repost please let me know.
Thanks,
Ramesh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-04 2:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27 2:01 [PATCH v2] cpuidle: ladder: Add per CPU PM QoS resume latency support Ramesh Thomas
2017-10-27 7:59 ` Rafael J. Wysocki
2017-11-04 2:48 ` Ramesh Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).