All of lore.kernel.org
 help / color / mirror / Atom feed
From: Youquan Song <youquan.song@intel.com>
To: linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com
Cc: youquan.song@intel.com
Subject: [PATCH] PM/QoS: resume latency 0 should be not latency allowed
Date: Mon,  1 Nov 2021 19:36:58 +0800	[thread overview]
Message-ID: <1635766618-24732-1-git-send-email-youquan.song@intel.com> (raw)

ICX and more recent Intel CPU has C1 exit_latency equal 1 in intel_idle
driver, There are PM QoS interfaces: global /dev/cpu_dma_latency and 
per-device latency constraints. per-CPU set pm_qos_resume_latency_us
to limit single CPU entery into deepest C-state. 
When it is required to disable entry into even C1, we need to set "0"
 to /sys pm_qos_resume_latency_us, but "0" of pm_qos_resume_latency_us
is redefined to no constraint now. 

so this patch set "0" back to original meaning "no latency at all".

Signed-off-by: Youquan Song <youquan.song@intel.com>
---
 drivers/base/power/sysfs.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index a1474fb67db9..b4bd67e6f440 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -214,10 +214,8 @@ static ssize_t pm_qos_resume_latency_us_show(struct device *dev,
 {
 	s32 value = dev_pm_qos_requested_resume_latency(dev);
 
-	if (value == 0)
-		return sysfs_emit(buf, "n/a\n");
 	if (value == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
-		value = 0;
+		return sysfs_emit(buf, "no constraint\n");
 
 	return sysfs_emit(buf, "%d\n", value);
 }
@@ -237,10 +235,8 @@ static ssize_t pm_qos_resume_latency_us_store(struct device *dev,
 		if (value < 0 || value == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
 			return -EINVAL;
 
-		if (value == 0)
-			value = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT;
 	} else if (sysfs_streq(buf, "n/a")) {
-		value = 0;
+		value = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT;
 	} else {
 		return -EINVAL;
 	}
-- 
2.27.0


             reply	other threads:[~2021-11-01 12:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 11:36 Youquan Song [this message]
2021-11-05 15:50 ` [PATCH] PM/QoS: resume latency 0 should be not latency allowed Rafael J. Wysocki
     [not found]   ` <BYAPR11MB3205164D85635F784AFA4C429C939@BYAPR11MB3205.namprd11.prod.outlook.com>
     [not found]     ` <20211110105833.GA30301@linux-youquan.bj.intel.com>
2021-11-10 19:24       ` Rafael J. Wysocki
2021-11-11  4:28         ` Youquan Song
2021-11-11 17:07           ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1635766618-24732-1-git-send-email-youquan.song@intel.com \
    --to=youquan.song@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.