All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] PM / devfreq: Fix issues about passive governor
       [not found] <CGME20170118065653epcas5p23158122f1f54c7419bc010527174b48e@epcas5p2.samsung.com>
@ 2017-01-18  6:56 ` Chanwoo Choi
       [not found]   ` <CGME20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5@epcas5p2.samsung.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Chanwoo Choi @ 2017-01-18  6:56 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, rjw; +Cc: cw00.choi, linux-pm, linux-kernel

This patchset fix the two issues about passive governor
and remove the unneeded separate _remove_devfreq() function.

First, the parent devfreq device can use the governors except for
the passive governor on the fly through sysfs entry and the passive
devfreq device is only possible to use the passive governor.

The 'available_governors' entry doesn't divide this difference
between parent devfreq and passive devfreq device. So, the patch1
fixes the this issue.

Second, the devfreq updates the statistic of frequency for each
device. But, 'trans_stat' of the passive devfreq device doesn't
update the statistic. So, the patch2 fixes this issue by calling
the update_devfreqw_passive() after setting the frequency
of passive devfreq device.

Finally, the patch3 removes the separate _remove_devfreq()
because this function is only called once in devfreq_dev_release().
I think that it is not necessary to make the separate function.


Depends on:
- These patches depends on the devfreq.git[1] and devfreq patches[2].
[1] https://git.kernel.org/cgit/linux/kernel/git/mzx/devfreq.git/ (branch: for-4.10-rc)
[2] https://lkml.org/lkml/2017/1/16/254
- ("[PATCH v3 0/4] PM / devfreq: Update the devfreq and devfreq-event device")


For example,
Following exmaple is the bus frequency device
of INT (Internal) block on Exynos5433-based TM2 board.

1. There are differences about 'available_governors' sysfs entry.
- Parent devfreq device (soc\:bus0)
- Passive devfreq device (soc\:bus1) depends on the parent devfreq (soc\:bus0).

1-1. Before applying these patches:
- parent devfreq device
$ cat /sys/class/devfreq/soc\:bus0/available_governors
passive userspace powersave performance simple_ondemand

- passive devfreq device
$ cat /sys/class/devfreq/soc\:bus1/available_governors
passive userspace powersave performance simple_ondemand

1-2. After applying these patches:
- parent devfreq device
$ cat /sys/class/devfreq/soc\:bus0/available_governors
userspace powersave performance simple_ondemand

- passive devfreq device
$ cat /sys/class/devfreq/soc\:bus1/available_governors
passive


2. There are differences about 'trans_stat' sysfs entry.
- Parent devfreq device (soc\:bus0)
- Passive devfreq device (soc\:bus3) depends on the parent devfreq (soc\:bus0).

2-1. Before applying these patches:
- parent devfreq device
$ cat /sys/class/devfreq/soc\:bus0/trans_stat
     From  :   To
           : 100000000 134000000 160000000 200000000 267000000 400000000   time(ms)
  100000000:         0         0         1         0         0         0     80664
  134000000:         0         0         0         0         1         0      7552
  160000000:         0         1         0         0         0         0      8136
  200000000:         0         0         0         0         0         0         0
  267000000:         0         0         0         0         0         1     23208
* 400000000:         0         0         0         0         0         0   1188144
Total transition : 4

- passive devfreq device
$ cat /sys/class/devfreq/soc\:bus3/trans_stat
     From  :   To
           : 100000000 134000000 160000000 200000000 267000000 400000000   time(ms)
  100000000:         0         0         0         0         0         0         0
  134000000:         0         0         0         0         0         0         0
  160000000:         0         0         0         0         0         0         0
  200000000:         0         0         0         0         0         0         0
  267000000:         0         0         0         0         0         0         0
* 400000000:         0         0         0         0         0         0   1317400
Total transition : 0


2-2. After applying these patches:
- parent devfreq device
$ cat /sys/class/devfreq/soc\:bus0/trans_stat
     From  :   To
           : 100000000 134000000 160000000 200000000 267000000 400000000   time(ms)
  100000000:         0         1         0         0         0         0    110372
  134000000:         0         0         1         0         0         0      6180
  160000000:         0         0         0         1         0         0      3748
  200000000:         0         0         0         0         1         0      2992
  267000000:         0         0         0         0         0         1      4648
