linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: sumitg <sumitg@nvidia.com>
Cc: bbasu@nvidia.com, linux-pm@vger.kernel.org,
	catalin.marinas@arm.com, rjw@rjwysocki.net,
	linux-kernel@vger.kernel.org, jonathanh@nvidia.com,
	talho@nvidia.com, thierry.reding@gmail.com,
	linux-tegra@vger.kernel.org, mperttunen@nvidia.com,
	will@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [TEGRA194_CPUFREQ Patch 2/3] cpufreq: Add Tegra194 cpufreq driver
Date: Thu, 9 Apr 2020 13:14:15 +0530	[thread overview]
Message-ID: <20200409074415.twpzu2n4frqlde7b@vireshk-i7> (raw)
In-Reply-To: <08307e54-0e14-14a3-7d6a-d59e1e04a683@nvidia.com>

On 08-04-20, 16:54, sumitg wrote:
> 
> 
> On 08/04/20 11:23 AM, Viresh Kumar wrote:
> > External email: Use caution opening links or attachments
> > 
> > 
> > On 07-04-20, 23:48, sumitg wrote:
> > > On 06/04/20 8:25 AM, Viresh Kumar wrote:
> > > > On 05-04-20, 00:08, sumitg wrote:
> > > > > On 26/03/20 5:20 PM, Viresh Kumar wrote:
> > > > > > On 03-12-19, 23:02, Sumit Gupta wrote:
> > > > > > > diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> > > > > > > +static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay)
> > > > > > > +{
> > > > > > > +     struct read_counters_work read_counters_work;
> > > > > > > +     struct tegra_cpu_ctr c;
> > > > > > > +     u32 delta_refcnt;
> > > > > > > +     u32 delta_ccnt;
> > > > > > > +     u32 rate_mhz;
> > > > > > > +
> > > > > > > +     read_counters_work.c.cpu = cpu;
> > > > > > > +     read_counters_work.c.delay = delay;
> > > > > > > +     INIT_WORK_ONSTACK(&read_counters_work.work, tegra_read_counters);

Initialize the work only once from init routine.

> > > > > > > +     queue_work_on(cpu, read_counters_wq, &read_counters_work.work);
> > > > > > > +     flush_work(&read_counters_work.work);
> > > > > > 
> > > > > > Why can't this be done in current context ?
> > > > > > 
> > > > > We used work queue instead of smp_call_function_single() to have long delay.
> > > > 
> > > > Please explain completely, you have raised more questions than you
> > > > answered :)
> > > > 
> > > > Why do you want to have long delays ?
> > > > 
> > > Long delay value is used to have the observation window long enough for
> > > correctly reconstructing the CPU frequency considering noise.
> > > In next patch version, changed delay value to 500us which in our tests is
> > > considered reliable.
> > 
> > I understand that you need to put a udelay() while reading the freq from
> > hardware, that is fine, but why do you need a workqueue for that? Why can't you
> > just read the values directly from the same context ?
> > 
> The register to read frequency is per core and not accessible to other
> cores. So, we have to execute the function remotely as the target core to
> read frequency might be different from current.
> The functions for that are smp_call_function_single or queue_work_on.
> We used queue_work_on() to avoid long delay inside ipi interrupt context
> with interrupts disabled.

Okay, I understand this now, finally :)

But if the interrupts are disabled during some call, won't workqueues face the
same problem ?

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-04-09  7:44 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 17:32 [TEGRA194_CPUFREQ Patch 1/3] firmware: tegra: adding function to get BPMP data Sumit Gupta
2019-12-03 17:32 ` [TEGRA194_CPUFREQ Patch 2/3] cpufreq: Add Tegra194 cpufreq driver Sumit Gupta
2019-12-04  5:40   ` Viresh Kumar
2019-12-04 10:55     ` sumitg
2019-12-04 11:27       ` Viresh Kumar
2019-12-04 13:57         ` Dmitry Osipenko
2019-12-05  2:51           ` Viresh Kumar
2019-12-05 12:55             ` Dmitry Osipenko
2020-03-25 23:59         ` sumitg
2019-12-04 13:59   ` Dmitry Osipenko
2019-12-05 14:15   ` Dmitry Osipenko
2020-03-26 11:50   ` Viresh Kumar
2020-04-04 18:38     ` sumitg
2020-04-06  2:55       ` Viresh Kumar
2020-04-07 18:18         ` sumitg
2020-04-08  5:53           ` Viresh Kumar
2020-04-08 11:24             ` sumitg
2020-04-09  7:44               ` Viresh Kumar [this message]
2020-04-09 11:21                 ` Sumit Gupta
2020-04-13  6:21                   ` Viresh Kumar
2020-04-13 12:20                     ` Sumit Gupta
2020-04-14  5:45                       ` Viresh Kumar
2020-04-15 11:25                         ` Sumit Gupta
2020-04-16  3:37                           ` Viresh Kumar
2020-04-16  7:06                             ` Sumit Gupta
2019-12-03 17:32 ` [TEGRA194_CPUFREQ Patch 3/3] arm64: defconfig: Enable CONFIG_ARM_TEGRA194_CPUFREQ Sumit Gupta
2019-12-03 17:42 ` [TEGRA194_CPUFREQ Patch 1/3] firmware: tegra: adding function to get BPMP data Thierry Reding
2019-12-04  8:45   ` Mikko Perttunen
2019-12-04  9:17     ` Viresh Kumar
2019-12-04  9:33       ` Thierry Reding
2019-12-04  9:51         ` Viresh Kumar
2020-04-07 10:05           ` Thierry Reding
2020-04-27  7:18             ` Thierry Reding
2020-04-29  8:21               ` Sumit Gupta
2020-05-06 16:58               ` Thierry Reding
2020-05-20 14:43             ` Rob Herring
2020-05-20 15:38               ` Thierry Reding
2020-05-20 16:21                 ` Rob Herring
2019-12-04 10:21       ` Mikko Perttunen
2019-12-04 10:26         ` Viresh Kumar

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=20200409074415.twpzu2n4frqlde7b@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=bbasu@nvidia.com \
    --cc=catalin.marinas@arm.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=rjw@rjwysocki.net \
    --cc=sumitg@nvidia.com \
    --cc=talho@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=will@kernel.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).