From nobody Tue Dec 2 01:28:37 2025 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D3533446A8 for ; Fri, 21 Nov 2025 10:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719423; cv=none; b=FZo7SU/5loj3XugnqHDianyQnGMrFZxRhCxvOTN3JeP5YA0m94R8hrMBhjl7KF9vlGQ2SVqrtUpkgbFGogBvL6JtI7XRhWvkuSoqwSefGq9k7Vdy1D0ay/uzlQ9xz676aSGGxNybUb2MYNu18bFSbPZZKqazqaKWWMPpuxcFAtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719423; c=relaxed/simple; bh=GRcyPx6pS8Mo2Z6rJM/Yng60btmO1CA3xmrlBHaPA9U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E9RAXN6Vcu9HK1tbIchG/Rx7DkErwkkXm9G2FS/ZViRfg/vzMB+XCaYwj9dlv162bcoUniNaMXDwF1d2BMQjds/7A8Mfgxmsom93PxhKuj+t66E2hJ/Wl7WmCcwtsTQdWaK8gvtNl+rJlUY8M+yCTWbc5Kx5437Xx+l+gC61hmQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Ygk8prVb; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ygk8prVb" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-376466f1280so21267711fa.0 for ; Fri, 21 Nov 2025 02:03:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763719418; x=1764324218; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1r4XBHNsj/0gz9zuqPrs6Ple3BrfMasT4Ktn9PEtMI8=; b=Ygk8prVbRid8bb2LA0izUa5Ust40C2inmPMvjyNY6nijV5vOlcqNkwS16csicUwpor Kwonh63APJqy6ibvkFIQEeqWTXmsCB8+4ofbWmsdlh+b+WYXmYXziyRfVNCu+qfVAOWL 1gcszf26VlAGC78sd4R/WrHOkWZru1VZqLMODQOVfd6kYaWLYr2thcEWgQi0yg9ko209 Bzk17dykuamwmZdGDcnNszoTrthzVifjuPe/tsSuZ7AKkw+t8UfkO/otQ7Kj0EFmOt+s w74Gtr7aiYgSuRWNz0LFCuC4Avb2I3wCWIWPWnkHLmUJ5Bc9UBzQpMrVUBoORRmtVui9 faeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763719418; x=1764324218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1r4XBHNsj/0gz9zuqPrs6Ple3BrfMasT4Ktn9PEtMI8=; b=CYM5+O8vtgX7EOHtbw/OfbmhZ8GP/uvGeg8+OVuFFArJ2psLgohFGJxOTVWtAxsGN6 LoyapSfd6zrx6fxCUs/pE1zs4H05JsXWTJf9KTGjMZrXqFCaJuygve1zAACyC9ZqLlkv MIxDvbKUnXyoBuo/y8xDFVk4MOASV7MKgQjSyQZu/A4SQVJJWEBnyhb7IoAbJZBx2LPj n+KGY9rHoeHpeAaMn5aZEHLvuNlGpqPKVeVjk4emMGZVcYs0rRG8G1RuMrG20R6AScC2 RQ4xV52cHJpHom7shXRRZW/4PpxxWhSoKVsgQhbWTXq/irIMWxnHPj3qHnztKM297E0Y BQwA== X-Forwarded-Encrypted: i=1; AJvYcCWbIHe/NUP4UJOT9g/dwILX23UORFUt12w7766LBxOCUoIOlH5CF0M2n7a7fouktMwwwEEibFc2MIZm6EQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwTnd/4tG6lKt3E2FWH/zaeWq70sALHDO0mSc3kMPgcmO3YRGar 8TYfsN3imCIZlS+QNYNkpbYvAE02KvDt/W22ytSw8T5xn9UfFHYZnWlMohTUvofjcmM= X-Gm-Gg: ASbGncvLB8zTN2dxbzEliv34pkoYI9tQLteFeR9YVCH7y1R8f/MBdGYqUzNeOeoPozg EXLMe5zX2xashUYVpRlroFBDJsEe27R9XFoiUiTfhbWt0dpgQw/gyt1pvgdZNwIX4RgmvM32wSI eyOhRt1aHTn0p6PER4OY3ftlLr3JtqFjxdbiZsi+i/rnZJm3b7kdaHbnCVHr3IRyE4KOLUabpyG bYB9hhjgxz5mdSU4oLoyWRbMdu4SWoQ9TV3dk5/73CVNMDn3gTnpkBODyZfYHcnj7qrhdC0KWrr OMqYRcyh0ZlL4qlB8v9QEbW18L0YpdgKeexSRkhgrhwIg9kZ8Rl+UO3RXzklWUOBPQpjElIC4yP Fp89I3i4NmuefQBkHXW62Wg5c7z+tPLdr5YwFYhcBIqet99gs2qsGW0kITX8/uYBl901C9NNSqH UDrsbitE8svot95cT2qoAZ41Gi35UPh/NbXLVY/F1XM2rF1Mt8kBca7XpgGZN6 X-Google-Smtp-Source: AGHT+IFbZZlXsiqOlBDMPpDiOi/DBvwW1/TF85Ozxcxz75C1hy7utq5/v9TflE/lo+Wt4oJLXdanFA== X-Received: by 2002:a05:651c:1448:b0:37b:9977:7e62 with SMTP id 38308e7fff4ca-37cd9262cecmr4943401fa.31.1763719418410; Fri, 21 Nov 2025 02:03:38 -0800 (PST) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-37cc6b597b2sm11056181fa.12.2025.11.21.02.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 02:03:37 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Vincent Guittot , Peter Zijlstra , Kevin Hilman , Pavel Machek , Len Brown , Daniel Lezcano , Maulik Shah , Prasad Sodagudi , Dhruva Gole , Deepti Jaggi , Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/6] PM: QoS: Introduce a CPU system wakeup QoS limit Date: Fri, 21 Nov 2025 11:03:07 +0100 Message-ID: <20251121100315.316300-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121100315.316300-1-ulf.hansson@linaro.org> References: <20251121100315.316300-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some platforms supports multiple low power states for CPUs that can be used when entering system-wide suspend. Currently we are always selecting the deepest possible state for the CPUs, which can break the system wakeup latency constraint that may be required for a use case. Let's take the first step towards addressing this problem, by introducing an interface for user space, that allows us to specify the CPU system wakeup QoS limit. Subsequent changes will start taking into account the new QoS limit. Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) --- Changes in v3: - Add Kconfig for the new interface (Rafael). - Updated commit message. Changes in v2: - Renamings to reflect the QoS are limited to CPUs. - Move code inside "CONFIG_CPU_IDLE". --- include/linux/pm_qos.h | 9 ++++ kernel/power/Kconfig | 4 ++ kernel/power/qos.c | 106 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 4a69d4af3ff8..6cea4455f867 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -162,6 +162,15 @@ static inline void cpu_latency_qos_update_request(stru= ct pm_qos_request *req, static inline void cpu_latency_qos_remove_request(struct pm_qos_request *r= eq) {} #endif =20 +#ifdef CONFIG_PM_QOS_CPU_SYSTEM_WAKEUP +s32 cpu_wakeup_latency_qos_limit(void); +#else +static inline s32 cpu_wakeup_latency_qos_limit(void) +{ + return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; +} +#endif + #ifdef CONFIG_PM enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask); enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask); diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 54a623680019..839e2dbb889e 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -202,6 +202,10 @@ config PM_WAKELOCKS_GC depends on PM_WAKELOCKS default y =20 +config PM_QOS_CPU_SYSTEM_WAKEUP + bool "User space interface for CPU system wakeup QoS" + depends on CPU_IDLE + config PM bool "Device power management core functionality" help diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 4244b069442e..f7d8064e9adc 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -415,6 +415,105 @@ static struct miscdevice cpu_latency_qos_miscdev =3D { .fops =3D &cpu_latency_qos_fops, }; =20 +#ifdef CONFIG_PM_QOS_CPU_SYSTEM_WAKEUP +/* The CPU system wakeup latency QoS. */ +static struct pm_qos_constraints cpu_wakeup_latency_constraints =3D { + .list =3D PLIST_HEAD_INIT(cpu_wakeup_latency_constraints.list), + .target_value =3D PM_QOS_RESUME_LATENCY_NO_CONSTRAINT, + .default_value =3D PM_QOS_RESUME_LATENCY_NO_CONSTRAINT, + .no_constraint_value =3D PM_QOS_RESUME_LATENCY_NO_CONSTRAINT, + .type =3D PM_QOS_MIN, +}; + +/** + * cpu_wakeup_latency_qos_limit - Current CPU system wakeup latency QoS li= mit. + * + * Returns the current CPU system wakeup latency QoS limit that may have b= een + * requested by user space. + */ +s32 cpu_wakeup_latency_qos_limit(void) +{ + return pm_qos_read_value(&cpu_wakeup_latency_constraints); +} + +static int cpu_wakeup_latency_qos_open(struct inode *inode, struct file *f= ilp) +{ + struct pm_qos_request *req; + + req =3D kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return -ENOMEM; + + req->qos =3D &cpu_wakeup_latency_constraints; + pm_qos_update_target(req->qos, &req->node, PM_QOS_ADD_REQ, + PM_QOS_RESUME_LATENCY_NO_CONSTRAINT); + filp->private_data =3D req; + + return 0; +} + +static int cpu_wakeup_latency_qos_release(struct inode *inode, + struct file *filp) +{ + struct pm_qos_request *req =3D filp->private_data; + + filp->private_data =3D NULL; + pm_qos_update_target(req->qos, &req->node, PM_QOS_REMOVE_REQ, + PM_QOS_RESUME_LATENCY_NO_CONSTRAINT); + kfree(req); + + return 0; +} + +static ssize_t cpu_wakeup_latency_qos_read(struct file *filp, char __user = *buf, + size_t count, loff_t *f_pos) +{ + s32 value =3D pm_qos_read_value(&cpu_wakeup_latency_constraints); + + return simple_read_from_buffer(buf, count, f_pos, &value, sizeof(s32)); +} + +static ssize_t cpu_wakeup_latency_qos_write(struct file *filp, + const char __user *buf, + size_t count, loff_t *f_pos) +{ + struct pm_qos_request *req =3D filp->private_data; + s32 value; + + if (count =3D=3D sizeof(s32)) { + if (copy_from_user(&value, buf, sizeof(s32))) + return -EFAULT; + } else { + int ret; + + ret =3D kstrtos32_from_user(buf, count, 16, &value); + if (ret) + return ret; + } + + if (value < 0) + return -EINVAL; + + pm_qos_update_target(req->qos, &req->node, PM_QOS_UPDATE_REQ, value); + + return count; +} + +static const struct file_operations cpu_wakeup_latency_qos_fops =3D { + .open =3D cpu_wakeup_latency_qos_open, + .release =3D cpu_wakeup_latency_qos_release, + .read =3D cpu_wakeup_latency_qos_read, + .write =3D cpu_wakeup_latency_qos_write, + .llseek =3D noop_llseek, +}; + +static struct miscdevice cpu_wakeup_latency_qos_miscdev =3D { + .minor =3D MISC_DYNAMIC_MINOR, + .name =3D "cpu_wakeup_latency", + .fops =3D &cpu_wakeup_latency_qos_fops, +}; +#endif /* CONFIG_PM_QOS_CPU_SYSTEM_WAKEUP */ + static int __init cpu_latency_qos_init(void) { int ret; @@ -424,6 +523,13 @@ static int __init cpu_latency_qos_init(void) pr_err("%s: %s setup failed\n", __func__, cpu_latency_qos_miscdev.name); =20 +#ifdef CONFIG_PM_QOS_CPU_SYSTEM_WAKEUP + ret =3D misc_register(&cpu_wakeup_latency_qos_miscdev); + if (ret < 0) + pr_err("%s: %s setup failed\n", __func__, + cpu_wakeup_latency_qos_miscdev.name); +#endif + return ret; } late_initcall(cpu_latency_qos_init); --=20 2.43.0 From nobody Tue Dec 2 01:28:37 2025 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 573B5343D7F for ; Fri, 21 Nov 2025 10:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719426; cv=none; b=XzNHKVoazmwmfoh8bamkumk2v8BM4BktxqiWqQhAEzh202uHRTRlxXdSRdqXzctVkR8vYe6D0zo2eg0X/A+ECTuQSlR9nhi8MKtowgWnWDoHymdrtId8wtRgGb6UTYc/c7KBtg5ZNE3dG6cPUuXdM8DOngkOgoTI1VJN112IZmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719426; c=relaxed/simple; bh=MJxuCpjjKZOzZQVt9PIbLTi9e2sc7SsHSJWlFzSJx7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZJaLgMzsB5aIPGzymMKlDr2vzazx1R6Il8f61meUrmtqTxeWy/6DoQUws3IxU9CUExmX3vTSInN+YtkBFG8URCugJYv7TtOBZHqO+oBkWGD9y0wW1fLnHHNZFFN8C/NmBb5mQYdZNvGpF4BxAmTVy7436p/laYAEtI+viXPqsZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=NkMIuz0g; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NkMIuz0g" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-37a3a4d3d53so14389111fa.3 for ; Fri, 21 Nov 2025 02:03:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763719420; x=1764324220; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1jGPeEHKWVuJIa8HHZpuFjo58itYUjW84JrZNCFr27o=; b=NkMIuz0gQbdK7lRn62Mqtfw88TAIqwTsKy9EyKgTGQsLohNU3OsAx5PDeWTEY6nsGS +HTvINv8mIJj7uoGkWgzPx8BQ+q2tt4+88yzAQ5hKszg9ILTHE5kl6+aFVfAASw/WqAU Af2L/VwvS4iuUOBKugptedFlmbGkXXz6P7eVA37MjMg0MfIc8aUWWPPf3UIuVpExn4bF iQvLzYFmv099NKX0daE/w3eC4Nc34CJdviK+UxMlY7A1lw6WaVhghky4Azfgl7oT+7Fk VIyBWtsgFqq8y3VxEsIZ/x7dzKgsyjP+NMW2y3HATmYdW7A2YieoJaI4botnfvryiQUk lS3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763719420; x=1764324220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1jGPeEHKWVuJIa8HHZpuFjo58itYUjW84JrZNCFr27o=; b=sbHtUUUUtV8gAgF+cM6tWPM8ku5wkvFF1/w49nH7acdEqXajqKojTDWQkF3JaFsM2y ZTT77MxECtrRxdldONcdBjui6EmE0woIcu+61KaVz69V/p/8392Tntk7DOWNO0Ch+sAz BMa+jeya6EnrshCAclG57Rt/XMMhDSQwB7O3OOOZRERrc+Ed2v/TqzJ2ffKsJb2qBtlP aBbJ9noWXhwYjDr6d2ZaGAOB0BniQQhnVtWMOlm2hGIrDWdQf0TGQ141VKSUDNOK5hEx Pr6CW+M5cLsCBo9i3MvDMEdCXd74ObUKFcWw+chUSr8nb1kmBnjMLwbe/whOZ8DlOa0X r9mA== X-Forwarded-Encrypted: i=1; AJvYcCX4gZch4Xq9JiaWERjFFrWpJG7JrchOFZt7omqh6e5YatU4ZegetsZmjW1XPPfwmNE3+/yAjI+pzCUjr4k=@vger.kernel.org X-Gm-Message-State: AOJu0YzRqPYKdzRPuTvIzlz4wflxpQefFsEVr9oY/TVvrjnGqXSr39gn Q/eX32PUg+DTxF0uewL9wxZwyD5XjxbHBfTkPPgyM7eqn7Uzi48q3rMAz4Mk271jHQA= X-Gm-Gg: ASbGnctIaxamb2Ac8klPThk4IeCrBqA+Jy+gTmsdXbA1qowNPmUpfANtTuKEA0wWa5k RaeTXK7mc+G88uhX9Vu+kFQVr9SZgTeUSP9Wdqfxsuq5U2Zgl0MiKzi1/wSFD0dQOBmmRRd9EO+ TD6ROD2tqWC9mb70Q3DTSKp+jVFvFM181f0zOrjYWOVJTte0wqG/Rl0bJDsTuOXSqv8peHsPHAZ Fu0yzR+7AINykE3tI0lO1JCnPOoJXVW+0PeF22QtmB8cxwtldWKjxPyzYHdG+ovT7lKOmVS2cK9 gXOyCDqoX35q5BaVcd3IgoD7yhOyXViMQfMSHdotwfnPq4rOfe6CmqUWJHo7XqnxccmZba3IVJf izg5HE5rfV8HyeOLDWt3+6cxC1BFCsWB7RNhVoyDi6/X6t8ljCl6yW2406LtkEs9nkizfG8s7Aq phwdpYs5XVXMmUMVLVtiG8JlnCuS72uzs77urN8KrJkTwIahoVZURuaJCuw6a+ X-Google-Smtp-Source: AGHT+IFLmq3mXcT5DxVN+3wK08/EmPXPJaubrK1WkqZ8td8Jxs6hqP0+/hynWWzg8tl6NP7ARG8PKw== X-Received: by 2002:a2e:8a96:0:b0:35f:a210:2a35 with SMTP id 38308e7fff4ca-37cd91aab9cmr4951321fa.7.1763719419900; Fri, 21 Nov 2025 02:03:39 -0800 (PST) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-37cc6b597b2sm11056181fa.12.2025.11.21.02.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 02:03:39 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Vincent Guittot , Peter Zijlstra , Kevin Hilman , Pavel Machek , Len Brown , Daniel Lezcano , Maulik Shah , Prasad Sodagudi , Dhruva Gole , Deepti Jaggi , Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/6] pmdomain: Respect the CPU system wakeup QoS limit for s2idle Date: Fri, 21 Nov 2025 11:03:08 +0100 Message-ID: <20251121100315.316300-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121100315.316300-1-ulf.hansson@linaro.org> References: <20251121100315.316300-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A CPU system wakeup QoS limit may have been requested by user space. To avoid breaking this constraint when entering a low power state during s2idle through genpd, let's extend the corresponding genpd governor for CPUs. More precisely, during s2idle let the genpd governor select a suitable domain idle state, by taking into account the QoS limit. Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) --- Changes in v3: - Updated the commit message. Changes in v2: - Limite the change to the genpd governor for CPUs. --- drivers/pmdomain/core.c | 10 ++++++++-- drivers/pmdomain/governor.c | 27 +++++++++++++++++++++++++++ include/linux/pm_domain.h | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 61c2277c9ce3..4fd546ef0448 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -1425,8 +1425,14 @@ static void genpd_sync_power_off(struct generic_pm_d= omain *genpd, bool use_lock, return; } =20 - /* Choose the deepest state when suspending */ - genpd->state_idx =3D genpd->state_count - 1; + if (genpd->gov && genpd->gov->system_power_down_ok) { + if (!genpd->gov->system_power_down_ok(&genpd->domain)) + return; + } else { + /* Default to the deepest state. */ + genpd->state_idx =3D genpd->state_count - 1; + } + if (_genpd_power_off(genpd, false)) { genpd->states[genpd->state_idx].rejected++; return; diff --git a/drivers/pmdomain/governor.c b/drivers/pmdomain/governor.c index 39359811a930..bd1b9d66d4a5 100644 --- a/drivers/pmdomain/governor.c +++ b/drivers/pmdomain/governor.c @@ -415,9 +415,36 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd) return false; } =20 +static bool cpu_system_power_down_ok(struct dev_pm_domain *pd) +{ + s64 constraint_ns =3D cpu_wakeup_latency_qos_limit() * NSEC_PER_USEC; + struct generic_pm_domain *genpd =3D pd_to_genpd(pd); + int state_idx =3D genpd->state_count - 1; + + if (!(genpd->flags & GENPD_FLAG_CPU_DOMAIN)) { + genpd->state_idx =3D state_idx; + return true; + } + + /* Find the deepest state for the latency constraint. */ + while (state_idx >=3D 0) { + s64 latency_ns =3D genpd->states[state_idx].power_off_latency_ns + + genpd->states[state_idx].power_on_latency_ns; + + if (latency_ns <=3D constraint_ns) { + genpd->state_idx =3D state_idx; + return true; + } + state_idx--; + } + + return false; +} + struct dev_power_governor pm_domain_cpu_gov =3D { .suspend_ok =3D default_suspend_ok, .power_down_ok =3D cpu_power_down_ok, + .system_power_down_ok =3D cpu_system_power_down_ok, }; #endif =20 diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index f67a2cb7d781..93ba0143ca47 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -153,6 +153,7 @@ enum genpd_sync_state { }; =20 struct dev_power_governor { + bool (*system_power_down_ok)(struct dev_pm_domain *domain); bool (*power_down_ok)(struct dev_pm_domain *domain); bool (*suspend_ok)(struct device *dev); }; --=20 2.43.0 From nobody Tue Dec 2 01:28:37 2025 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84C933446B5 for ; Fri, 21 Nov 2025 10:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719426; cv=none; b=W78HebcoGfd+rG0tQMVEJNsVDQneMTbLXApqHIVs8vwtuBKMwD48DZknq71Y3KmHRGTBIZchvtCRKRJB6jAfSlsoDB2ok/36LisUdZpFdxkyHkhVvIEQT3/Y8FH5yyocUJ57eD4p0CD9HUd6D/9qzFzZSL72kATaSx/4Rk0ljao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719426; c=relaxed/simple; bh=8POtwl+8gIl6KiVvX3+dIyH9ModDs3FOmNCMp2hDAF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n21JWzv0DZmAv4yBM4+TjPn2byT8N7Z26TQD6AUEpFR+04FRPZrYTHF2Jz2hD88ZLKo5JeAQIdrC9UHTAHxeJZCB5ugKky9M0L6kA0cgLuRvnsIU1W588bDXM3oSNSIb4E5rxVVuySbK5Wn3Sm5TC9SQNS0bBuSrWFLqExx6mM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dHa3APnU; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dHa3APnU" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-37a3d86b773so16976451fa.0 for ; Fri, 21 Nov 2025 02:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763719421; x=1764324221; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wjWIzWz/eyhljtrpfcXseW6nO885XaZnowKeb56K2bo=; b=dHa3APnU6Bt507S1cIhflRL9rGDzEnF32TE195mr1RVk2wC+nw/B7SwOCeMEQ9D7l3 Wyul4mv/t7UpPJ4a/KdhsPc5bei+Aj9g2TPaEPKMA2UW0KxMTS0yxiwaHte5qCbNx4/8 qOdkKnIWoEawEAv6zGWQZEt53Rtk9SXMtqm7Gjv8akRVGpGiAbqczz+mGm3IVZetNkGl FWa8udFaGu9YPUIhSEJERHYrC+bW1AOXkAJgHELfwMURwkuGxIo39S6CeW+nu8TkugjW A2DBXmm4FE6Vb9KMmC6gIIYcLGSRbgRn2kVQijDmQ4kqFaH0sGJFBEFVDPQyRHmyLbXW QjWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763719421; x=1764324221; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wjWIzWz/eyhljtrpfcXseW6nO885XaZnowKeb56K2bo=; b=McRfmuHnzhs9oEaRJFBuef71tgxAVk+i1PIWzNbdowlo7Xujxhv1FuaK+DC0Fq6QFF NnmJzpFBrBxAgzS+9JH2gVR1awfZPfkk9kZRDg9gxqy8cPgiEmOhxyvu+eTKcH2pj/pO Z1fMOllWe8gKvRRJMPr73GchgbE3apKzehNcDmlvMA56X3S2cWcfSFON4bRLs/C3DT8N k3gufWlNerxxSzxZtdxvWZvXH4t2fN6mtQD+hTq5HODkU6TMYlwRQybYYU760xwXkuYA w7rI5ZWCyGKBoEd3GJ9aiZ+W89E4A4mv1QeOPxbwF6nQc5ibEl4KvU+yPfdWEnwWCwhn s8Xg== X-Forwarded-Encrypted: i=1; AJvYcCUy3wfxoJil7upSmunZGSyC0UohqLWR9tfYSNASN4nxOCTrpmxae3ESsbC56YKyCRRygiDzxCCSZBpSubM=@vger.kernel.org X-Gm-Message-State: AOJu0YzLrxhfXb6lFB6YgTplzJTUyF7drFOPpsPRLeF/ZuobmthvmGnd jxWm7Ca2HYzzid4ky+b78dXbokhOKAwoyjDlbNJGeBzW0Yqjb76V7SLRntsr3RoICGQ= X-Gm-Gg: ASbGncsqLdUyp158s+UGqDhCMLk0uWUgUC7V0AwjM/s+gRM8YwHb/eor5txO+euzqYL sCPQtqAHproTgBGGrW4713NAcFrjkzgwKENVNHyZffc9whl53r7aR4TFjw00uBkD3u+hzyG8agx SImn0ELL3lJMGRu0JnMCVAr7EKnYOu+OoGuOJ5D0MZRgm8m/m/dC75Mrqk2k8CyG8HWkuNq+pj1 Y5Y7wPcF7rsBXLHH49MfWJ0ao3lCnWrrY12soeofD5es8XCMM4434GQphNMZ+9dzseVhEBgWV+e eKHCZnnFoiptOIbQDdPhaPOEpFwMjetBlj7mqqH1MbZOcOH+JlFJ6hP8yLVschHEc/W2BzR/NHu r3j7Scb6zh1+2iAPTt7mpT9gt6JvtHNRFAQO3nBILvAfQjdwbS84duVqBmJ/0ybkJp4z/8A4Ygc l4KcTKvJ4S59J1ONAHosDJjsmNjPoz81BReDDgwSf90wwSDvHigfU5Df6dmUEy X-Google-Smtp-Source: AGHT+IFSL0xhKngQoCd6w7yuR7+wVAiUcarsUMEIQV5fjj4GKrmC8uuyieReZfwwK4nQsRjrwIWOlg== X-Received: by 2002:a2e:92cc:0:b0:37b:9d7e:2295 with SMTP id 38308e7fff4ca-37cd92e3665mr3603501fa.41.1763719421288; Fri, 21 Nov 2025 02:03:41 -0800 (PST) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-37cc6b597b2sm11056181fa.12.2025.11.21.02.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 02:03:40 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Vincent Guittot , Peter Zijlstra , Kevin Hilman , Pavel Machek , Len Brown , Daniel Lezcano , Maulik Shah , Prasad Sodagudi , Dhruva Gole , Deepti Jaggi , Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH v3 3/6] pmdomain: Respect the CPU system wakeup QoS limit for cpuidle Date: Fri, 21 Nov 2025 11:03:09 +0100 Message-ID: <20251121100315.316300-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121100315.316300-1-ulf.hansson@linaro.org> References: <20251121100315.316300-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The CPU system wakeup QoS limit must be respected for the regular cpuidle state selection. Therefore, let's extend the genpd governor for CPUs to take the constraint into account when it selects a domain idle state for the corresponding PM domain. Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) --- Changes in v3: - New patch. --- drivers/pmdomain/governor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pmdomain/governor.c b/drivers/pmdomain/governor.c index bd1b9d66d4a5..05e68680f34b 100644 --- a/drivers/pmdomain/governor.c +++ b/drivers/pmdomain/governor.c @@ -351,7 +351,7 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd) ktime_t domain_wakeup, next_hrtimer; ktime_t now =3D ktime_get(); struct device *cpu_dev; - s64 cpu_constraint, global_constraint; + s64 cpu_constraint, global_constraint, wakeup_constraint; s64 idle_duration_ns; int cpu, i; =20 @@ -362,7 +362,11 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd) if (!(genpd->flags & GENPD_FLAG_CPU_DOMAIN)) return true; =20 + wakeup_constraint =3D cpu_wakeup_latency_qos_limit(); global_constraint =3D cpu_latency_qos_limit(); + if (global_constraint > wakeup_constraint) + global_constraint =3D wakeup_constraint; + /* * Find the next wakeup for any of the online CPUs within the PM domain * and its subdomains. Note, we only need the genpd->cpus, as it already --=20 2.43.0 From nobody Tue Dec 2 01:28:37 2025 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E7063446AB for ; Fri, 21 Nov 2025 10:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719428; cv=none; b=OPFX9SXwF6Lu23fJAo72Kz5Kt3CSMdudaaeZj58l4wBCYZPcpLBipIeG1kf7tVliQFwfoWISDsometm4lar08saTf0o2UfXW1gixlZqO+6oE+cK90Q60331UCjEOqFVSQRxaUgyI5HT+qZyi9vyc8UbyPBmtf29R/mQgdrYfmBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719428; c=relaxed/simple; bh=K3MxTv90njG8ObrSi5Q0KC7YVJRI9TsyV3oJl0B8R7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sq8Uj502C247r1UD+KfKxiw49o+caKxi0Ai47xQ+GLy2aUzwKKkZUqLt7HySfBmJmm6cnflPhWlh5hJIqPXSJD0CyboqOEjrUe2FGnMVMHPHRxNEza8vZ+0FvkVDflXGZKqpc5RUmrP01ElJR9eMVzpggrtWMd20FiU/Wu0pcB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qIAeuc8k; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qIAeuc8k" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-37b996f6b28so15526291fa.3 for ; Fri, 21 Nov 2025 02:03:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763719423; x=1764324223; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wc4a0PHuDmrPqR556Ou7IBfq8uevDM9S8fV5JzT1uPs=; b=qIAeuc8kArqRHlcMD++i7dCCQTOp7fQ4pyhPodrkpVYGfk+FR7/AslYHzg7Bg/2QzN /X/5opMVqvVXhsJbCwNsRpHGiSsiCbz6GTtF4Xa1zcT4sda+u8Ms7/UKNsKLu862F288 uMAHYEu1Wis9cFBTneJ71FEi9mYy5atj3vgpejcAP63MfPgbgmBUzob4HHDzzE0BHFr9 XjmoMekOF4An6IsA9xLe2QjoP3oBmpgUBcprTUgbT385e9jPfUiZLsqXx3Mci2k1GjF0 xk+xxFh8yODFYfgGm1oS9aOoid3r+W62hB4lFA9EvryfWrd6Y4KOIHECyoR7jgBVOEZL Z2dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763719423; x=1764324223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wc4a0PHuDmrPqR556Ou7IBfq8uevDM9S8fV5JzT1uPs=; b=FIZ0wd+0qaWfDcqZqvfJqzo+y7FiwMGHZ48T3jruoWs6I437zxmIvEYux6JN4vLMXW Aq7uniS5piGs5GmI11CoIb24XDd4IgSVal1SL1q3yu7K9KkrOcRasQhhTccfE4kDTyRY i5vi5WrBhXDltFJTyq0SIfx8dLiVhygZYDN4HJCSHj0g3jSYGdv36b23jt4VA0d/o2O3 0cvVfeAe+07OLNrsqlOfcbOkDpcGn8I969MlzKPb3MZWWXRWM156JqKKh2S9koPXHVkS q+RzHhNz93GeB3pj3lwrh9X2L5c4EWkDfD/mWGKZ92dRdjNFgqXxAAXnfbmmNZN5shf4 SBRQ== X-Forwarded-Encrypted: i=1; AJvYcCWW6TjAdSzkdme8kudu9dO3AR0D4HgMtVoCTTreoeJNLIzsHOqk+vbQTA0gFKAcDcKe1aYShwFNz0Yckd8=@vger.kernel.org X-Gm-Message-State: AOJu0YyUwoubHaf/0NM/UvVPtR1y0vv5UNSNb8inRcog+mNdPBi+y6jP DbQ9xBztLaCt0vu/MwlgXOuWIWETGUTJeQD14wjEdY9KS0ZBXLyWL0R3Ncf5H1jB4LA= X-Gm-Gg: ASbGncua0RmbeVm47xb5cSWfKoqGVyUyjmMvK6WFLYWfe7QENLSgNcBru4ewooxdxTg SeGA3K52yHAN9Ce5slIeDde7skTELrwOzLL8Irg7hXwP1Yfs4I8L3+ev4z551QtTnfqn2NG/fGw eGfimWpiDBLrutL+R+eEr64XNLmHeq+1kUoKICZRaRGZkdFXzZTv8ba7H3aEDR7LNJoC09HEwE6 KiW6WxSgkp5EmxMUZNZHa++VS+vTM2hYAi8/oQIX3eSZpqe4vSziZte97h5awwpyl7oOymdSuvw ylRnUQbYG7zfrQf8bHeBmLWwdr9xIURaZ8ZZXd7pTWzcI9BB2ol6fsR0EXIKQtg/xm3U0ufU8CW DQOYv/WCPL97EeHr2/OFEyHOTKVdBh8OcRDvb1dwxbIT+H9tcpnXjac29xdx0x5O/mMNXJJyr4+ q2TqpjJsv64Tq4BRa27wUCioqpoaZUoKyUloMYGGEIWr7irTeZeDh6eUOEMqWy X-Google-Smtp-Source: AGHT+IHqTYQeVPe88r/RF7U4BUGHstho8L55Y/bCN09qnK5NUE1fa5dy2Zd0wMboPTMi78eqXpiy+w== X-Received: by 2002:a05:651c:25c5:10b0:37b:a4e2:43fa with SMTP id 38308e7fff4ca-37cd92bf090mr3845761fa.43.1763719422602; Fri, 21 Nov 2025 02:03:42 -0800 (PST) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-37cc6b597b2sm11056181fa.12.2025.11.21.02.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 02:03:41 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Vincent Guittot , Peter Zijlstra , Kevin Hilman , Pavel Machek , Len Brown , Daniel Lezcano , Maulik Shah , Prasad Sodagudi , Dhruva Gole , Deepti Jaggi , Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH v3 4/6] sched: idle: Respect the CPU system wakeup QoS limit for s2idle Date: Fri, 21 Nov 2025 11:03:10 +0100 Message-ID: <20251121100315.316300-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121100315.316300-1-ulf.hansson@linaro.org> References: <20251121100315.316300-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A CPU system wakeup QoS limit may have been requested by user space. To avoid breaking this constraint when entering a low power state during s2idle, let's start to take into account the QoS limit. Acked-by: Peter Zijlstra (Intel) Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) --- Changes in v3: - Updated commit message and added ack from Peter. Changes in v2: - Rework the code to take into account the failure/error path, when we don't find a s2idle specific state. --- drivers/cpuidle/cpuidle.c | 12 +++++++----- include/linux/cpuidle.h | 6 ++++-- kernel/sched/idle.c | 12 +++++++----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 56132e843c99..c7876e9e024f 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -184,20 +184,22 @@ static noinstr void enter_s2idle_proper(struct cpuidl= e_driver *drv, * cpuidle_enter_s2idle - Enter an idle state suitable for suspend-to-idle. * @drv: cpuidle driver for the given CPU. * @dev: cpuidle device for the given CPU. + * @latency_limit_ns: Idle state exit latency limit * * If there are states with the ->enter_s2idle callback, find the deepest = of * them and enter it with frozen tick. */ -int cpuidle_enter_s2idle(struct cpuidle_driver *drv, struct cpuidle_device= *dev) +int cpuidle_enter_s2idle(struct cpuidle_driver *drv, struct cpuidle_device= *dev, + u64 latency_limit_ns) { int index; =20 /* - * Find the deepest state with ->enter_s2idle present, which guarantees - * that interrupts won't be enabled when it exits and allows the tick to - * be frozen safely. + * Find the deepest state with ->enter_s2idle present that meets the + * specified latency limit, which guarantees that interrupts won't be + * enabled when it exits and allows the tick to be frozen safely. */ - index =3D find_deepest_state(drv, dev, U64_MAX, 0, true); + index =3D find_deepest_state(drv, dev, latency_limit_ns, 0, true); if (index > 0) { enter_s2idle_proper(drv, dev, index); local_irq_enable(); diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index a9ee4fe55dcf..4073690504a7 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -248,7 +248,8 @@ extern int cpuidle_find_deepest_state(struct cpuidle_dr= iver *drv, struct cpuidle_device *dev, u64 latency_limit_ns); extern int cpuidle_enter_s2idle(struct cpuidle_driver *drv, - struct cpuidle_device *dev); + struct cpuidle_device *dev, + u64 latency_limit_ns); extern void cpuidle_use_deepest_state(u64 latency_limit_ns); #else static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv, @@ -256,7 +257,8 @@ static inline int cpuidle_find_deepest_state(struct cpu= idle_driver *drv, u64 latency_limit_ns) {return -ENODEV; } static inline int cpuidle_enter_s2idle(struct cpuidle_driver *drv, - struct cpuidle_device *dev) + struct cpuidle_device *dev, + u64 latency_limit_ns) {return -ENODEV; } static inline void cpuidle_use_deepest_state(u64 latency_limit_ns) { diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index c39b089d4f09..c1c3d0166610 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -131,12 +131,13 @@ void __cpuidle default_idle_call(void) } =20 static int call_cpuidle_s2idle(struct cpuidle_driver *drv, - struct cpuidle_device *dev) + struct cpuidle_device *dev, + u64 max_latency_ns) { if (current_clr_polling_and_test()) return -EBUSY; =20 - return cpuidle_enter_s2idle(drv, dev); + return cpuidle_enter_s2idle(drv, dev, max_latency_ns); } =20 static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device = *dev, @@ -205,12 +206,13 @@ static void cpuidle_idle_call(void) u64 max_latency_ns; =20 if (idle_should_enter_s2idle()) { + max_latency_ns =3D cpu_wakeup_latency_qos_limit() * + NSEC_PER_USEC; =20 - entered_state =3D call_cpuidle_s2idle(drv, dev); + entered_state =3D call_cpuidle_s2idle(drv, dev, + max_latency_ns); if (entered_state > 0) goto exit_idle; - - max_latency_ns =3D U64_MAX; } else { max_latency_ns =3D dev->forced_idle_latency_limit_ns; } --=20 2.43.0 From nobody Tue Dec 2 01:28:37 2025 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 643ED345751 for ; Fri, 21 Nov 2025 10:03:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719429; cv=none; b=eU7PLx6tLh1egECwwwYXTtoykngIDmGTFzNf1bHTOKjZVKKXiKtKvSg9LZ1svEOU1MTTJ9YHndYUdHBiE4JGT7haoEMrHzyycV67paJrrCEr7ots752wc0MNPFmAn5H7K3ZM9GyjqLkOk9/YedoZlvqwc/ho5SJzzHQiNmutS24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719429; c=relaxed/simple; bh=a/PdidFVEmt+TuSU7dq0QFOPXPbHQ7yt6nQ8TU7n0i0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SMvtkAo8qfAap4RB6TrZFZxKipAEPE7dRkdNY0LQRkHKYttmaZspq+ubP+LtVzUIzB7V52NU9kXJNthS9/rl3jQzq5pA63yWth1FhlB0j2cspwhZOmgeCT/cLV+1++RMgGmDYP/r1CzKcdnFwXhp8itrBUbvsVPxV4R6EefXhVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Lu8tBGuf; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Lu8tBGuf" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-3761e5287c9so24777141fa.2 for ; Fri, 21 Nov 2025 02:03:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763719424; x=1764324224; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tPQNRRhubvM7zCEF89wCepqwWloD8O95karvM5Uhkuc=; b=Lu8tBGuftnjRYk4hnFzE9ePfDfGGBDbhz5Ze4eQKpeKDnpkHAqCxOpy03q6G2WOGY9 K5mDbO7vGoNe5rvAVsvpYjolTdFmIByWdkxplZy0VyleiRmUQxK+PZNojsaWxK19YSyW /i2sBni0yom35+v8LE5q+kegq+YXPdXsptG7VrgNLltEXvko67l4E2q0LHaZwLzmrUuR jbvJUT65WZ0HWAEs+u2DFiV1mfU+f9ks7bqMowd58k5oYC65hKWZwZDT2l74KthOr/Ct lZEku2O1rFvLtKc+aLVQ9U2XooSmLVLkSOcuXMYjLY036CMyAwZhtx1YFt1NInNvAJV/ 07IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763719424; x=1764324224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tPQNRRhubvM7zCEF89wCepqwWloD8O95karvM5Uhkuc=; b=KyUNqYs8F1i5+dnWqQ/1jicgZUKt4s1QMs/zcHhOcY5HvX2W91bxfrVVQy5FYIL5xV AIGNgS8RuktgntIyJpM3EBNnixzY/TzHpUNWvKUM4nXwBKUauU/c3VmlwW5nrbmxHlvY waUHZJ5JXLpga+69euHl/pfaA3mgiBupoLRihgDr96z6SlVHvEuF2Eci6fJErUOtwKPp xXr6IPRczF6DbktxMVKkD1ZSErPdkboEvMZk9U1pipfXQRGvpFg9gZjzGPqbj72c7oHx k5YZL6FIp4Yf2XIOM0LHjNncNIqSY6zU/8nl22F536ChfV8gcXc3xP/obKJL3+Dbyeue stww== X-Forwarded-Encrypted: i=1; AJvYcCVvOI8Fvk1pZfvr+4edmUfi3ZVVKhlUMM2mZOVHyHvxBBx440r404+1HGtSUOoctJwzROx33/H7yBOR9x0=@vger.kernel.org X-Gm-Message-State: AOJu0YxNee063zqfaN+LaqsYJ6HUwXUSuPewd/11KnX2Kjk2RcOYgyvg O9p5bgk3wZEZX1xLNSyNdjphVA1R9SaJpPNm+9/ERuTSBdnkzyDToMm+hJyvVGro3A0= X-Gm-Gg: ASbGncsf30nGJdbj8hQFidP+wdFTMyhYhigyQYz5hQLGe8+77S4lq3fQt7udy6xzPRP 3L5hMQ7ubSWFFisJOheQkApM70yPme0Kk3LG4yhfb1B050MFUV0g8+YuNMoe9Ti26f0Q3W1MFaC sPImGMupMs+TiZ+qXLqOiYRUC6M/HXcEx8vKsPljAeRnAoFavUVY1j5CLkQNRpe8JaV5DmFeX23 NkS4nsmDF6pH6reT+auc8BdXuZsCMZzSnW9ZhQEStYByg4zcNy9kKcryTigJ6tESfoYtBiUVVmD QVdkxhA2XaaM5t5IoiCTaAiqF3XTbAsSD+3hbYs90FYyDfbRKi1kWa2WVCzvdFVaQGBU1b9Wxrb rhEiZixwdZqWev6Rrh5YAPrkk570sSXds9FYYuUBHcmMYKPpNyhN4ESBuhmzQiGLevXsOjYZiOq GtP8od8L3y/M71Nb8SwHmo3O2uR9woWfW72V35c1/Gf80o9CzWLoSP66Yl5cYd X-Google-Smtp-Source: AGHT+IFISa9cfZTTIz+eUqSav3hIVAT0BH25bsjw5d2hau3oEJPHc+1ORTWBIYfnYnjwEksZlYryKg== X-Received: by 2002:a05:651c:25d7:10b0:372:9131:3a82 with SMTP id 38308e7fff4ca-37cd917531bmr3665691fa.2.1763719423914; Fri, 21 Nov 2025 02:03:43 -0800 (PST) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-37cc6b597b2sm11056181fa.12.2025.11.21.02.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 02:03:43 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Vincent Guittot , Peter Zijlstra , Kevin Hilman , Pavel Machek , Len Brown , Daniel Lezcano , Maulik Shah , Prasad Sodagudi , Dhruva Gole , Deepti Jaggi , Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH v3 5/6] cpuidle: Respect the CPU system wakeup QoS limit for cpuidle Date: Fri, 21 Nov 2025 11:03:11 +0100 Message-ID: <20251121100315.316300-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121100315.316300-1-ulf.hansson@linaro.org> References: <20251121100315.316300-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The CPU system wakeup QoS limit must be respected for the regular cpuidle state selection. Therefore, let's extend the common governor helper cpuidle_governor_latency_req(), to take the constraint into account. Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) --- Changes in v3: - New patch. --- drivers/cpuidle/governor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c index 0d0f9751ff8f..5d0e7f78c6c5 100644 --- a/drivers/cpuidle/governor.c +++ b/drivers/cpuidle/governor.c @@ -111,6 +111,10 @@ s64 cpuidle_governor_latency_req(unsigned int cpu) struct device *device =3D get_cpu_device(cpu); int device_req =3D dev_pm_qos_raw_resume_latency(device); int global_req =3D cpu_latency_qos_limit(); + int global_wake_req =3D cpu_wakeup_latency_qos_limit(); + + if (global_req > global_wake_req) + global_req =3D global_wake_req; =20 if (device_req > global_req) device_req =3D global_req; --=20 2.43.0 From nobody Tue Dec 2 01:28:37 2025 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93CCB126C17 for ; Fri, 21 Nov 2025 10:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719431; cv=none; b=JktbR2TAYNGXGmSd7hzktFKrSLlKCL/xfMylFfW4zHvaIXCrd0tdZOAY5Hl0SZEb5opVsotvxOKZDerm6WtzGe5vhOgslczW1QlLyMHq5AWn4EfkkanhLwWFZQWvpM0MMCqFKOJsUcxjwg2ZNXnwtYq9Ao8eyV9B6YQF0GmM/Dc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763719431; c=relaxed/simple; bh=x+e7y/pvYnxiFBlQnOJXkaitWecU5Du5bsfUUw5U7PM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DSdzdMvmtwXFM7VO6BeDB1LKJbjv1TD07TdLFYQguf6q8gegm7M07kfAJaY3IGDSp33tgJHS5riHc1pPoSRIIObfr740PoGSxElfEv2XUEGSGLsujsmZ/6vzgCGxDeJn0WNNIGG+KNWr4H2YvkKedukyV1OUEYZwzuya03rBR74= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hEjr5oQl; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hEjr5oQl" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-37ba5af5951so19944651fa.1 for ; Fri, 21 Nov 2025 02:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763719425; x=1764324225; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pC4XiP3l8Ew8D/XkZDyv3rIKzQexxvvUyzQqhlG1XiY=; b=hEjr5oQl8g8sTWpX9WKE6QYoy6k0kzBgMKIZQh6oH9vnzf6vSg8vxLXDYBcjHiWsjc os55PYPbJ8QlAnAfzbQBCovLmhWUKSzkO/Z53cRyRWH2WVMYG9p2rstzq1Qz3aZSCzGz 6cQbqAyP/x8e97FQUDVsccBeZKTbmDzf/V57j7K6/wbQDqAi/tLuCN6fGtwbcCVJrCCy avG7x8GR8/eUV5L5VKZwToG9hBEWCYmh5wQFtGvlxwSHvGkMGcMKWH5Hl1Lt67mP6MZP 6vj1AzfmiHon1qEbzBycuQvx9IqmvBEdzqcQ6IGART+BYYnjj5l3B8qghxLf4O61l6K9 6EUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763719425; x=1764324225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pC4XiP3l8Ew8D/XkZDyv3rIKzQexxvvUyzQqhlG1XiY=; b=eTuzgaggrPQqG31Q3J2LkpOfc9Riqu2IitdvlZdsc8FQatEWhFlCAJPIFtysxlPUzv YkzTz63Cr+PZUWWOK7mptOOCMC5ufsOw/t/T38J6KZZ/x0NBPuu/jL07CQIUKS7t4gHq DC/H8me+ka50IOpbN1n6fbHbnxcIpWEWe3ja1sE2hBAStusiECKVH/gZumkLpEtcySNS fjqbL08nQWg9Ya6zUxzRr5sYJMJx9kZtDp2eZzadsvSmuLkl3ciaBRjsl0OXq+otkf5H xeGMM7zMFzH8MW30G/M8JfGq/lVDYnfMPcsaYDNYgSAyiS6U+PwA1E+MBGwm1P11S8PB UW0Q== X-Forwarded-Encrypted: i=1; AJvYcCV6ZoW6G8UdjGSF+LXmagBhbkPuQqXur4rrJ3xf4WhMhxeJ2swwVTP8Ax3ptzyNSU04fJt88Bk/oq9pUsY=@vger.kernel.org X-Gm-Message-State: AOJu0YxXUx4BXEbZfqFGM0jey+yaKGt1yZe0cojCSog7Gpd6kfr5qjrR dkT3W9WG3TB2rAPk9ORVvRLKxQfHAuCwUxamlBik9/uKZ2Qd7pED4NUxA/8XAoG4qlM= X-Gm-Gg: ASbGncva8/J8ca8IPdqiGXGRI7haeeQMMA+Yk+YyiSln8zJaUxEk4Oxdg6TOeVnfMe+ 8b1da/v7GbY0/6lc7BXM4PMC+e60UsMzgmU0WXg6z2KwNfDl9GvZSJZCS8fdPmhUhbxXse1M20O 1Jq8vfEpbSPSRtIlpZgHoX9ffzSaMxBgt/VE0L+AH+8W52BX8GTOBP3WqZ644+mknzjB9PQOwaa T+/NJiMiBXjQr/9nzOvWzAcydBVb6Lyg31VB0R7tj+h31QD7TJAwZPxXsM+Z+mvWTPB5KtJ4m5k newuvxYNSkxw61VG9a63GL6hgxHK8nAMSUWqhWbL1NSsYGgjLUN9UNVYwcgQYlSYCOrbz3hopSV WRpqGyilvdAOLMcV1xx7gf6DCVT/6hekxWNECyZhH5NcD6OnaV35OYYRsOMYdzSRhCP5VRg52KE KtSZufRVhjf+4Qtb8Kwh57qUB6gjy/kDJqrAhjM3eI/U2FFl8dqv2UEzcT22+/ X-Google-Smtp-Source: AGHT+IE1QBDl25thXOykf99W0hmO2fID/AbQq/E1G/iDg+8zCCoVv/kRzbF75XHT2jFRieRUjU039g== X-Received: by 2002:a05:651c:4207:b0:37a:846c:3484 with SMTP id 38308e7fff4ca-37cd9164042mr3913491fa.4.1763719425337; Fri, 21 Nov 2025 02:03:45 -0800 (PST) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-37cc6b597b2sm11056181fa.12.2025.11.21.02.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 02:03:44 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Vincent Guittot , Peter Zijlstra , Kevin Hilman , Pavel Machek , Len Brown , Daniel Lezcano , Maulik Shah , Prasad Sodagudi , Dhruva Gole , Deepti Jaggi , Ulf Hansson , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [PATCH v3 6/6] Documentation: power/cpuidle: Document the CPU system wakeup latency QoS Date: Fri, 21 Nov 2025 11:03:12 +0100 Message-ID: <20251121100315.316300-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121100315.316300-1-ulf.hansson@linaro.org> References: <20251121100315.316300-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Let's document how the new CPU system wakeup latency QoS limit can be used from user space, along with how the constraint is taken into account for s2idle and cpuidle. Cc: Jonathan Corbet Signed-off-by: Ulf Hansson Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) --- Changes in v3: - Improved documentation. - Updated commit message. Changes in v2: - New patch. --- Documentation/admin-guide/pm/cpuidle.rst | 9 +++++++++ Documentation/power/pm_qos_interface.rst | 9 +++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/pm/cpuidle.rst b/Documentation/admin= -guide/pm/cpuidle.rst index 0c090b076224..c39ad6ab99d9 100644 --- a/Documentation/admin-guide/pm/cpuidle.rst +++ b/Documentation/admin-guide/pm/cpuidle.rst @@ -580,6 +580,15 @@ the given CPU as the upper limit for the exit latency = of the idle states that they are allowed to select for that CPU. They should never select any idle states with exit latency beyond that limit. =20 +While the above CPU QoS constraints applies to CPU idle time management, u= ser +space may also request a CPU system wakeup latency QoS limit, via the +`cpu_wakeup_latency` file. This QoS constraint is respected when selectin= g a +suitable idle state for the CPUs, while entering the system-wide suspend-t= o-idle +sleep state, but also to the regular CPU idle time management. + +Note that, the management of the `cpu_wakeup_latency` file works according= to +the 'cpu_dma_latency' file from user space point of view. Moreover, the u= nit +is also microseconds. =20 Idle States Control Via Kernel Command Line =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/Documentation/power/pm_qos_interface.rst b/Documentation/power= /pm_qos_interface.rst index 5019c79c7710..4c008e2202f0 100644 --- a/Documentation/power/pm_qos_interface.rst +++ b/Documentation/power/pm_qos_interface.rst @@ -55,7 +55,8 @@ int cpu_latency_qos_request_active(handle): =20 From user space: =20 -The infrastructure exposes one device node, /dev/cpu_dma_latency, for the = CPU +The infrastructure exposes two separate device nodes, /dev/cpu_dma_latency= for +the CPU latency QoS and /dev/cpu_wakeup_latency for the CPU system wakeup latency QoS. =20 Only processes can register a PM QoS request. To provide for automatic @@ -63,15 +64,15 @@ cleanup of a process, the interface requires the proces= s to register its parameter requests as follows. =20 To register the default PM QoS target for the CPU latency QoS, the process= must -open /dev/cpu_dma_latency. +open /dev/cpu_dma_latency. To register a CPU system wakeup QoS limit, the +process must open /dev/cpu_wakeup_latency. =20 As long as the device node is held open that process has a registered request on the parameter. =20 To change the requested target value, the process needs to write an s32 va= lue to the open device node. Alternatively, it can write a hex string for the va= lue -using the 10 char long format e.g. "0x12345678". This translates to a -cpu_latency_qos_update_request() call. +using the 10 char long format e.g. "0x12345678". =20 To remove the user mode request for a target value simply close the device node. --=20 2.43.0