* 400000000:         0         0         0         0         0         0      1636
Total transition : 5

- passive devfreq device
$ cat /sys/class/devfreq/soc\:bus3/trans_stat
     From  :   To
           : 100000000 134000000 160000000 200000000 267000000 400000000   time(ms)
  100000000:         0         1         0         0         0         0    110372
  134000000:         0         0         1         0         0         0      6180
  160000000:         0         0         0         1         0         0      3748
  200000000:         0         0         0         0         1         0      2992
  267000000:         0         0         0         0         0         1      4648
* 400000000:         0         0         0         0         0         0     14500
Total transition : 5

Chanwoo Choi (3):
  PM / devfreq: Fix available_governor sysfs
  PM / devfreq: Fix wrong trans_stat of passive devfreq device
  PM / devfreq: Remove unnecessary separate _remove_devfreq()

 drivers/devfreq/devfreq.c          | 60 ++++++++++++++++++++++++++------------
 drivers/devfreq/governor.h         |  2 ++
 drivers/devfreq/governor_passive.c |  5 ++++
 3 files changed, 49 insertions(+), 18 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] PM / devfreq: Fix available_governor sysfs
       [not found]   ` <CGME20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5@epcas5p2.samsung.com>
@ 2017-01-18  6:56     ` Chanwoo Choi
  2017-01-24  2:24     ` MyungJoo Ham
  2017-01-24  3:51     ` MyungJoo Ham
  2 siblings, 0 replies; 9+ messages in thread
From: Chanwoo Choi @ 2017-01-18  6:56 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, rjw
  Cc: cw00.choi, linux-pm, linux-kernel, stable

The devfreq using passive governor is not able to change the governor.
So, the user can not change the governor through 'available_governor' sysfs
entry. Also, the devfreq which don't use the passive governor is not able to
change to 'passive' governor on the fly.

Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
Cc: stable@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/devfreq.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 4bd7a8f71b07..a2c575a5a9ab 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -43,6 +43,11 @@
 static LIST_HEAD(devfreq_list);
 static DEFINE_MUTEX(devfreq_list_lock);
 
