Skip to contentSkip to conversation

ARM: EXYNOS: Add default latency values for Device and Power Domain

PATCH New Sachin Kamat 4 participants 7 messages Nov 8, 2013 – Nov 11, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: EXYNOS: Add default latency values for Device and Power Domain

From: Prasanna Kumar <[email protected]>

Power domain and device timing data are intialized with default values to avoid dump of warnings from various power domains during power gating.

---
 arch/arm/mach-exynos/pm_domains.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/pm_domains.c +14 -1
index 84e0483a0500..9bbb4ac23980 100644
@@ -25,6 +25,10 @@
 #include <mach/regs-pmu.h>
 #include <plat/devs.h>
 
+#define DEFAULT_DEV_LATENCY_NS			1000000UL
+#define DEFAULT_PD_PWRON_LATENCY_NS		10000000UL
+#define DEFAULT_PD_PWROFF_LATENCY_NS		10000000UL
+
 /*
  * Exynos specific wrapper around the generic power domain
  */
@@ -36,6 +40,13 @@ struct exynos_pm_domain {
 	u32 enable;
 };
 
+static struct gpd_timing_data dev_latencies = {
+	.stop_latency_ns = DEFAULT_DEV_LATENCY_NS,
+	.start_latency_ns = DEFAULT_DEV_LATENCY_NS,
+	.save_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
+	.restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
+};
+
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
 	struct exynos_pm_domain *pd;
