* [PATCH 0/3] dev_pm_qos improvements
@ 2016-11-30 1:11 Andy Lutomirski
2016-11-30 1:11 ` [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Andy Lutomirski
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Andy Lutomirski @ 2016-11-30 1:11 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-kernel, Pavel Machek, linux-pm, Andy Lutomirski
Hi Rafael-
Here are three minor dev_pm_qos improvements that make my upcoming
nvme power management code work much better. Any chance you could
take them for 4.10?
Thanks,
Andy
Andy Lutomirski (3):
dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation
dev_pm_qos: Fix writing 'auto' to pm_qos_latency_tolerance_us
dev_pm_qos: Export dev_pm_qos_update_user_latency_tolerance
drivers/base/power/qos.c | 6 +++++-
drivers/base/power/sysfs.c | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation
2016-11-30 1:11 [PATCH 0/3] dev_pm_qos improvements Andy Lutomirski
@ 2016-11-30 1:11 ` Andy Lutomirski
2016-12-05 11:19 ` Pavel Machek
2016-11-30 1:11 ` [PATCH 2/3] dev_pm_qos: Fix writing 'auto' to pm_qos_latency_tolerance_us Andy Lutomirski
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Andy Lutomirski @ 2016-11-30 1:11 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-kernel, Pavel Machek, linux-pm, Andy Lutomirski
Negative values are special. Don't let users write them directly.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
drivers/base/power/sysfs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index a7b46798c81d..33b4b902741a 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -263,7 +263,11 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
s32 value;
int ret;
- if (kstrtos32(buf, 0, &value)) {
+ if (kstrtos32(buf, 0, &value) == 0) {
+ /* Users can't write negative values directly */
+ if (value < 0)
+ return -EINVAL;
+ } else {
if (!strcmp(buf, "auto") || !strcmp(buf, "auto\n"))
value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] dev_pm_qos: Fix writing 'auto' to pm_qos_latency_tolerance_us
2016-11-30 1:11 [PATCH 0/3] dev_pm_qos improvements Andy Lutomirski
2016-11-30 1:11 ` [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Andy Lutomirski
@ 2016-11-30 1:11 ` Andy Lutomirski
2016-11-30 1:11 ` [PATCH 3/3] dev_pm_qos: Export dev_pm_qos_update_user_latency_tolerance Andy Lutomirski
2016-12-01 14:26 ` [PATCH 0/3] dev_pm_qos improvements Rafael J. Wysocki
3 siblings, 0 replies; 6+ messages in thread
From: Andy Lutomirski @ 2016-11-30 1:11 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-kernel, Pavel Machek, linux-pm, Andy Lutomirski
If it was already 'auto', then writing 'auto' again would
incorrectly fail.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
drivers/base/power/qos.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 7f3646e459cb..6a1f2c7e01ea 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -856,7 +856,10 @@ int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val)
struct dev_pm_qos_request *req;
if (val < 0) {
- ret = -EINVAL;
+ if (val == PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT)
+ ret = 0;
+ else
+ ret = -EINVAL;
goto out;
}
req = kzalloc(sizeof(*req), GFP_KERNEL);
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] dev_pm_qos: Export dev_pm_qos_update_user_latency_tolerance
2016-11-30 1:11 [PATCH 0/3] dev_pm_qos improvements Andy Lutomirski
2016-11-30 1:11 ` [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Andy Lutomirski
2016-11-30 1:11 ` [PATCH 2/3] dev_pm_qos: Fix writing 'auto' to pm_qos_latency_tolerance_us Andy Lutomirski
@ 2016-11-30 1:11 ` Andy Lutomirski
2016-12-01 14:26 ` [PATCH 0/3] dev_pm_qos improvements Rafael J. Wysocki
3 siblings, 0 replies; 6+ messages in thread
From: Andy Lutomirski @ 2016-11-30 1:11 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-kernel, Pavel Machek, linux-pm, Andy Lutomirski
nvme wants a module parameter that overrides the default latency
tolerance. This makes it easy for nvme to reflect that default in
sysfs.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
drivers/base/power/qos.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 6a1f2c7e01ea..58fcc758334e 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -886,6 +886,7 @@ int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val)
mutex_unlock(&dev_pm_qos_mtx);
return ret;
}
+EXPORT_SYMBOL_GPL(dev_pm_qos_update_user_latency_tolerance);
/**
* dev_pm_qos_expose_latency_tolerance - Expose latency tolerance to userspace
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] dev_pm_qos improvements
2016-11-30 1:11 [PATCH 0/3] dev_pm_qos improvements Andy Lutomirski
` (2 preceding siblings ...)
2016-11-30 1:11 ` [PATCH 3/3] dev_pm_qos: Export dev_pm_qos_update_user_latency_tolerance Andy Lutomirski
@ 2016-12-01 14:26 ` Rafael J. Wysocki
3 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2016-12-01 14:26 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: linux-kernel, Pavel Machek, linux-pm
On Tuesday, November 29, 2016 05:11:49 PM Andy Lutomirski wrote:
> Hi Rafael-
Hi,
> Here are three minor dev_pm_qos improvements that make my upcoming
> nvme power management code work much better. Any chance you could
> take them for 4.10?
Yup, all [1-3/3] applied.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation
2016-11-30 1:11 ` [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Andy Lutomirski
@ 2016-12-05 11:19 ` Pavel Machek
0 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2016-12-05 11:19 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Rafael J. Wysocki, linux-kernel, linux-pm
[-- Attachment #1: Type: text/plain, Size: 927 bytes --]
On Tue 2016-11-29 17:11:50, Andy Lutomirski wrote:
> Negative values are special. Don't let users write them directly.
>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
> --- a/drivers/base/power/sysfs.c
> +++ b/drivers/base/power/sysfs.c
> @@ -263,7 +263,11 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
> s32 value;
> int ret;
>
> - if (kstrtos32(buf, 0, &value)) {
> + if (kstrtos32(buf, 0, &value) == 0) {
> + /* Users can't write negative values directly */
> + if (value < 0)
> + return -EINVAL;
> + } else {
> if (!strcmp(buf, "auto") || !strcmp(buf, "auto\n"))
> value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
> else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-12-05 11:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 1:11 [PATCH 0/3] dev_pm_qos improvements Andy Lutomirski
2016-11-30 1:11 ` [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Andy Lutomirski
2016-12-05 11:19 ` Pavel Machek
2016-11-30 1:11 ` [PATCH 2/3] dev_pm_qos: Fix writing 'auto' to pm_qos_latency_tolerance_us Andy Lutomirski
2016-11-30 1:11 ` [PATCH 3/3] dev_pm_qos: Export dev_pm_qos_update_user_latency_tolerance Andy Lutomirski
2016-12-01 14:26 ` [PATCH 0/3] dev_pm_qos improvements Rafael J. Wysocki
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.