+static int is_passive_gov(const char *governor_name)
+{
+	return (!strncmp(governor_name, "passive", 7)) ? 1 : 0;
+}
+
 /**
  * find_device_devfreq() - find devfreq struct using device pointer
  * @dev:	device pointer used to lookup device devfreq.
@@ -933,6 +938,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
 	if (ret != 1)
 		return -EINVAL;
 
+	/* The passive devfreq is not able to change the governor. */
+	if (is_passive_gov(df->governor_name))
+		return 0;
+
 	mutex_lock(&devfreq_list_lock);
 	governor = find_devfreq_governor(str_governor);
 	if (IS_ERR(governor)) {
@@ -972,12 +981,35 @@ static ssize_t available_governors_show(struct device *d,
 					char *buf)
 {
 	struct devfreq_governor *tmp_governor;
+	struct devfreq *df = to_devfreq(d);
 	ssize_t count = 0;
 
 	mutex_lock(&devfreq_list_lock);
-	list_for_each_entry(tmp_governor, &devfreq_governor_list, node)
+
+	/*
+	 * The passive devfreq shows only passive governor.
+	 * The governor except for passive are not available
+	 * for passive devfreq device.
+	 */
+	if (is_passive_gov(df->governor_name)) {
+		count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
+				   "%s ", df->governor_name);
+		goto out;
+	}
+
+	/*
+	 * The devfreq device show the registered governor except for
+	 * 'passive' governor.
+	 */
+	list_for_each_entry(tmp_governor, &devfreq_governor_list, node) {
+		if (is_passive_gov(tmp_governor->name))
+			continue;
+
 		count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
 				   "%s ", tmp_governor->name);
+	}
+
+out:
 	mutex_unlock(&devfreq_list_lock);
 
 	/* Truncate the trailing space */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] PM / devfreq: Fix wrong trans_stat of passive devfreq device
       [not found]   ` <CGME20170118065653epcas5p2da6963fbad338a3c402c7d99f5e8473f@epcas5p2.samsung.com>
@ 2017-01-18  6:56     ` Chanwoo Choi
  2017-01-24  3:40     ` MyungJoo Ham
  1 sibling, 0 replies; 9+ messages in thread
From: Chanwoo Choi @ 2017-01-18  6:56 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, rjw
  Cc: cw00.choi, linux-pm, linux-kernel, stable

Until now, the trans_stat information of passive devfreq is not updated.
This patch updates the trans_stat information after setting the target
frequency of passive devfreq device.

Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
Cc: stable@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/devfreq.c          | 3 ++-
 drivers/devfreq/governor.h         | 2 ++
 drivers/devfreq/governor_passive.c | 5 +++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index a2c575a5a9ab..6c560af2a801 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -135,7 +135,7 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
  * @devfreq:	the devfreq instance
  * @freq:	the update target frequency
  */
-static int devfreq_update_status(struct devfreq *devfreq, unsigned long freq)
+int devfreq_update_status(struct devfreq *devfreq, unsigned long freq)
 {
 	int lev, prev_lev, ret = 0;
 	unsigned long cur_time;
@@ -171,6 +171,7 @@ static int devfreq_update_status(struct devfreq *devfreq, unsigned long freq)
 	devfreq->last_stat_updated = cur_time;
 	return ret;
 }
+EXPORT_SYMBOL(devfreq_update_status);
 
 /**
  * find_devfreq_governor() - find devfreq governor from name
diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h
index fad7d6321978..71576b8bdfef 100644
--- a/drivers/devfreq/governor.h
+++ b/drivers/devfreq/governor.h
@@ -38,4 +38,6 @@ extern void devfreq_interval_update(struct devfreq *devfreq,
 extern int devfreq_add_governor(struct devfreq_governor *governor);
 extern int devfreq_remove_governor(struct devfreq_governor *governor);
 
+extern int devfreq_update_status(struct devfreq *devfreq, unsigned long freq);
+
 #endif /* _GOVERNOR_H */
diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
index 9ef46e2592c4..443be65f4561 100644
--- a/drivers/devfreq/governor_passive.c
+++ b/drivers/devfreq/governor_passive.c
@@ -112,6 +112,11 @@ static int update_devfreq_passive(struct devfreq *devfreq, unsigned long freq)
 	if (ret < 0)
 		goto out;
 
+	if (devfreq->profile->freq_table
+		&& (devfreq_update_status(devfreq, freq)))
+		dev_err(&devfreq->dev,
+			"Couldn't update frequency transition information.\n");
+
 	devfreq->previous_freq = freq;
 
 out:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] PM / devfreq: Remove unnecessary separate _remove_devfreq()
       [not found]   ` <CGME20170118065653epcas5p25728109e3bc2458dc16c23904f908c66@epcas5p2.samsung.com>
@ 2017-01-18  6:56     ` Chanwoo Choi
  2017-01-24  3:41     ` MyungJoo Ham
  1 sibling, 0 replies; 9+ messages in thread
From: Chanwoo Choi @ 2017-01-18  6:56 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park, rjw; +Cc: cw00.choi, linux-pm, linux-kernel

The _remove_devfreq() releases the all resources of the devfreq
device. This function is only called in the devfreq_dev_release().
For that reason, the devfreq core doesn't need to leave the
_remove_devfreq() separately. This patch releases the all
resources in the devfreq_dev_release() and then removes the
_remove_devfreq().

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/devfreq.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 6c560af2a801..c908c10c200a 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -480,11 +480,15 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type,
 }
 
 /**
- * _remove_devfreq() - Remove devfreq from the list and release its resources.
- * @devfreq:	the devfreq struct
+ * devfreq_dev_release() - Callback for struct device to release the device.
+ * @dev:	the devfreq device
+ *
+ * Remove devfreq from the list and release its resources.
  */
