From nobody Tue Dec 2 00:04:06 2025 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 0C98E26CE3B for ; Tue, 25 Nov 2025 11:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070020; cv=none; b=Z13pgJzsNX+hOipRtzgSLQd3axNAjp4rl99tX1JjtL8GZPug0+KWiknhR9syk57bC771PdaBBLN3aS6x2tKHa4oYJQAAFxZc2KQz/yM0tX1Z6cYeFAMlzV+9kQ5sEdBAXtPmxlFBld5s5zj2s5mhg1gsmMgcneQLPL9Ld58wpE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070020; c=relaxed/simple; bh=36iGndTEM/3YoIZN6fKWhfnsw6ftPmJLUkt15edtXOk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LFBfwzYGTl0kylgkfAP1H1J3LGepMrR1d0c3A1Si3SEGvJhPT3QRGbbj1paWJPwVK1iKj8UEUFqSz3LWY5UAGBX/LMGkPkvCUw/wtK3Kq0WGchtAPZEcORUirLKlZ6IFIMDb9V69DCtHV9nAM1Bf6yziWNfhevqqtCyzqCGzRqM= 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=xxSqO1hu; arc=none smtp.client-ip=209.85.167.44 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="xxSqO1hu" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5959b2f3fc9so5129193e87.2 for ; Tue, 25 Nov 2025 03:26:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764070016; x=1764674816; 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=FE45t6R4BBEDJliCvwSFl/kztT91PBe4qbzvkRlOVSY=; b=xxSqO1huq9U/U3KwH9GZJriZslv/CLFzWu7f8rUgkAx4FCXIzAbt2Fk+2D9HsSQfHy 8geAfVK2rjlXuGvNA5RJt/2dok1+fyP8AyR0f7FGgMBv5HmUqWnB5dWPRQHPoo3in3Te F6/LrjBZQDi4Vrehw7lFzqtXZ8LKQlXzL5fd0MP3f0zmJ8z4S2o3DH8zAk82OSqBfMjB vjVftziOtvVaF5pL8jq2tcP3RpIhkY3luXCF0c/nqmyNmRX2OOIozfx4Pa6a4vnBDJ4C oMNYop8nKe5QoaNItObZtnhBxVWNc7ragvr+z6g0ee2MKFDhhAQPB5Er84hd+AKiLDzl BeEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764070016; x=1764674816; 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=FE45t6R4BBEDJliCvwSFl/kztT91PBe4qbzvkRlOVSY=; b=nRkj8zJt77UW3gX0jmlCwVR/dp6oBPNnpnw7xMd/nOCo8Oy+Yic6lgfh5xjSmS1u4C 81VHt/0PWyIpf+qzs9Yk8qTcENhK+Qqm6Ct2qLxIqGUgM3JLjVdywlFifLRTkGW89EXd H4Z/tmcaQDhb8/BLWJKrH4U872dBQ/MTXGD3OZPZMuxOcAiDiz4WGR1z64YlEvZDGqZk 5nYxaLpFn5tSerNBARoLe4CuF915tWBNMlZH2M5/7Tp4gLvRISyipC+CzxL7JwWx6L9s uo0bGWOZpj/QNX+AbhiryeoC9oWDD8E1MNFDWom06DvrkdLG1QSxx5oVNKY8EPN73vcK ezwg== X-Forwarded-Encrypted: i=1; AJvYcCU3PZ0f843U5ba07TZJ3AIxaH2Utd6RXd6DWxuvBrf8H6Vm1hxwh3BRotEy642QbTtIeHsTUby6n8cvfXM=@vger.kernel.org X-Gm-Message-State: AOJu0YyXzakaQXN82aCcHocbFsUzfSnXJd7Igs0iQ2xe4yGs88ZaYivH DK4gA6r70O//tgHWav9KKPfQGKUO9Lf1OFt2Ka4DH9QsYVfTDFbsO4OtFEJvuDq3QvQ= X-Gm-Gg: ASbGncsnGVx5d+aGdoy8dbfQ20oNdyMGSaxIhPCZyUJfEZ3VIcQiI3hwBYGIR3DQp1s ziOaT02znivO09dvVmJjKXobEk1jOYUuX13E8JVsTFSHOPk4lBOEigwqYTlUWzAOe1diX+wlgRG WXhWdHKEnTWTPjODJrCJB0OSDmuybQT4GIkAK6a0X8yP6FNwZ0DmGkOrVi/oobH+uwh4P/FGcst dqEQ1T+OTjVhgmMS47u2oti0OjukBrd5CrIHTiLwSnohGbsqa0N17P/+Ujozp6zfBnv0B058gtE dF0yrz2T+wbIZwQDL0JrKwxpW7PErlB4TaWLFgRhBoBtbu1rd76H9G1tCZpdzRSssW9MFLlf2c1 /CjnleKcu/oHDHlbQzfRn/kAEISgCwu8eSzJK9PODqZJ/hkRPAKz3WAX+nSLx0lbuOSmluXFTyb rif9SyPUEiAaTBbG6FdLzwFyYDRUDeDmrL3S/qYQbkKvVBz0zpgxc7wwIbIPfj X-Google-Smtp-Source: AGHT+IHQFhuvGIxrbLvzBOY3ImdRr5h5AdplkQMA/mpy30IgWDqDJmZVd9KXsBer5wdbinI8H9eOhQ== X-Received: by 2002:a05:6512:3341:b0:594:27dd:2700 with SMTP id 2adb3069b0e04-596a3ee51f6mr4340223e87.47.1764070016099; Tue, 25 Nov 2025 03:26:56 -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 2adb3069b0e04-5969db7563fsm4993526e87.2.2025.11.25.03.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 03:26:55 -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 v4 1/6] PM: QoS: Introduce a CPU system wakeup QoS limit Date: Tue, 25 Nov 2025 12:26:42 +0100 Message-ID: <20251125112650.329269-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251125112650.329269-1-ulf.hansson@linaro.org> References: <20251125112650.329269-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. Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) Signed-off-by: Ulf Hansson --- Changes in v4: - Added Kconfig help (Dhruva). - Added tags. 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 | 11 +++++ kernel/power/qos.c | 106 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 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..05337f437cca 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -202,6 +202,17 @@ 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 + help + Enable this to allow user space via the cpu_wakeup_latency file to + specify a CPU system wakeup latency limit. + + This may be particularly useful for platforms supporting multiple low + power states for CPUs during system-wide suspend and s2idle in + particular. + 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 00:04:06 2025 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 48975315D24 for ; Tue, 25 Nov 2025 11:27:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070022; cv=none; b=c5KLFfvqvk2HTiZ7F1BgcwsEcXOF98qnpFikHUdJ0x2UoDFrTLZIROLZbM61n5JTj67gLSZHfHt5bMhfuna7sEZy3hl2YMVZ6rFz/D7rWpd4T/goFcJKGXyp2ssrYYK5UHRNtF4yfFskSL2ZE8wWb5aWNVpr0/PvmoAdQHlybH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070022; c=relaxed/simple; bh=qWZZt0EJ5EGhQp+jROsS7jIaWHMmW8TPlU611Gbd3ug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j3ndlIRDx3OqTTeqGWOP1SzQ4WAgYKS/gqIXZhodGFQFl+VFrZbhtg8ehYrvziLsPrGqTAgkNlxk3soKfORlbEt1Lk88TvUd+2CDt0UZUG6zHvZaqMn0tbbxdlQ/NflGfuiL+E+NLuBLy8UmQi1K+4FzLNIzns9D1ByKefAIoUA= 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=GURsFWKs; arc=none smtp.client-ip=209.85.167.41 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="GURsFWKs" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5959105629bso5188044e87.2 for ; Tue, 25 Nov 2025 03:26:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764070018; x=1764674818; 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=YkBdbnO/aTuh3Uyl4FaE6iA6IZG4p2hYiXFE9xVcIHM=; b=GURsFWKs2o/H6SYDHodny8XQ0QX+t5IW/HwszqcHo6e3VchnKaKAmmBJgL82du085z e6SuFq2kpHJZvZqgbJAYFGXROF9zSCeGTnwFd7nSQIIcqYBIMEUq55196MobW09eIRx4 pnbAgHCqc+y2r3IkbKK/73pI8lJn4PZjN5ClsgcPX1ZEHxpV1PB9aSIpM+RheKvC1i5V 69NaNpKZc8LUmeHLi4IceUV1nd0KOwrr3cUzj4NMhGQ9kZlbmDOVEAjRGL6qSYgk7Yw8 T8y8ZsBs8jqA6oqEwUVUfiLPuxsN7Ii8UPeoZ9nHE7XfHboQKAoSwRL6WV8Q0q9O3ztM hpBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764070018; x=1764674818; 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=YkBdbnO/aTuh3Uyl4FaE6iA6IZG4p2hYiXFE9xVcIHM=; b=xC+zu8fclUxujfn2fDo52UxwyFMTzGQPb37jWShNyKW2AwSOiEpbx3r1butdqnKyhp 7FD2tSW2VfFKeOqIDN0wJqR0Up57+Gh7B92P/hric51AlqfONUD9/cKR66KQW3nimLAP UAfCp9qbOoAdpZZkmmDAnGHSxU9+RSAJr2pZ595IdYdMD2lfJih1nH7v/gHiVYibHymX FNxYqaFDbC3TVz2ypjmDz2V6hRPNV08/czfQpEAJXs3ERqz5U8aMfSRxKbbNifqj/3Q0 VfXMTfBb+wyvQOk9Ho3fJ1raxONXRoeAU3D2lZdC63ViJjmSA2amExJ7Ror19Im87hw4 lUlQ== X-Forwarded-Encrypted: i=1; AJvYcCXC1XGq2NTJ9qIYL1oBAaiBGppLdE5tec/mH+5etiKYJIfTWhiBMCdqQFRvLfIJpr3aCX04z0q2f6WGcy0=@vger.kernel.org X-Gm-Message-State: AOJu0YxRmh0sAhXdh4qaaTd8qmqwtqw8/NI4WiuZ86xnvim0MJBrjwy1 DZuafaNeXJVyCT4ryAorW1VkX5UfQgVbT7ML0YJTLbgR2AHaeyrEaZCVzLgqPSxe7/c= X-Gm-Gg: ASbGnct8jaBFPXiYBwoDkE5yZ+kZCjyuWEkkMfKjAQ5OztSXG4XJtle/XXTV8b8Hl08 dDxQOtlXTtP7bMEvllsqAFGz/ox2nJEblDx9heRueXpPFrNwC0lk3zwCYDvNLvmlE8Hw/DBXqLK Gy2FRKNK5guRiHOc3pcF5UR++bSkgxSJwZomuciQMh4Cp4G0m/jajYICt8vONByj0wAQChWYKq+ ZJJObRhih6Mbi/2m8mMx9eTiULaxzNm1WebZQMqS/eotf6Aeorzf74AhcX+6LpncqwZZTWj6v+X myjD/7lR11AyOTWC6CEo4+hlMiCKXT+0pvYzWL3uA4XCuRR7wspXD6IHPSvK5X3axY/nbNtoYef wL1st+dUVK/yQ8hqZjRq2W06sGmwgSSY+7KwVNqLmVCU1tIMeE+Ryeh3EYniPtqxGmSO5F6aOym aSBqKegsA+nTY7EZjoHvlqdDwW1Kx/eVihAPRA4DtOW+5/9XHXah0JX9qts0hU X-Google-Smtp-Source: AGHT+IF5/zPRqq5Gc8LX/DzP5wRoX37ptDORDPlLBcwihZhjQ8Hod/OKSQTB4ujkPlnaRcuFpIKOGw== X-Received: by 2002:a05:6512:3a82:b0:594:27dd:2701 with SMTP id 2adb3069b0e04-596b529d662mr891658e87.49.1764070018227; Tue, 25 Nov 2025 03:26:58 -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 2adb3069b0e04-5969db7563fsm4993526e87.2.2025.11.25.03.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 03:26:56 -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 v4 2/6] pmdomain: Respect the CPU system wakeup QoS limit for s2idle Date: Tue, 25 Nov 2025 12:26:43 +0100 Message-ID: <20251125112650.329269-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251125112650.329269-1-ulf.hansson@linaro.org> References: <20251125112650.329269-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. Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) Signed-off-by: Ulf Hansson --- Changes in v4: - Added tags. 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 00:04:06 2025 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 5B77C3164CE for ; Tue, 25 Nov 2025 11:27:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070024; cv=none; b=FH4uHKV8X/CgHna687jVOjDQjLUtabpa0a0J6hii0ygjEQipqaKRxdT8rnyNSgimefpGHPEmCNd++ccD9yBjjkFCZ6a69bvEK4F/9mvKSJZ+7VkQpBLbGlC24uhAdI6T56U4fbpDY7hyOMUPU6wLVCl0Qr334e+jZpKhlGtmT+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070024; c=relaxed/simple; bh=0ObsQzJ1S8aelaCoYcrZLP2G/ftVmS6hZ0U7EyZsDXg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QoSgyLrTyRZjD1DCPZhSOcbWtRIYcnetBvjr7Ky3QXx9JdESigV2mnZhIJSu9+R1qJ/cCEXPk3EP/b+cvV+k0v1p6quj7jxXNvUnp8suo7mmxdO6bGsEPnlB71wJeiDmpLpz2BdzmDr/RytIF8YrDVHUaiYxkxLKhloFPTTM2Kg= 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=Ozy0T/E3; arc=none smtp.client-ip=209.85.167.46 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="Ozy0T/E3" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5957c929a5eso7112531e87.1 for ; Tue, 25 Nov 2025 03:27:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764070020; x=1764674820; 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=AN6dvpy0YMflZKUplqB9lPyC8X+L5QXrs3PpGRd9+i4=; b=Ozy0T/E3L9xE8Tc4aGvNiOgyu3oECFsqVHGctY3/t9a6VRxNGp1fWHgpURig6BfC30 oGrVb3IO0+QTOYxcHR4mU3m3Tf1oTFJ/Soghw7ZR87tnKLKC9tuc3NbvHaR6BsZJAEGh +9whh5RJ/bZXQ3XRIwVeP03z0jND22M3NKHuXqcnninPN+L11ILj4DbasSJ+19+WITrI cw6LFn7WtGXNku2cwBSrHHWMKgR9/T9Rmni+mUV7H57w3lPhPY5571cfM18jvYw58/4Y 9aaxtAhyVrnkyNcvXkmS3qxOk10UUTecHSjLuD5SBwQOlsbul1NCoeitMG6YR/8i4gBT KBtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764070020; x=1764674820; 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=AN6dvpy0YMflZKUplqB9lPyC8X+L5QXrs3PpGRd9+i4=; b=wtkSpofByJZlqBfJqsMLauGQtoUHs9kj9Yl6rEkRpRFuLJr4jFh//v0uf6xVG5gmwX 8Es9b/y1UaPq9wYtdxSIzQgxEy1G+/gPxd/F1KMM+Y1cXO+JMsCZVRCCFsPybRSHodmu 1nAyKl8wbXbgGckqO5Ql/8mRoecxgq1Hr6cVajjAroLXVffLsUlKWoDq9AXZZ3A4+4Pt 91HbabMFZuijwsd/i0e3ldLzzCCo3cuw80xkAchtPL1csDTCZIHKXleO1wr1LxDZenEs 8x4VC4BgzYoklDFUnFUoZQ18mepR6+TPE0NuJpHfeaHKVImzB+yiKUjJzypIfcVTpzqj obyg== X-Forwarded-Encrypted: i=1; AJvYcCU8oTeRo4ShXCBhzovXQouP6KSXcde8CY2MvmB0nN/svSr7AYZow3XaWbHapXqM11QKxUyvjlDeJgs0kzs=@vger.kernel.org X-Gm-Message-State: AOJu0Yytu8r56Vu3DrNWRPOCS363V2qDbwqEW2tp29j2z8eVSMFRr539 Fm5JK3xC73MmRwUGpB8oBFzonB0srD0Ry7IocP8z8dFJRCpFMFWJSITzgtmdjTjhSPc= X-Gm-Gg: ASbGncsMfAmIeiP08aiZXlDCkH+88OoN5s/PiQur101sTmHzlZ/LQ0J7+ZStONQl3Wl 5zP/woIXvOLES7nqNKQQhSLIr8G3+MQwhGg3Ud0ZdyMo3H+DrDUvDYb2SUvheX6qjxjvKyQUoOz 0n4m356noeBdmNe6eDfkw5NXMeEEMNymZT/Rzlia0ZfHQJ3vDVqA8oyhcLEj3guAjQQXb12s+hM 4Ev6bdDRVisCY+UXF1sO3TnP1ABhUShNe+wo/lQSoqsxPN/3UiZ10H5UL0QvIscFYdD5i0q68Jj MWEGwLnSptM2DiKX5rpq09rusViK63SYQLE2HqZQgHJXBfO0idrBIy6WdI1RH7lA4q2VzU6uJ2n f0mT4v+YE/kxq8JO/JYh4pQhHbaucKxbIHGLeyeDEJ7mrIoFKlG922CuBc6FL1pL72bAs4jQTy8 3ydK3Hvcy+R/+GP0Sf9g668s5h3eBr1PsejhaRC8t+mT7iotSr3yV6qwOof7du X-Google-Smtp-Source: AGHT+IGxFbAVgLhFkE94TlbZzTA30uW9uPeS6eJKhZuh9qvjSZm3x7Z35cTuGkrMp5RHYfZTfiLMSA== X-Received: by 2002:a05:6512:3a82:b0:594:27dd:2701 with SMTP id 2adb3069b0e04-596b529d662mr891695e87.49.1764070020428; Tue, 25 Nov 2025 03:27:00 -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 2adb3069b0e04-5969db7563fsm4993526e87.2.2025.11.25.03.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 03:26:58 -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 v4 3/6] pmdomain: Respect the CPU system wakeup QoS limit for cpuidle Date: Tue, 25 Nov 2025 12:26:44 +0100 Message-ID: <20251125112650.329269-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251125112650.329269-1-ulf.hansson@linaro.org> References: <20251125112650.329269-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. Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) Signed-off-by: Ulf Hansson --- Changes in v4: - Added tags. 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 00:04:06 2025 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 B15DE3195FB for ; Tue, 25 Nov 2025 11:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070030; cv=none; b=UBu63t89pQhENCvAYh+UHxAHWgGFXZaKWC7rxlRyFAeuxdvHtKOYIZoU8luxHUrEV/CbkIzX3GYB6vFN3H9bSaiVV2gIiKT81OmEyEQowJPcr7RBFVMWIc23RB1+D4u/KT/ExABtT5zhKeWmOWALKtjwCiOWiM6RtGKcXgwzhiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070030; c=relaxed/simple; bh=a/jMPuNL0LXh8mbOwFnvXiyONNtTPYp9ciUcBqd+xDc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tJtYOjeJssURFw1wSl4u04DBdrLosEcouzBTJ4X1QsWN5gtNIB9vUso+j4FvElkfuDOgpn0a4JaPxSkIFXWe6kGKfaY/QOa511RsK/QaVvdPT/IJe9VK3MMf0obcIM/ywyPsk+w9KoE6U8AAaQcxcXeJIm8qJFSREMlUVqYVV4I= 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=da2a8GT8; arc=none smtp.client-ip=209.85.208.172 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="da2a8GT8" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-37a2dcc52aeso51454961fa.0 for ; Tue, 25 Nov 2025 03:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764070023; x=1764674823; 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=0SsQjAUBc4I4Ftomg4p9T07PlaUDAMfxP/280o2pMx8=; b=da2a8GT8Q/R45NwSk4mrwYahro3DCk5W3ATU8pvMb+HgD2OjPj0RUlSKSKTGPTqQZl JXRsha9MMwebxH4O6jRwLRyFm4Q/otynOJTV0hFpaO/aS+v+hWLoo/9icvx5/XsFrlX8 vwBMB1E4LNeDAj489Et+dB6tkpCo3lE+dBY8i+X8Y4YYtH68t2T9yRv9ckO7NSPi6uBa VwP4fjLwOeaMNixcXr7/cwLNL/N/KQ1MMoco+wGKnM/Uxrn3kimdzI8tujd8AvjIvZAZ KpZzU9MHgPzGinlOC/TYAmd1pUjhKxsI4aX+MLWp6z+BpnTLCxW+xHpdAm5p4pf9Qv3c VBeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764070023; x=1764674823; 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=0SsQjAUBc4I4Ftomg4p9T07PlaUDAMfxP/280o2pMx8=; b=s4skGP5t277WRhCSeWzfp1CN/OgWtLkmAFfxpQU8+e3yAbLviyDkdbKcQukkrjuT/4 N2Ivh/+a6ehXiFhTdkDA43sxYUbCUJP9KPduOOK76uFunuLsuIsa1tXeWyRefOlTa7Bm 8H+cUyWsy99QVjgp8SpUJlsfRpK9bz2WXMYx16vXwSsZH6QrHk4JoCUkvm+JBw/m7pnq fdw3sTAkPhYjBc2uf++YgDc7m166R7MHJbRNYxcBhrXG+hLlwELOtwGSOTWLhXaXjZwH XJwXVEZF6cTpqeCq1R/iCZ1cJIsarRhXqiPfEd9lzdae8rJiKzTfHdCiko+ZoXPsGTAc vEAA== X-Forwarded-Encrypted: i=1; AJvYcCXfks2G9qrsvTL9afAdIuse1INqCDlVRrWTSTsclUOGA35nhUm8GupBVGx6a6f6ugEC92WCZleMeosH0XU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1w7VypkhPIsB8L0A1qtd1Mjoi17TRpURXSumoZVzd7YRP8Jh9 zht+0Dxmzw9Bl1WnMaBFx/efo73SJUA0fUfTkWox/Ps2Rdh7xkn0UPzAaKviXpniClk= X-Gm-Gg: ASbGncuNwl7lxItCDVfiCgwtCgSWFBgxI0iKC99vsSgvR4LNKz55rJJU+Tt3HpvJOsR vAJJI7vx9sH7SJrfT994NvYL55pHOA2RTrk8neKSSCPop+cSrogAf9Zw3qobsKFyQUVoGKoQZH0 z3E/kumjuezuts6Br08VgMvNkz/j+zLTSFdpHC/iiIeYmThJWNYAS+z90Hzz1ZSgKpnPiG6LUeX 2qjXxrMHqtlxyOHWM0WS3KMfawIW0KY/0CIVPGEbE0miHZFslTYlEf/R6s6X/66zhaZKogKmwig 6q3pHL+nVAshQb1x7bneShs6p7GhO9VjSD/s3xc8xqJKRzsN1JDRAqTc0aZXYkm0Ik37DrIRTX1 t02YJZv8h1GtkK6dKxIK/fgMg+1Oxv9Lm+n+pMlaipJTTo98RQAVn3LL576vANuxgAVClLH3NRZ 3DbyzP1T0My2r0E+gLvZa2r7vDqV7N2c7hcY312z8auwZZ5NfOkcURxlGp7gV4 X-Google-Smtp-Source: AGHT+IEFmutfa/ZxoF2Ngxs2HZf0XLR/CkiEIKyvnVme49BuzM4cktsh/YOqq0q7xYeTdoknxiJRAA== X-Received: by 2002:a05:6512:3d91:b0:594:2f72:2fa2 with SMTP id 2adb3069b0e04-596b4e4b868mr949083e87.5.1764070022707; Tue, 25 Nov 2025 03:27:02 -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 2adb3069b0e04-5969db7563fsm4993526e87.2.2025.11.25.03.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 03:27:01 -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 v4 4/6] sched: idle: Respect the CPU system wakeup QoS limit for s2idle Date: Tue, 25 Nov 2025 12:26:45 +0100 Message-ID: <20251125112650.329269-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251125112650.329269-1-ulf.hansson@linaro.org> References: <20251125112650.329269-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) Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) Signed-off-by: Ulf Hansson --- Changes in v4: - Added tags. 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 00:04:06 2025 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 D035231987D for ; Tue, 25 Nov 2025 11:27:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070031; cv=none; b=MDbGU+96toX8t32OpEpFquDCbMpZ4Avjl6/xAETtPTPg6qXj3WWwkbwbNm+JSMg6kQrPBdcUBFkL/4LJnoM6toOLAVGoZ9WiCO6B1IA+Zfm3tSrNt4wP0xshxKRJqyE47Ao82t+VksQ5rgNQHvZKQBUrs2JOO0GfUr8V/jDqwbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070031; c=relaxed/simple; bh=VU9S2gTiBfBqPpLuX8g7itKZUK/ev7QCKE78FGsGaTY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bz0+Wz2lMeEwrXff0vQeuPdUK07SIDbkX8fJ12BV1swBTiE9sAkoPO0ZwnEjKi0Awrz8Gr6CH0hwO265wA1m6MDUKjan/L8Yr0b443kyqExQT0sIvhaXjJuUX9fnounAE88p1x2YzNUg3L9TIujdMQFrDOq9Ej8PEeT0nLjtzT8= 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=Ux8eod0u; arc=none smtp.client-ip=209.85.167.50 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="Ux8eod0u" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5959105629bso5188144e87.2 for ; Tue, 25 Nov 2025 03:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764070026; x=1764674826; 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=MXSNim2QNAEfMWA0bqcIei0hGjp8YF0YF97p3EaO60o=; b=Ux8eod0u+Fy8rtcdbn8XIk9YEHpLbVTxHkQxPwGD5Rp0W5PTMR1qbtlLVB+pXojzMu nzIf1HKsrgtE3VL9gtS4fcmxZBj3H8iEdD6LcV4WyfBwSGFVtoQO1ndMQGGCstlzzcdG Tk0Sk8KvSEH5G5iVojvQo9jsRUqWDZXdlx439MWqV4jt+WDOtG2AXVwWVLzomYErJjKp UYe0ynJ7a9AWuwgCBk37jSNba7fNoj4f6nhxW9M//j+U2ofyifmSNOUfMKd0a91QvmFR 1hajsQpHZ1FiQduR2+tB44LtKxDRm4bQqp3EFC+BhjeYAcI3slAX3Cmvxii+e2mxAz3x Ktmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764070026; x=1764674826; 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=MXSNim2QNAEfMWA0bqcIei0hGjp8YF0YF97p3EaO60o=; b=bs4l9ilNGoYPCs0EWIhj9XWFblbUQ3GudYw93B2i+441BC9uoM+OPZWHmWIsuJtGA4 gHo+H34jX2h45ocv3lamBrYmfHym094+cSLcuC1tZ0nCuXFsmiCN6T22ABro/NCf5XYO xFpYn7vZwFK9dGECPfV8HrtfHdiVeGnMKf1BfjwhSgMKiB63h0UV/VbPGJNJ7/pzQwjG WSi/fe7sF/BUb1/MSL5hb9GrpJTn1l/GvNghlGCXM1qvhyWJN7Z58Fh1MaZ2JccmWr8r tU7ARNC2/CsbjfbGkMvQF8P4UQpcAZzID5Nr8a2JdymTu1Srf8pd5pqzrEo26cGHhyoQ yT3g== X-Forwarded-Encrypted: i=1; AJvYcCXaIFlGGh8ni8XGuvoK2/8wl1eLvZFiff5yH1Yz2ypuNVptvMsIqTvKUoytkITPj3ynesojh8+Bfjp7aBY=@vger.kernel.org X-Gm-Message-State: AOJu0YwP2y2aehPQJN743c7cF9ORAVwueZ9ZACrP/o0B9W/bYKi0WLCU n5AZCZYehUUHCA+PnCm83NwfZDYNEM8/6oGvgGlV/CWa86FT2CwQMjujfuXIj9fe7a8= X-Gm-Gg: ASbGnctQbEfDZiiACDhWD96/PDL2YW9Cri9HgwecDNvF2wATOXE2C64suKpzU6OFSsT c3WLKULNzpVzVsySOdVojZVIHTkmcDxmJMhF2My9AIWT+2sN5E7caIXrE6fbEaD0KChQ1Qq1zcV YmN4G3mmQ/dsE+VH2Xq67mR+x72oQ/xGutI6dsTP57YaMghlzotWsh7C2phk/HKzFj/YYqsDkyk Bqsw5cON++gnREgRz5kgl+6n6GqmlkZodgjo+1ZwNFRh5DUKlyKet/CAJOwtYiWyD4kNaT2OYn5 cPjJCnziO2lMEBzT84aK3RTTXiu11r7Us2AiIggFwVA2X8uVYmwZTGJtAtEJ/mCY/vZT4hiMo0Q iV9+ICNlhUOJ2XAWjDN5l/QQX/5F/1fbSbQKgWtcFBk4OFwhzRIPUrVfVoYs5b1jEk1YKj46AIr n+3axFhWHfJ+YazOcmyBpA5tLVnJq0XZEBHiWwMNgzveMHgA898T1T67LGmsHs X-Google-Smtp-Source: AGHT+IH0spmvYE7vsLYvU6CWBQu+9dSmSus9W4Lq8aSvY9tGf9JRWtAh5DwE7Z4KHFl6BrOxsXpyVw== X-Received: by 2002:a05:6512:b0f:b0:594:2b58:ab83 with SMTP id 2adb3069b0e04-596b528d61amr1089814e87.40.1764070025793; Tue, 25 Nov 2025 03:27:05 -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 2adb3069b0e04-5969db7563fsm4993526e87.2.2025.11.25.03.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 03:27:04 -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 v4 5/6] cpuidle: Respect the CPU system wakeup QoS limit for cpuidle Date: Tue, 25 Nov 2025 12:26:46 +0100 Message-ID: <20251125112650.329269-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251125112650.329269-1-ulf.hansson@linaro.org> References: <20251125112650.329269-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. Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) Signed-off-by: Ulf Hansson --- Changes in v4: - Added tags. 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 00:04:06 2025 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 3FF4031577D for ; Tue, 25 Nov 2025 11:27:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070033; cv=none; b=aEHWjjwsK2NBLjpRgba+eLwW296K1uPqVbveLTMKlUQ1ynqT6U7mcSHh7pj9aBtRGmne1sB1hm0eDXrqtB65eRmZ1/IxlK+oK3vtA/F0jKNVhhrbxUw8mZBKtznVsa7PoOls2sOU1xVTmDZmvl42kamhJSfJb0PgLezRNaArPeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764070033; c=relaxed/simple; bh=GrznQtm2Xbu5M36KVvznD5+BJEJ9tpaSNo1aXMTzPYc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d2aIasYywxIDl7VNe/ee1jcZtizeCoNPaZufN1TjCUZ00SmeNzpHBAB2MRb2z856irPOZom7jpKW2cGhwEQkO3AtlaFtoPlFCiIqnz3qNaEevmwypfiaeh2dh3IouX5w16WAl3Y42074jg1k8iAP6J0oSErb0Kxx5c5EFmofCrs= 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=RFZiCovK; arc=none smtp.client-ip=209.85.167.43 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="RFZiCovK" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5957f617ff0so5731966e87.2 for ; Tue, 25 Nov 2025 03:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764070028; x=1764674828; 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=7Pe+KUJG6BVKcUJHZJ0mcY6KZ0UWQ2fQ+ADIwlAh+rE=; b=RFZiCovK5pZCDLgtV5QtOrfFpjLVd8m/yQdP5hqZEDtjQDIT8VOPvcJgyjPheLdQdP NtfAgQ8uKqnAcTExhIkNI7A8A4tqY6aeJ3sEFmFqy0MQa45qsTZ8J9fL8k40Als4IKw0 SavHk7L6wCpeODkKCF9mr/jypqesz7Owb/bxip+dUIEisi1Lvgd7/xz+ZOopz1859LWJ vbQhLAw3oxFvn88FIqgyI587buaicfWhLFAq8O4Te57HGtVxnoxvnGkS3rUGwwmLkKy6 2/7WdmtlzvClsCJWL68WO7j4p8mmXZgtQ6dESnPju8+XN/CoaWYrYaGfcVX/ie77BJsW 5tMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764070028; x=1764674828; 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=7Pe+KUJG6BVKcUJHZJ0mcY6KZ0UWQ2fQ+ADIwlAh+rE=; b=OS1hxyrF3QUsgtp5y1xZxeP3Ftx6DA3y66hT2HQQAjSPtjIc/JF24InnXDntRLTg60 ZLnj3qfSXJ6PlBWcO/gn7NpKIZMrfI2ym86ieNlRH9nV+Cs3Chfj8Wf1Zvkn8IhgM1C+ a0ci3qrYgun8nsTXBw9GBU+8jo97sF1DSAjpjnm99FE3JOuzw6Igasl5uKQdhMxLzk7H 9MDMwMuFUp61X/e+7BlcQuFuxh5ooAhxMqKpE7JH5HxrbAbhmQfjfrtUm9Cb6uoktjWc wE82CtIVSg837itZHsB/CjmS/2X66DmJMuEtuc4EkkIVNu3kefZRFAKGPqdmwHZxGkrD pMxQ== X-Forwarded-Encrypted: i=1; AJvYcCUjb7YFBhPy2tzquQ+bCl88R8+ysokKoLDdUL7XV+kszeBHsG8vzmVtJUHdqm8EffAfHC2YkbE7qvlQAjE=@vger.kernel.org X-Gm-Message-State: AOJu0YxmYFjXMHBSJXHlefPZ0cMa9tNUd/5DLm4Tbu21T6Tc6Icxeq61 Y3VWJMgMDkOrXFtMeVP0/TH4g0ut3keAr6YP/0+UTkzmsI/dDK+pC9o8vuKrapVxCdE= X-Gm-Gg: ASbGnctNmoFWzvBFXLUXEGvKP5sY8E74pq29WhX2ogoWbjRFdWFUIp2XLca/qG6dTR6 KZPE7jxARP4R6O2+kLAm0FSrFDQblWBp1Oh9U1HhYGFYNXA9f+bEZU/gaqK1dmQ/SwzYTAgYApO nvg0yJ7atQm9dnpIp1k6s2CdFKJTI6Y01t45C2VjMxWqNj5Fs84s0L38EzwZM3qwsVdfjz3pAQX yRf7UXeePUF+NI4V4Zhlk+2rpu6uvbN4pKfCou57FPT7ZIjF2PwpnvrCfVIbBYSSPCepVD9nQvH utEvTKGgbqSrk/XcfJuXqoEk61ERRUPgsrCYibuXYPYbfVwq+LIoBm34Li4A92OkaSajeWqgnJK ChXsdm5dDjbsex7N3SJGce1soOWnojCCH4PSLE1xA+owWQhgzF3EzoWusUvwFaDS/ky7i0yN2C2 JMeZLM8BnonPo46CGB9vB5W93LZvm9O/0PYTlv3jJ/Qjs8KrLhM8ycur4kf74B X-Google-Smtp-Source: AGHT+IGRDjKSLOucrdLNEeV+cZDbVrqAyKHDt7qFDXqWVrlCSGciMoBT3mitw8rmyaHgPr8TokqaVA== X-Received: by 2002:a05:6512:2313:b0:595:9d7d:6ebb with SMTP id 2adb3069b0e04-596a3ebe00fmr4819702e87.15.1764070028280; Tue, 25 Nov 2025 03:27:08 -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 2adb3069b0e04-5969db7563fsm4993526e87.2.2025.11.25.03.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 03:27:06 -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 v4 6/6] Documentation: power/cpuidle: Document the CPU system wakeup latency QoS Date: Tue, 25 Nov 2025 12:26:47 +0100 Message-ID: <20251125112650.329269-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251125112650.329269-1-ulf.hansson@linaro.org> References: <20251125112650.329269-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 Reviewed-by: Dhruva Gole Reviewed-by: Kevin Hilman (TI) Tested-by: Kevin Hilman (TI) Signed-off-by: Ulf Hansson --- Changes in v4: - Fixed grammar (Dhruva). - Added tags. 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..be4c1120e3f0 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 apply to CPU idle time management, user +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