From: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Zhongqiu Han <quic_zhonhan@quicinc.com>
Cc: rafael@kernel.org, lenb@kernel.org, pavel@kernel.org,
tony.luck@intel.com, reinette.chatre@intel.com,
Dave.Martin@arm.com, james.morse@arm.com,
amit.kucheria@linaro.org, christian.loehle@arm.com,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
lukasz.luba@arm.com, zhongqiu.han@oss.qualcomm.com
Subject: Re: [PATCH v2 0/5] PM QoS: Add CPU affinity latency QoS support and resctrl integration
Date: Fri, 24 Oct 2025 16:40:13 +0800 [thread overview]
Message-ID: <7acba50b-8c1e-4509-8100-3a65467d2d87@oss.qualcomm.com> (raw)
In-Reply-To: <CAPDyKFprP1d-9Ojwz7QaVBbdFumPmRoVnifrP8v+eL6FHR3Unw@mail.gmail.com>
On 10/23/2025 7:03 PM, Ulf Hansson wrote:
> On Mon, 21 Jul 2025 at 14:41, Zhongqiu Han <quic_zhonhan@quicinc.com> wrote:
>>
>> Hi all,
>>
>> This patch series introduces support for CPU affinity-based latency
>> constraints in the PM QoS framework. The motivation is to allow
>> finer-grained power management by enabling latency QoS requests to target
>> specific CPUs, rather than applying system-wide constraints.
>>
>> The current PM QoS framework supports global and per-device CPU latency
>> constraints. However, in many real-world scenarios, such as IRQ affinity
>> or CPU-bound kernel threads, only a subset of CPUs are
>> performance-critical. Applying global constraints in such cases
>> unnecessarily prevents other CPUs from entering deeper C-states, leading
>> to increased power consumption.
>>
>> This series addresses that limitation by introducing a new interface that
>> allows latency constraints to be applied to a CPU mask. This is
>> particularly useful on heterogeneous platforms (e.g., big.LITTLE) and
>> embedded systems where power efficiency is critical for example:
>>
>> driver A rt kthread B module C
>> CPU IDs (mask): 0-3 2-5 6-7
>> target latency(us): 20 30 100
>> | | |
>> v v v
>> +---------------------------------+
>> | PM QoS Framework |
>> +---------------------------------+
>> | | |
>> v v v
>> CPU IDs (mask): 0-3 2-3,4-5 6-7
>> runtime latency(us): 20 20, 30 100
>>
>> The current implementation includes only cpu_affinity_latency_qos_add()
>> and cpu_affinity_latency_qos_remove() interfaces. An update interface is
>> planned for future submission, along with PM QoS optimizations in the UFS
>> subsystem.
>
> My apologies for the very late reply.
>
Hi Uffe,
I truly appreciate your review and discussion~
> To fully understand how this new QoS interface is going to be used, I
> really think we need to include a user of it, as part of the $subject
> series.
Yes, Patch 5/5 using the cpu_affinity_latency_qos_* helper functions to
replace the logic in pseudo-locking that uses dev_pm_qos_request to
restrict CPU latency for known CPUs (via a mask). Actually, I'm also
looking for more users — for example, we plan to use these interfaces
in our UFS module in the future to implement optimizations. And I also
plan to support it in userspace on patch V3.
>
> Besides the comments from Rafael and Christian, I also wonder how the
> user of the interface should know what CPU-mask it should use? For
> example, how does it know the CPU-mask for the big-cores and for the
> little-cores? In particular as I assume the user isn't a platform
> specific driver, but rather a generic driver that should work across
> various platforms.
This patch introduces cpu_affinity_latency_qos_* helper functions as an
extension to the kernel existing cpu_latency_qos_* interfaces. These new
helpers enable users to apply latency constraints to specific CPUs via a
mask, allowing for more precise power management when the target CPUs
are known in advance.
If the user is a generic driver, there are two options:
1.One is to use the existing cpu_latency_qos_* interfaces to directly
restrict all CPUs from entering idle, since the driver may not know
which specific CPUs need to be constrained.
2.However, for generic drivers with specific workload characteristics
such as the ufshcd driver in this patch:
https://lore.kernel.org/all/20231213124353.16407-1
-quic_mnaresh@quicinc.com/
— if a user knows exactly which CPUs should be restricted, they can
provide a custom mask via a hook function and use the extended API
accordingly. The default return value of the hook is the system-wide
possible CPUs, so it won't affect other users.
In summary, this patch is mainly intended for users who know which CPUs
they want to restrict. For users who don't, the extended API can still
be used by passing a system-wide CPU mask, or they can simply use the
existing cpu_latency_qos_* interfaces.
Please kindly let me know if you have any more question.
>
> [...]
>
> Kind regards
> Uffe
>
--
Thx and BRs,
Zhongqiu Han
next prev parent reply other threads:[~2025-10-24 8:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 12:40 Zhongqiu Han
2025-07-21 12:41 ` [PATCH v2 1/5] PM: QoS: Add support for CPU affinity latency PM QoS Zhongqiu Han
2025-08-21 10:37 ` Rafael J. Wysocki
2025-08-22 10:31 ` Zhongqiu Han
2025-07-21 12:41 ` [PATCH v2 2/5] PM: QOS: Remove unnecessary KERN_ERR on WARN() calls Zhongqiu Han
2025-07-21 12:41 ` [PATCH v2 3/5] Documentation: PM: QoS: Add CPU affinity latency PM QoS Interface documentation Zhongqiu Han
2025-07-21 12:41 ` [PATCH v2 4/5] Documentation: PM: QoS: Fix return type and return value description Zhongqiu Han
2025-08-01 11:27 ` Christian Loehle
2025-08-04 11:58 ` Zhongqiu Han
2025-07-21 12:41 ` [PATCH v2 5/5] resctrl: Replace PM QoS logic with cpu_affinity_latency_qos_* helpers Zhongqiu Han
2025-07-28 10:09 ` [PATCH v2 0/5] PM QoS: Add CPU affinity latency QoS support and resctrl integration Christian Loehle
2025-07-28 10:40 ` Zhongqiu Han
2025-08-02 14:38 ` Christian Loehle
2025-08-04 13:47 ` Zhongqiu Han
2025-08-15 12:48 ` Zhongqiu Han
2025-10-23 11:03 ` Ulf Hansson
2025-10-24 8:40 ` Zhongqiu Han [this message]
2025-10-24 10:44 ` Ulf Hansson
2025-10-27 12:38 ` Zhongqiu Han
2025-10-23 13:09 ` Lukasz Luba
2025-10-24 8:25 ` Zhongqiu Han
2025-10-28 13:12 ` Lukasz Luba
2025-10-30 13:25 ` Zhongqiu Han
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7acba50b-8c1e-4509-8100-3a65467d2d87@oss.qualcomm.com \
--to=zhongqiu.han@oss.qualcomm.com \
--cc=Dave.Martin@arm.com \
--cc=amit.kucheria@linaro.org \
--cc=christian.loehle@arm.com \
--cc=james.morse@arm.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=pavel@kernel.org \
--cc=quic_zhonhan@quicinc.com \
--cc=rafael@kernel.org \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®