Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570436 > unrolled thread
| Started by | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| First post | 2017-01-31 07:40 +0100 |
| Last post | 2017-01-31 08:00 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 0/3] PM / devfreq: Fix issues about passive governor Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 07:40 +0100
[PATCH v2 2/3] PM / devfreq: Fix wrong trans_stat of passive devfreq device Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 07:50 +0100
[PATCH v2 1/3] PM / devfreq: Fix available_governor sysfs Chanwoo Choi <cw00.choi@samsung.com> - 2017-01-31 07:50 +0100
RE: [PATCH v2 1/3] PM / devfreq: Fix available_governor sysfs MyungJoo Ham <myungjoo.ham@samsung.com> - 2017-01-31 08:00 +0100
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-01-31 07:40 +0100 |
| Subject | [PATCH v2 0/3] PM / devfreq: Fix issues about passive governor |
| Message-ID | <t5AgF-5N5-5@gated-at.bofh.it> |
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 distinguish 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. Changes from v1: (https://lkml.org/lkml/2017/1/18/52) - Add acked-by tag of devfreq maintainer to patch2/3. - Remove the is_passive_gov() function because it is not appropriate to handle the specific governor name in the devfreq core. Instead, add the new 'immutable' flag to struct devfreq_governor. Depends on: - These patches based on the devfreq.git[1]. [1] https://git.kernel.org/cgit/linux/kernel/git/mzx/devfreq.git/ (branch: for-4.10-rc) For example, - The v1[2] series includes the detailed example about 'available_governors' and 'trans_stat' sysfs entry. We can refer to it. [2] https://lkml.org/lkml/2017/1/18/52 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 | 57 ++++++++++++++++++++++++-------------- drivers/devfreq/governor.h | 2 ++ drivers/devfreq/governor_passive.c | 6 ++++ include/linux/devfreq.h | 3 ++ 4 files changed, 47 insertions(+), 21 deletions(-) -- 1.9.1
[toc] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-01-31 07:50 +0100 |
| Subject | [PATCH v2 2/3] PM / devfreq: Fix wrong trans_stat of passive devfreq device |
| Message-ID | <t5Aql-5Qs-1@gated-at.bofh.it> |
| In reply to | #1570436 |
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>
Acked-by: MyungJoo Ham <myungjoo.ham@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 ade279d29f1e..4e86cc0106df 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -130,7 +130,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;
@@ -166,6 +166,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 93795b32dc09..5be96b2249e7 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
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-01-31 07:50 +0100 |
| Subject | [PATCH v2 1/3] PM / devfreq: Fix available_governor sysfs |
| Message-ID | <t5Aqm-5Qs-9@gated-at.bofh.it> |
| In reply to | #1570436 |
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 | 31 +++++++++++++++++++++++++++----
drivers/devfreq/governor_passive.c | 1 +
include/linux/devfreq.h | 3 +++
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 8e5938c9c7d6..ade279d29f1e 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -940,6 +940,9 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
if (df->governor == governor) {
ret = 0;
goto out;
+ } else if (df->governor->immutable || governor->immutable) {
+ ret = -EINVAL;
+ goto out;
}
if (df->governor) {
@@ -969,13 +972,33 @@ static ssize_t available_governors_show(struct device *d,
struct device_attribute *attr,
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)
- count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
- "%s ", tmp_governor->name);
+
+ /*
+ * The devfreq with immutable governor (e.g., passive) shows
+ * only own governor.
+ */
+ if (df->governor->immutable) {
+ count = scnprintf(&buf[count], DEVFREQ_NAME_LEN,
+ "%s ", df->governor_name);
+ /*
+ * The devfreq device shows the registered governor except for
+ * immutable governors such as passive governor .
+ */
+ } else {
+ struct devfreq_governor *governor;
+
+ list_for_each_entry(governor, &devfreq_governor_list, node) {
+ if (governor->immutable)
+ continue;
+ count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
+ "%s ", governor->name);
+ }
+ }
+
mutex_unlock(&devfreq_list_lock);
/* Truncate the trailing space */
diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
index 9ef46e2592c4..93795b32dc09 100644
--- a/drivers/devfreq/governor_passive.c
+++ b/drivers/devfreq/governor_passive.c
@@ -179,6 +179,7 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq,
static struct devfreq_governor devfreq_passive = {
.name = "passive",
+ .immutable = 1,
.get_target_freq = devfreq_passive_get_target_freq,
.event_handler = devfreq_passive_event_handler,
};
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 2de4e2eea180..e0acb0e5243b 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -104,6 +104,8 @@ struct devfreq_dev_profile {
* struct devfreq_governor - Devfreq policy governor
* @node: list node - contains registered devfreq governors
* @name: Governor's name
+ * @immutable: Immutable flag for governor. If the value is 1,
+ * this govenror is never changeable to other governor.
* @get_target_freq: Returns desired operating frequency for the device.
* Basically, get_target_freq will run
* devfreq_dev_profile.get_dev_status() to get the
@@ -121,6 +123,7 @@ struct devfreq_governor {
struct list_head node;
const char name[DEVFREQ_NAME_LEN];
+ const unsigned int immutable;
int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
int (*event_handler)(struct devfreq *devfreq,
unsigned int event, void *data);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | MyungJoo Ham <myungjoo.ham@samsung.com> |
|---|---|
| Date | 2017-01-31 08:00 +0100 |
| Subject | RE: [PATCH v2 1/3] PM / devfreq: Fix available_governor sysfs |
| Message-ID | <t5AA1-5Tz-9@gated-at.bofh.it> |
| In reply to | #1570436 |
[Multipart message — attachments visible in raw view] — view raw
> 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 | 31 +++++++++++++++++++++++++++----
> drivers/devfreq/governor_passive.c | 1 +
> include/linux/devfreq.h | 3 +++
> 3 files changed, 31 insertions(+), 4 deletions(-)
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Applying to for-next.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web