-static void _remove_devfreq(struct devfreq *devfreq)
+static void devfreq_dev_release(struct device *dev)
 {
+	struct devfreq *devfreq = to_devfreq(dev);
+
 	mutex_lock(&devfreq_list_lock);
 	if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) {
 		mutex_unlock(&devfreq_list_lock);
@@ -506,19 +510,6 @@ static void _remove_devfreq(struct devfreq *devfreq)
 }
 
 /**
- * devfreq_dev_release() - Callback for struct device to release the device.
- * @dev:	the devfreq device
- *
- * This calls _remove_devfreq() if _remove_devfreq() is not called.
- */
-static void devfreq_dev_release(struct device *dev)
-{
-	struct devfreq *devfreq = to_devfreq(dev);
-
-	_remove_devfreq(devfreq);
-}
-
-/**
  * devfreq_add_device() - Add devfreq feature to the device
  * @dev:	the device to add devfreq feature.
  * @profile:	device-specific profile to run devfreq.
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH 1/3] PM / devfreq: Fix available_governor sysfs
       [not found]   ` <CGME20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5@epcas5p2.samsung.com>
  2017-01-18  6:56     ` [PATCH 1/3] PM / devfreq: Fix available_governor sysfs Chanwoo Choi
@ 2017-01-24  2:24     ` MyungJoo Ham
  2017-01-24  3:51     ` MyungJoo Ham
  2 siblings, 0 replies; 9+ messages in thread
From: MyungJoo Ham @ 2017-01-24  2:24 UTC (permalink / raw)
  To: Chanwoo Choi, Kyungmin Park, rjw; +Cc: linux-pm, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

> The devfreq using passive governor is not able to change the governor.
> So, the user can not change the governor through 'available_governor' sysfs
> entry. Also, the devfreq which don't use the passive governor is not able to
> change to 'passive' governor on the fly.
> 
> Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/devfreq/devfreq.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 4bd7a8f71b07..a2c575a5a9ab 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -43,6 +43,11 @@
>  static LIST_HEAD(devfreq_list);
>  static DEFINE_MUTEX(devfreq_list_lock);
>  
> +static int is_passive_gov(const char *governor_name)
> +{
> +	return (!strncmp(governor_name, "passive", 7)) ? 1 : 0;
> +}
> +

Having a special function for a governor in devfreq.c isn't looking good.
Could you create it more general?
(e.g., denying being replaced from passive governor)

I'd suggest to "define" data value of event_handler to include the reason
of STOP event for DEVFREQ_GOV_STOP. Then, a governor may "reject" it
depending on the reason. (the reason is to be defined in devfreq.h as well)

Then, the modification can be minimal and general for all others.

The modification in this commit looks too hacky.



Cheers,
MyungJoo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 2/3] PM / devfreq: Fix wrong trans_stat of passive devfreq device
       [not found]   ` <CGME20170118065653epcas5p2da6963fbad338a3c402c7d99f5e8473f@epcas5p2.samsung.com>
  2017-01-18  6:56     ` [PATCH 2/3] PM / devfreq: Fix wrong trans_stat of passive devfreq device Chanwoo Choi
@ 2017-01-24  3:40     ` MyungJoo Ham
  1 sibling, 0 replies; 9+ messages in thread
From: MyungJoo Ham @ 2017-01-24  3:40 UTC (permalink / raw)
  To: Chanwoo Choi, Kyungmin Park, rjw; +Cc: linux-pm, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

> Until now, the trans_stat information of passive devfreq is not updated.
> This patch updates the trans_stat information after setting the target
> frequency of passive devfreq device.

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

> 
> Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/devfreq/devfreq.c          | 3 ++-
>  drivers/devfreq/governor.h         | 2 ++
>  drivers/devfreq/governor_passive.c | 5 +++++
>  3 files changed, 9 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 3/3] PM / devfreq: Remove unnecessary separate _remove_devfreq()
       [not found]   ` <CGME20170118065653epcas5p25728109e3bc2458dc16c23904f908c66@epcas5p2.samsung.com>
  2017-01-18  6:56     ` [PATCH 3/3] PM / devfreq: Remove unnecessary separate _remove_devfreq() Chanwoo Choi
@ 2017-01-24  3:41     ` MyungJoo Ham
  1 sibling, 0 replies; 9+ messages in thread
From: MyungJoo Ham @ 2017-01-24  3:41 UTC (permalink / raw)
  To: Chanwoo Choi, Kyungmin Park, rjw; +Cc: linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

> The _remove_devfreq() releases the all resources of the devfreq
> device. This function is only called in the devfreq_dev_release().
> For that reason, the devfreq core doesn't need to leave the
> _remove_devfreq() separately. This patch releases the all
> resources in the devfreq_dev_release() and then removes the
> _remove_devfreq().
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

> ---
>  drivers/devfreq/devfreq.c | 23 +++++++----------------
>  1 file changed, 7 insertions(+), 16 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 1/3] PM / devfreq: Fix available_governor sysfs
       [not found]   ` <CGME20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5@epcas5p2.samsung.com>
  2017-01-18  6:56     ` [PATCH 1/3] PM / devfreq: Fix available_governor sysfs Chanwoo Choi
  2017-01-24  2:24     ` MyungJoo Ham
@ 2017-01-24  3:51     ` MyungJoo Ham
  2017-01-24  6:23       ` Chanwoo Choi
  2 siblings, 1 reply; 9+ messages in thread
From: MyungJoo Ham @ 2017-01-24  3:51 UTC (permalink / raw)
  To: Chanwoo Choi, Kyungmin Park, rjw; +Cc: linux-pm, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]

> The devfreq using passive governor is not able to change the governor.
> So, the user can not change the governor through 'available_governor' sysfs
> entry. Also, the devfreq which don't use the passive governor is not able to
> change to 'passive' governor on the fly.

Another thoughts on the characteristics of 'passive' governor:

1. Should we prohibit moving from "others" to "passive"?
2. Should we show "passive" in the available list if it's not passive now?
3. Why don't we show anyway and reject it when actually tries to change?
4. Or should we add a value in devfreq struct that is confired at devfreq
device add, which prohibits changing governors? (and passive will
return error if that flag is not set or it will set the value automatically)

Cheers,
MyungJoo

> 
> Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/devfreq/devfreq.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] PM / devfreq: Fix available_governor sysfs
  2017-01-24  3:51     ` MyungJoo Ham
@ 2017-01-24  6:23       ` Chanwoo Choi
  0 siblings, 0 replies; 9+ messages in thread
From: Chanwoo Choi @ 2017-01-24  6:23 UTC (permalink / raw)
  To: myungjoo.ham, Kyungmin Park, rjw; +Cc: linux-pm, linux-kernel, stable

On 2017년 01월 24일 12:51, MyungJoo Ham wrote:
>> The devfreq using passive governor is not able to change the governor.
>> So, the user can not change the governor through 'available_governor' sysfs
>> entry. Also, the devfreq which don't use the passive governor is not able to
>> change to 'passive' governor on the fly.
> 
> Another thoughts on the characteristics of 'passive' governor:
> 
> 1. Should we prohibit moving from "others" to "passive"?

The relation between parent devfreq and passive devfreq
is fixed by h/w because they share the one power line. 

But,
if you want to permit that some devfreq change 
their governor to passive governor. The current design
of devfreq does not support it. We must need to
rework the devfreq for the moving from 'others' to 'passive'.

The devfreq should consider the multiple dependency on hierachry 
as CCF (Common Clock Framework).

	devfreq2 (passive)
		devfreq5 (passive)
		devfreq6 (passive)
	devfreq3 (passive)
	devfreq4 (passive)
		devfreq7 (passive)
		devfreq8 (passive)
	

I add some examples as following:

Example1,
There is one parent devfreq which includes
the four passive devfreqs as following:
parent-dev1 (ondemand)
	passive-dev1 (passive)
	passive-dev2 (passive)
	passive-dev3 (passive)
	passive-dev4 (passive)
new-parent-dev2 (ondemand)


If changing the governor of 'parent-dev1' from ondemand to passive,
the user have to inform the information of new parent devfreq(new-parent-dev2).
Maybe, following command should be executed.
	echo [new-parent-dev2] > /sys/class/devfreq/[parent-dev1]/parent
		new-parent-dev2 
	echo passive > /sys/class/devfreq/[parent-dev1]/governor

After that, the final hierarchy will be following:

new-parent-dev2 (ondemand)
	parent-dev1 (passive)
		passive-dev1 (passive)
		passive-dev2 (passive)
		passive-dev3 (passive)
		passive-dev4 (passive)


Example2,
Before,
parent-dev1 (ondemand)
	passive-dev1 (passive)
	passive-dev2 (passive)
	passive-dev3 (passive)
	passive-dev4 (passive)
new-parent-dev2 (ondemand)

After that, if new-parent-dev2 use the passive governor with parent-dev1 device.

parent-dev1 (ondemand) - control voltage and freq
	passive-dev1 (passive) - control freq
 	passive-dev2 (passive) - control freq
	passive-dev3 (passive) - control freq
	passive-dev4 (passive) - control freq
	new-parent-dev2 (passive) - control voltage and freq


Example3,
There is one parent devfreq which includes
the four passive devfreqs as following:

parent-dev2 (ondemand)
	new-parent-dev3 (passive)
parent-dev1 (ondemand)
	passive-dev1 (passive)
	passive-dev2 (passive)
	passive-dev3 (passive)
	passive-dev4 (passive)

After that, if parent-dev1 use the passive governor with new-parent-dev3 device.

parent-dev2 (ondemand)
	new-parent-dev3 (passive)
		parent-dev1 (passive)
			passive-dev1 (passive)
			passive-dev2 (passive)
			passive-dev3 (passive)
			passive-dev4 (passive)


> 2. Should we show "passive" in the available list if it's not passive now?

Yes. I added the test result on cover letter about this.

Even if the parent devfreq device doesn't support the passive governor,
their 'available_governor' shows the 'passive' governor.

> 3. Why don't we show anyway and reject it when actually tries to change?

I think that the sysfs entry have to provide the correct information
to user-space. If available_governor shows the name of unsupported
governor, it is not reasonable and appropriate.
- cat /sys/class/devfreq/[devfreq name]/available_governor

So, the 'available_governor' should only show the supported governors.

> 4. Or should we add a value in devfreq struct that is confired at devfreq
> device add, which prohibits changing governors? (and passive will
> return error if that flag is not set or it will set the value automatically)

If we add some flags to devfreq for passive govenror,
devfreq will prohibits the changing governors. 

And, avaiable_governor function will use the new flags
to show the only supported governors.

I tried to use the existing fields of struct devfreq
without new field. But if you want to add new field,
I'll do.

> 
> Cheers,
> MyungJoo
> 
>>
>> Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>>  drivers/devfreq/devfreq.c | 34 +++++++++++++++++++++++++++++++++-
>>  1 file changed, 33 insertions(+), 1 deletion(-)


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-01-24  6:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170118065653epcas5p23158122f1f54c7419bc010527174b48e@epcas5p2.samsung.com>
2017-01-18  6:56 ` [PATCH 0/3] PM / devfreq: Fix issues about passive governor Chanwoo Choi
     [not found]   ` <CGME20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5@epcas5p2.samsung.com>
2017-01-18  6:56     ` [PATCH 1/3] PM / devfreq: Fix available_governor sysfs Chanwoo Choi
2017-01-24  2:24     ` MyungJoo Ham
2017-01-24  3:51     ` MyungJoo Ham
2017-01-24  6:23       ` Chanwoo Choi
     [not found]   ` <CGME20170118065653epcas5p25728109e3bc2458dc16c23904f908c66@epcas5p2.samsung.com>
2017-01-18  6:56     ` [PATCH 3/3] PM / devfreq: Remove unnecessary separate _remove_devfreq() Chanwoo Choi
2017-01-24  3:41     ` MyungJoo Ham
     [not found]   ` <CGME20170118065653epcas5p2da6963fbad338a3c402c7d99f5e8473f@epcas5p2.samsung.com>
2017-01-18  6:56     ` [PATCH 2/3] PM / devfreq: Fix wrong trans_stat of passive devfreq device Chanwoo Choi
2017-01-24  3:40     ` MyungJoo Ham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.