linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Lukasz Luba <lukasz.luba@arm.com>, linux-kernel@vger.kernel.org
Cc: dietmar.eggemann@arm.com, viresh.kumar@linaro.org,
	rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org,
	rui.zhang@intel.com, amit.kachhap@gmail.com,
	linux-pm@vger.kernel.org
Subject: Re: [RFC PATCH v3 2/5] cpuidle: Add Cpufreq Active Stats calls tracking idle entry/exit
Date: Tue, 26 Apr 2022 15:05:31 +0300	[thread overview]
Message-ID: <97e7e3f5110702fab727b4df7d53511aef5c60b1.camel@gmail.com> (raw)
In-Reply-To: <20220406220809.22555-3-lukasz.luba@arm.com>

Hi Lukasz,

On Wed, 2022-04-06 at 23:08 +0100, Lukasz Luba wrote:
> @@ -231,6 +232,8 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct
> cpuidle_driver *drv,
>         trace_cpu_idle(index, dev->cpu);
>         time_start = ns_to_ktime(local_clock());
>  
> +       cpufreq_active_stats_cpu_idle_enter(time_start);
> +
>         stop_critical_timings();
>         if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
>                 rcu_idle_enter();
> @@ -243,6 +246,8 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct
> cpuidle_driver *drv,
>         time_end = ns_to_ktime(local_clock());
>         trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
>  
> +       cpufreq_active_stats_cpu_idle_exit(time_end);
> +

At this point the interrupts are still disabled, and they get enabled later. So
the more code you add here and the longer it executes, the longer you delay the
interrupts. Therefore, you are effectively increasing IRQ latency from idle by
adding more code here.

How much? I do not know, depends on how much code you need to execute. But the
amount of code in functions like this tends to increase over time.

So the risk is that we'll keep making 'cpufreq_active_stats_cpu_idle_exit()',
and (may be unintentionally) increase idle interrupt latency.

This is not ideal.

We use the 'wult' tool (https://github.com/intel/wult) to measure C-states
latency and interrupt latency on Intel platforms, and for fast C-states like
Intel C1, we can see that even the current code between C-state exit and
interrupt re-enabled adds measurable overhead.

I am worried about adding more stuff here.

Please, consider getting the stats after interrupts are re-enabled. You may lose
some "precision" because of that, but it is probably overall better that adding
to idle interrupt latency.

>         /* The cpu is no longer idle or about to enter idle. */
>         sched_idle_set_state(NULL);



  reply	other threads:[~2022-04-26 12:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 22:08 [RFC PATCH v3 0/5] Introduce Cpufreq Active Stats Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 1/5] cpufreq: stats: " Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 2/5] cpuidle: Add Cpufreq Active Stats calls tracking idle entry/exit Lukasz Luba
2022-04-26 12:05   ` Artem Bityutskiy [this message]
2022-04-26 15:01     ` Lukasz Luba
2022-04-26 16:29       ` Artem Bityutskiy
2022-04-27 13:58         ` Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 3/5] thermal: Add interface to cooling devices to handle governor change Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 4/5] thermal: power allocator: Prepare power actors and calm down when not used Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 5/5] thermal: cpufreq_cooling: Improve power estimation using Cpufreq Active Stats Lukasz Luba
2022-04-26  3:11 ` [RFC PATCH v3 0/5] Introduce " Viresh Kumar
2022-04-26  7:46   ` Lukasz Luba
2022-04-26  7:54     ` Viresh Kumar
2022-04-26  7:59       ` Lukasz Luba
2022-04-26  8:02         ` Viresh Kumar
2022-04-26 14:40           ` Lukasz Luba

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=97e7e3f5110702fab727b4df7d53511aef5c60b1.camel@gmail.com \
    --to=dedekind1@gmail.com \
    --cc=amit.kachhap@gmail.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --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).