[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <jhjmu5kiizu.mognet@arm.com>
Date: Wed, 03 Jun 2020 10:41:41 +0100
From: Valentin Schneider <valentin.schneider@....com>
To: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Benjamin GAIGNARD <benjamin.gaignard@...com>,
Hugues FRUCHET <hugues.fruchet@...com>,
"mchehab\@kernel.org" <mchehab@...nel.org>,
"mcoquelin.stm32\@gmail.com" <mcoquelin.stm32@...il.com>,
Alexandre TORGUE <alexandre.torgue@...com>,
"linux-media\@vger.kernel.org" <linux-media@...r.kernel.org>,
"linux-stm32\@st-md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
"linux-arm-kernel\@lists.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
"rjw\@rjwysocki.net" <rjw@...ysocki.net>
Subject: Re: [PATCH] media: stm32-dcmi: Set minimum cpufreq requirement
On 03/06/20 08:50, Vincent Guittot wrote:
> On Wed, 3 Jun 2020 at 09:34, Benjamin GAIGNARD <benjamin.gaignard@...com> wrote:
>> On 6/2/20 3:35 PM, Valentin Schneider wrote:
>> > AFAIA streaming_start() is not necessarily executing on the same CPU as the
>> > one that will handle the interrupt. I was thinking you could use the IRQ's
>> > effective affinity as a hint of which CPU(s) to boost, i.e. something like:
>> >
>> > ---
>> > struct cpumask_var_t visited;
>> > struct irq_data *d = irq_get_irq_data(irq);
>> >
>> > err = alloc_cpumask_var(visited, GFP_KERNEL);
>> > /* ... */
>> > for_each_cpu(cpu, irq_data_get_effective_affinity_mask(d)) {
>> > /* check if not already spanned */
>> > if (cpumask_test_cpu(cpu, visited))
>> > continue;
>> >
>> > policy = cpufreq_cpu_get(cpu);
>> > cpumask_or(visited, visited, policy->cpus);
>> > /* do the boost for that policy here */
>> > /* ... */
>> > cpufreq_cpu_put(policy);
>> > }
>> > ---
>> >
>> > That of course falls apart when hotplug gets involved, and the effective
>> > affinity changes... There's irq_set_affinity_notifier() out there, but it
>> > seems it's only about the affinity, not the effective_affinity, I'm not
>> > sure how valid it would be to query the effective_affinity in that
>> > notifier.
>> If I wait to be in the irq it will be too late so I think I will do a
>> loop over all possible CPUs
>> before start the streaming to change the policies.
>
Yes, that's what I was thinking as well.
> Can't you use irq_get_affinity_mask and loop over it ?
>
In the end that's the only usable option, I think.
I was looking at alternatives because on arm64 (and AFAICT that applies
to arm too; see irq-gic.c::gic_set_affinity()) the affinity mask spans
all CPUs by default, while the effective affinity mask spans only the
CPU that will actually handle the IRQ (+ where its thread should run).
That said, using the effective mask that way does feel like an
implementation leak. Sadly I couldn't find any better way to minimize
the number of boosted frequency domains.
> Also You should better use freq_qos_add/remove_request during probe
> and remove of the driver and use freq_qos_update_request in
> dcmi_start/stop_streaming to set/unset your constraint.
>
Powered by blists - more mailing lists