From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Adrien Thierry <athierry@redhat.com>,
Brian Masney <bmasney@redhat.com>,
linux-rt-users@vger.kernel.org
Subject: Re: [RFC PATCH] cpufreq: qcom-cpufreq-hw: allow work to be done on other CPU for PREEMPT_RT
Date: Tue, 21 Mar 2023 11:04:56 +0100 [thread overview]
Message-ID: <20230321100456.0_DhhkZJ@linutronix.de> (raw)
In-Reply-To: <20230315164910.302265-1-krzysztof.kozlowski@linaro.org>
On 2023-03-15 17:49:10 [+0100], Krzysztof Kozlowski wrote:
> Qualcomm cpufreq driver configures interrupts with affinity to each
> cluster, e.g. dcvsh-irq-0, dcvsh-irq-4 and dcvsh-irq-7 on SM8250.
> Triggered interrupt will schedule delayed work, but, since workqueue
> prefers local CPUs, it might get executed on a CPU dedicated to realtime
> tasks causing unexpected latencies in realtime workload.
>
> Use unbound workqueue for such case. This might come with performance
> or energy penalty, e.g. because of cache miss or when other CPU is
> sleeping.
I miss the point where it explains that only PREEMPT_RT is affected by
this.
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index 2f581d2d617d..c5ff8d25fabb 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -390,7 +390,16 @@ static irqreturn_t qcom_lmh_dcvs_handle_irq(int irq, void *data)
>
> /* Disable interrupt and enable polling */
> disable_irq_nosync(c_data->throttle_irq);
> - schedule_delayed_work(&c_data->throttle_work, 0);
> +
> + /*
> + * Workqueue prefers local CPUs and since interrupts have set affinity,
> + * the work might execute on a CPU dedicated to realtime tasks.
> + */
> + if (IS_ENABLED(CONFIG_PREEMPT_RT))
> + queue_delayed_work_on(WORK_CPU_UNBOUND, system_unbound_wq,
> + &c_data->throttle_work, 0);
> + else
> + schedule_delayed_work(&c_data->throttle_work, 0);
You isolated CPUs and use this on PREEMPT_RT. And this special use-case
is your reasoning to make this change and let it depend on PREEMPT_RT?
If you do PREEMPT_RT and you care about latency I would argue that you
either disable cpufreq and set it to PERFORMANCE so that the highest
available frequency is set once and not changed afterwards.
> if (qcom_cpufreq.soc_data->reg_intr_clr)
> writel_relaxed(GT_IRQ_STATUS,
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-03-21 10:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 16:49 [RFC PATCH] cpufreq: qcom-cpufreq-hw: allow work to be done on other CPU for PREEMPT_RT Krzysztof Kozlowski
2023-03-16 12:28 ` Krzysztof Kozlowski
[not found] ` <20230316235705.2235-1-hdanton@sina.com>
2023-03-17 8:13 ` Krzysztof Kozlowski
2023-03-21 10:04 ` Sebastian Andrzej Siewior [this message]
2023-03-21 10:24 ` Krzysztof Kozlowski
2023-03-21 10:57 ` Sebastian Andrzej Siewior
2023-03-21 11:27 ` Krzysztof Kozlowski
2023-03-21 13:39 ` Sebastian Andrzej Siewior
2023-03-23 8:16 ` Krzysztof Kozlowski
2023-03-23 11:37 ` Sebastian Andrzej Siewior
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=20230321100456.0_DhhkZJ@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=athierry@redhat.com \
--cc=bmasney@redhat.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=viresh.kumar@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;
as well as URLs for NNTP newsgroup(s).