From: Valentin Schneider <valentin.schneider@arm.com>
To: Benjamin Gaignard <benjamin.gaignard@st.com>
Cc: hugues.fruchet@st.com, mchehab@kernel.org,
mcoquelin.stm32@gmail.com, alexandre.torgue@st.com,
linux-media@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, vincent.guittot@linaro.org,
rjw@rjwysocki.net
Subject: Re: [PATCH v5 2/3] media: stm32-dcmi: Set minimum cpufreq requirement
Date: Wed, 10 Jun 2020 12:20:02 +0100 [thread overview]
Message-ID: <jhjtuzj2mn1.mognet@arm.com> (raw)
In-Reply-To: <20200609115825.10748-3-benjamin.gaignard@st.com>
Hi Benjamin,
On 09/06/20 12:58, Benjamin Gaignard wrote:
> +static void dcmi_set_min_frequency(struct stm32_dcmi *dcmi, s32 freq)
> +{
> + struct irq_affinity_notify *notify = &dcmi->notify;
> + struct cpumask clear;
> +
> + mutex_lock(&dcmi->freq_lock);
> + dcmi->targeted_frequency = freq;
> + mutex_unlock(&dcmi->freq_lock);
> +
> + if (freq) {
> + dcmi_irq_notifier_notify(notify,
> + irq_get_affinity_mask(dcmi->irq));
> + } else {
> + cpumask_clear(&clear);
> + dcmi_irq_notifier_notify(notify, &clear);
> + }
> +}
> +
IIUC the changes in this version, you would now need a call to
freq_qos_update_request() in the notifier. That's because you can now go
through the notifier callback with
targeted_frequency = FREQ_QOS_MIN_DEFAULT_VALUE
yet still add CPUs to the boosted mask. I think you were pretty close to a
decent solution in your previous version, with some notifier registration
movement. This is what I had in mind (the diff is against v4; ofc
absolutely untested!):
---
diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index c2389776a958..cc147de6ea70 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -801,15 +801,22 @@ static void dcmi_set_min_frequency(struct stm32_dcmi *dcmi, s32 freq)
struct irq_affinity_notify *notify = &dcmi->notify;
if (freq) {
+ /*
+ * Register the notifier before doing any change, so the
+ * callback can be queued if an affinity change happens *while*
+ * we are requesting the boosts.
+ */
+ irq_set_affinity_notifier(dcmi->irq, notify);
dcmi_irq_notifier_notify(notify,
irq_get_affinity_mask(dcmi->irq));
-
- notify->notify = dcmi_irq_notifier_notify;
- notify->release = dcmi_irq_notifier_release;
- irq_set_affinity_notifier(dcmi->irq, notify);
} else {
struct cpumask clear;
+ /*
+ * Unregister the notifier before clearing the boost requests,
+ * as we don't want to boost again if an affinity change happens
+ * *while* we are clearing the requests
+ */
irq_set_affinity_notifier(dcmi->irq, NULL);
cpumask_clear(&clear);
dcmi_irq_notifier_notify(notify, &clear);
@@ -2032,6 +2039,9 @@ static int dcmi_probe(struct platform_device *pdev)
if (!alloc_cpumask_var(&dcmi->boosted, GFP_KERNEL))
return -ENODEV;
+ dcmi->notify->notify = dcmi_irq_notifier_notify;
+ dcmi->notify->release = dcmi_irq_notifier_release;
+
q = &dcmi->queue;
dcmi->v4l2_dev.mdev = &dcmi->mdev;
---
Does that make sense to you?
next prev parent reply other threads:[~2020-06-10 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 11:58 [PATCH v5 0/3] DCMI set minimum cpufreq requirement Benjamin Gaignard
2020-06-09 11:58 ` [PATCH v5 1/3] dt-bindings: media: stm32-dcmi: Add DCMI min frequency property Benjamin Gaignard
2020-06-09 11:58 ` [PATCH v5 2/3] media: stm32-dcmi: Set minimum cpufreq requirement Benjamin Gaignard
2020-06-10 11:20 ` Valentin Schneider [this message]
2020-06-09 11:58 ` [PATCH v5 3/3] ARM: dts: stm32: Set DCMI frequency requirement for stm32mp15x Benjamin Gaignard
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=jhjtuzj2mn1.mognet@arm.com \
--to=valentin.schneider@arm.com \
--cc=alexandre.torgue@st.com \
--cc=benjamin.gaignard@st.com \
--cc=hugues.fruchet@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mchehab@kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=rjw@rjwysocki.net \
--cc=vincent.guittot@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