@@ -83,7 +94,7 @@ static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
 	dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
 
 	while (1) {
-		ret = pm_genpd_add_device(&pd->pd, dev);
+		ret = __pm_genpd_add_device(&pd->pd, dev, &dev_latencies);
 		if (ret != -EAGAIN)
 			break;
 		cond_resched();
@@ -173,6 +184,8 @@ static __init int exynos4_pm_init_power_domain(void)
 		pd->base = of_iomap(np, 0);
 		pd->pd.power_off = exynos_pd_power_off;
 		pd->pd.power_on = exynos_pd_power_on;
+		pd->pd.power_off_latency_ns = DEFAULT_PD_PWROFF_LATENCY_NS;
+		pd->pd.power_on_latency_ns = DEFAULT_PD_PWRON_LATENCY_NS;
 		pd->pd.of_node = np;
 
 		platform_set_drvdata(pdev, pd);
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ARM: EXYNOS: Add default latency values for Device and Power Domain

Hi Sachin, Prasanna,

[CCing Rafael and respective mailing lists]

Please see my comments inline. Also please always remember to add all appropriate recipients on CC list. More reviewers means higher chance of spotting (and so eliminating) potential issues.

Quoted 18 lines · On Friday 08 of November 2013 11:57:05 Sachin Kamat wrote:

From: Prasanna Kumar <[email protected]>

Power domain and device timing data are intialized with default values to avoid dump of warnings from various power domains during power gating.

---
 arch/arm/mach-exynos/pm_domains.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/pm_domains.c +0 -0
index 84e0483a0500..9bbb4ac23980 100644

arch/arm/mach-exynos/pm_domains.c line 30

Quoted 6 lines
arch/arm/mach-exynos/pm_domains.c +3 -0
@@ -25,6 +25,10 @@
 #include <mach/regs-pmu.h>
 #include <plat/devs.h>
 
+#define DEFAULT_DEV_LATENCY_NS			1000000UL
+#define DEFAULT_PD_PWRON_LATENCY_NS		10000000UL
+#define DEFAULT_PD_PWROFF_LATENCY_NS		10000000UL

Is there any rationale behind choosing these particular values?

arch/arm/mach-exynos/pm_domains.c struct exynos_pm_domain { · line 47

Quoted 13 lines
arch/arm/mach-exynos/pm_domains.c +6 -0
+
 /*
  * Exynos specific wrapper around the generic power domain
  */
@@ -36,6 +40,13 @@ struct exynos_pm_domain {
 	u32 enable;
 };
 
+static struct gpd_timing_data dev_latencies = {
+	.stop_latency_ns = DEFAULT_DEV_LATENCY_NS,
+	.start_latency_ns = DEFAULT_DEV_LATENCY_NS,
+	.save_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
+	.restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS,

I don't think that stop, start, save and restore latencies should be all the same.

arch/arm/mach-exynos/pm_domains.c static void exynos_add_device_to_domain(struct exynos_pm_domain *pd, · line 97

Quoted 11 lines
arch/arm/mach-exynos/pm_domains.c +3 -1
+};
+
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
 	struct exynos_pm_domain *pd;
@@ -83,7 +94,7 @@ static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
 	dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
 
 	while (1) {
-		ret = pm_genpd_add_device(&pd->pd, dev);
+		ret = __pm_genpd_add_device(&pd->pd, dev, &dev_latencies);

The double underscore prefix scares me a bit. Is this function really supposed to be used like this?

arch/arm/mach-exynos/pm_domains.c static __init int exynos4_pm_init_power_domain(void) · line 188

Quoted 9 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
 		if (ret != -EAGAIN)
 			break;
 		cond_resched();
@@ -173,6 +184,8 @@ static __init int exynos4_pm_init_power_domain(void)
 		pd->base = of_iomap(np, 0);
 		pd->pd.power_off = exynos_pd_power_off;
 		pd->pd.power_on = exynos_pd_power_on;
+		pd->pd.power_off_latency_ns = DEFAULT_PD_PWROFF_LATENCY_NS;
+		pd->pd.power_on_latency_ns = DEFAULT_PD_PWRON_LATENCY_NS;

It might be worth to set up the latencies indeed, but wrong values can do more harm than good.

Best regards,
Tomasz

#2 lore raw

PATCH 1/1 ARM: EXYNOS: Add default latency values for Device and Power Domain

Hi Tomasz,

Thanks for reviewing.

Quoted 7 lines · Tomasz Figa

Hi Sachin, Prasanna,

[CCing Rafael and respective mailing lists]

Please see my comments inline. Also please always remember to add all appropriate recipients on CC list. More reviewers means higher chance of spotting (and so eliminating) potential issues.

Indeed. Thanks for adding. get_maintainers somehow did not list PM related folks.
So missed this.

Quoted 23 lines · On Friday 08 of November 2013 11:57:05 Sachin Kamat wrote:
Quoted 21 lines

From: Prasanna Kumar <[email protected]>

Power domain and device timing data are intialized with default values to avoid dump of warnings from various power domains during power gating.

---
 arch/arm/mach-exynos/pm_domains.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/pm_domains.c +0 -0
index 84e0483a0500..9bbb4ac23980 100644
@@ -25,6 +25,10 @@
 #include <mach/regs-pmu.h>
 #include <plat/devs.h>
 
Quoted 5 lines

arch/arm/mach-exynos/pm_domains.c line 30

Quoted 3 lines
arch/arm/mach-exynos/pm_domains.c +3 -0
+#define DEFAULT_DEV_LATENCY_NS                       1000000UL
+#define DEFAULT_PD_PWRON_LATENCY_NS          10000000UL
+#define DEFAULT_PD_PWROFF_LATENCY_NS         10000000UL

Is there any rationale behind choosing these particular values?

IMO, these values were obtained more from experimentation. Prasanna, please comment.

Quoted 9 lines
Quoted 9 lines
arch/arm/mach-exynos/pm_domains.c +1 -0
+
 /*
  * Exynos specific wrapper around the generic power domain
  */
@@ -36,6 +40,13 @@ struct exynos_pm_domain {
      u32 enable;
 };
 
Quoted 8 lines

arch/arm/mach-exynos/pm_domains.c struct exynos_pm_domain { · line 47

Quoted 5 lines
arch/arm/mach-exynos/pm_domains.c +5 -0
+static struct gpd_timing_data dev_latencies = {
+     .stop_latency_ns = DEFAULT_DEV_LATENCY_NS,
+     .start_latency_ns = DEFAULT_DEV_LATENCY_NS,
+     .save_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
+     .restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS,

I don't think that stop, start, save and restore latencies should be all the same.

They could be different. But again as I said it was based on experimentation rather than reference.

Quoted 9 lines
Quoted 9 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
+};
+
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
      struct exynos_pm_domain *pd;
@@ -83,7 +94,7 @@ static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
      dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
 
Quoted 6 lines

arch/arm/mach-exynos/pm_domains.c static void exynos_add_device_to_domain(struct exynos_pm_domain *pd, · line 97

Quoted 3 lines
arch/arm/mach-exynos/pm_domains.c +1 -1
      while (1) {
-             ret = pm_genpd_add_device(&pd->pd, dev);
+             ret = __pm_genpd_add_device(&pd->pd, dev, &dev_latencies);

The double underscore prefix scares me a bit. Is this function really supposed to be used like this?

We did not find a wrapper/helper function to set this. Hence had to use this. In fact I did not
find any other users of this function (pm_genpd_add_device) too.

Quoted 13 lines

arch/arm/mach-exynos/pm_domains.c static __init int exynos4_pm_init_power_domain(void) · line 188

Quoted 10 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
              if (ret != -EAGAIN)
                      break;
              cond_resched();
@@ -173,6 +184,8 @@ static __init int exynos4_pm_init_power_domain(void)
              pd->base = of_iomap(np, 0);
              pd->pd.power_off = exynos_pd_power_off;
              pd->pd.power_on = exynos_pd_power_on;
+             pd->pd.power_off_latency_ns = DEFAULT_PD_PWROFF_LATENCY_NS;
+             pd->pd.power_on_latency_ns = DEFAULT_PD_PWRON_LATENCY_NS;

It might be worth to set up the latencies indeed, but wrong values can do more harm than good.

Right. As of this now, this is a well tested set of values.

Signature · 2 lines
With warm regards,
Sachin
#3 lore raw

PATCH 1/1 ARM: EXYNOS: Add default latency values for Device and Power Domain

Quoted 42 lines · Sachin Kamat

Hi Tomasz,

Thanks for reviewing.

Quoted 7 lines · Tomasz Figa

Hi Sachin, Prasanna,

[CCing Rafael and respective mailing lists]

Please see my comments inline. Also please always remember to add all appropriate recipients on CC list. More reviewers means higher chance of spotting (and so eliminating) potential issues.

Indeed. Thanks for adding. get_maintainers somehow did not list PM related folks.
So missed this.

Quoted 24 lines · On Friday 08 of November 2013 11:57:05 Sachin Kamat wrote:
Quoted 22 lines

From: Prasanna Kumar <[email protected]>

Power domain and device timing data are intialized with default values to avoid dump of warnings from various power domains during power gating.

---
 arch/arm/mach-exynos/pm_domains.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/pm_domains.c +0 -0
index 84e0483a0500..9bbb4ac23980 100644
@@ -25,6 +25,10 @@
 #include <mach/regs-pmu.h>
 #include <plat/devs.h>
 
Quoted 8 lines
Quoted 5 lines

arch/arm/mach-exynos/pm_domains.c line 30

Quoted 3 lines
arch/arm/mach-exynos/pm_domains.c +3 -0
+#define DEFAULT_DEV_LATENCY_NS                       1000000UL
+#define DEFAULT_PD_PWRON_LATENCY_NS          10000000UL
+#define DEFAULT_PD_PWROFF_LATENCY_NS         10000000UL

Is there any rationale behind choosing these particular values?

IMO, these values were obtained more from experimentation. Prasanna, please comment.

As Sachin mentioned, the values are obtained from experimentation to avoid latency warning messages. These values can be changed when the information becomes available from the specs.
As of now , this seems to be good set of values.

Quoted 62 lines
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-exynos/pm_domains.c +1 -0
+
 /*
  * Exynos specific wrapper around the generic power domain
  */
@@ -36,6 +40,13 @@ struct exynos_pm_domain {
      u32 enable;
 };
 
Quoted 8 lines

arch/arm/mach-exynos/pm_domains.c struct exynos_pm_domain { · line 47

Quoted 5 lines
arch/arm/mach-exynos/pm_domains.c +5 -0
+static struct gpd_timing_data dev_latencies = {
+     .stop_latency_ns = DEFAULT_DEV_LATENCY_NS,
+     .start_latency_ns = DEFAULT_DEV_LATENCY_NS,
+     .save_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
+     .restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS,

I don't think that stop, start, save and restore latencies should be all the same.

They could be different. But again as I said it was based on experimentation rather than reference.

Quoted 11 lines
Quoted 11 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
+};
+
 static int exynos_pd_power(struct generic_pm_domain *domain, bool
 power_on)
 {
      struct exynos_pm_domain *pd;
arch/arm/mach-exynos/pm_domains.c +0 -0
@@ -83,7 +94,7 @@ static void exynos_add_device_to_domain(struct
 exynos_pm_domain *pd,
      dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
 
Quoted 7 lines

arch/arm/mach-exynos/pm_domains.c static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,

Quoted 4 lines
arch/arm/mach-exynos/pm_domains.c +1 -1
      while (1) {
-             ret = pm_genpd_add_device(&pd->pd, dev);
+             ret = __pm_genpd_add_device(&pd->pd, dev,
 &dev_latencies);

The double underscore prefix scares me a bit. Is this function really supposed to be used like this?

We did not find a wrapper/helper function to set this. Hence had to use this. In fact I did not
find any other users of this function (pm_genpd_add_device) too.

Quoted 16 lines

arch/arm/mach-exynos/pm_domains.c static __init int · line 190

Quoted 12 lines
arch/arm/mach-exynos/pm_domains.c +0 -0
              if (ret != -EAGAIN)
                      break;
              cond_resched();
arch/arm/mach-exynos/pm_domains.c +2 -0
@@ -173,6 +184,8 @@ static __init int
 exynos4_pm_init_power_domain(void)
              pd->base = of_iomap(np, 0);
              pd->pd.power_off = exynos_pd_power_off;
              pd->pd.power_on = exynos_pd_power_on;
+             pd->pd.power_off_latency_ns =
 DEFAULT_PD_PWROFF_LATENCY_NS;
+             pd->pd.power_on_latency_ns = DEFAULT_PD_PWRON_LATENCY_NS;

It might be worth to set up the latencies indeed, but wrong values can do
more harm than good.

Quoted 3 lines

Right. As of this now, this is a well tested set of values.

--

regards,
Prasanna

#4 lore raw

PATCH 1/1 ARM: EXYNOS: Add default latency values for Device and Power Domain

Hi Prasanna,

Quoted 50 lines · On Monday 11 of November 2013 10:19:40 Prasanna Kumar wrote:
Quoted 48 lines · Sachin Kamat

Hi Tomasz,

Thanks for reviewing.

Quoted 7 lines · Tomasz Figa

Hi Sachin, Prasanna,

[CCing Rafael and respective mailing lists]

Please see my comments inline. Also please always remember to add all appropriate recipients on CC list. More reviewers means higher chance of spotting (and so eliminating) potential issues.

Indeed. Thanks for adding. get_maintainers somehow did not list PM related folks.
So missed this.

Quoted 29 lines · On Friday 08 of November 2013 11:57:05 Sachin Kamat wrote:
Quoted 19 lines

From: Prasanna Kumar <[email protected]>

Power domain and device timing data are intialized with default values to avoid dump of warnings from various power domains during power gating.

---
 arch/arm/mach-exynos/pm_domains.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/pm_domains.c +0 -0
index 84e0483a0500..9bbb4ac23980 100644

arch/arm/mach-exynos/pm_domains.c line 30

Quoted 6 lines
arch/arm/mach-exynos/pm_domains.c +3 -0
@@ -25,6 +25,10 @@
 #include <mach/regs-pmu.h>
 #include <plat/devs.h>
 
+#define DEFAULT_DEV_LATENCY_NS                       1000000UL
+#define DEFAULT_PD_PWRON_LATENCY_NS          10000000UL
+#define DEFAULT_PD_PWROFF_LATENCY_NS         10000000UL

Is there any rationale behind choosing these particular values?

Quoted 6 lines
Quoted 2 lines

IMO, these values were obtained more from experimentation. Prasanna, please comment.

As Sachin mentioned, the values are obtained from experimentation to avoid latency warning messages. These values can be changed when the information becomes available from the specs.
As of now , this seems to be good set of values.

Do you have any measurements that confirm that there is no regression in power consumption (e.g. caused by unnecessarily delayed runtime PM operations) after applying this patch?

Best regards,
Tomasz

#5 lore raw

PATCH 1/1 ARM: EXYNOS: Add default latency values for Device and Power Domain

In reply to Tomasz Figa
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
+};
+
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
      struct exynos_pm_domain *pd;
@@ -83,7 +94,7 @@ static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
      dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
 
Quoted 7 lines

arch/arm/mach-exynos/pm_domains.c static void exynos_add_device_to_domain(struct exynos_pm_domain *pd, · line 97

Quoted 3 lines
arch/arm/mach-exynos/pm_domains.c +1 -1
      while (1) {
-             ret = pm_genpd_add_device(&pd->pd, dev);
+             ret = __pm_genpd_add_device(&pd->pd, dev, &dev_latencies);

The double underscore prefix scares me a bit. Is this function really supposed to be used like this?

Moreover, it also seems little bit odd in the first place, to pass dev_latencies(QoS timing parameters) when we are not using/providing any governor for the genpd. QoS timing parameters have to be provided to be used by governor. In our case since we are not using/providing any governor yet, so it seems odd to provide QoS timing parameters. It seems, here core pd code is giving unnecessary warning in our case, since we are not providing governor(not interested in QoS). So IMO warning should be fixed instead of just suppressing it by giving some big values of timing parameters.

Regards,
Yadwinder

Quoted 20 lines

arch/arm/mach-exynos/pm_domains.c static __init int exynos4_pm_init_power_domain(void) · line 188

Quoted 9 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
              if (ret != -EAGAIN)
                      break;
              cond_resched();
@@ -173,6 +184,8 @@ static __init int exynos4_pm_init_power_domain(void)
              pd->base = of_iomap(np, 0);
              pd->pd.power_off = exynos_pd_power_off;
              pd->pd.power_on = exynos_pd_power_on;
+             pd->pd.power_off_latency_ns = DEFAULT_PD_PWROFF_LATENCY_NS;
+             pd->pd.power_on_latency_ns = DEFAULT_PD_PWRON_LATENCY_NS;

It might be worth to set up the latencies indeed, but wrong values can do more harm than good.

Best regards,
Tomasz

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

PATCH 1/1 ARM: EXYNOS: Add default latency values for Device and Power Domain

Quoted 16 lines · On Monday 11 of November 2013 23:11:41 Yadwinder Singh Brar wrote:
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
+};
+
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
      struct exynos_pm_domain *pd;
@@ -83,7 +94,7 @@ static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
      dev_dbg(dev, "adding to power domain %s\n", pd->pd.name);
 
Quoted 7 lines

arch/arm/mach-exynos/pm_domains.c static void exynos_add_device_to_domain(struct exynos_pm_domain *pd, · line 97

Quoted 3 lines
arch/arm/mach-exynos/pm_domains.c +1 -1
      while (1) {
-             ret = pm_genpd_add_device(&pd->pd, dev);
+             ret = __pm_genpd_add_device(&pd->pd, dev, &dev_latencies);

The double underscore prefix scares me a bit. Is this function really supposed to be used like this?

Quoted 10 lines

Moreover, it also seems little bit odd in the first place, to pass dev_latencies(QoS timing parameters) when we are not using/providing any governor for the genpd. QoS timing parameters have to be provided to be used by governor. In our case since we are not using/providing any governor yet, so it seems odd to provide QoS timing parameters. It seems, here core pd code is giving unnecessary warning in our case, since we are not providing governor(not interested in QoS). So IMO warning should be fixed instead of just suppressing it by giving some big values of timing parameters.

Yes, that would be probably much better option than providing some random values that do not have any rationale behind them.

Rafael, could you comment on this?

Best regards,
Tomasz