From: Chen Yu <yu.c.chen@intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Len Brown <len.brown@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH 2/2][v3] PM / s2idle: Code cleanup to make s2idle consistent with normal idle path
Date: Thu, 25 Jun 2020 13:15:34 +0800 [thread overview]
Message-ID: <20200625051534.GA22907@chenyu-office.sh.intel.com> (raw)
In-Reply-To: <15473183.xuek0xzqYe@kreacher>
Hi Rafael,
On Tue, Jun 23, 2020 at 07:57:59PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Subject: [PATCH] cpuidle: Rearrange s2idle-specific idle state entry code
>
> Implement call_cpuidle_s2idle() in analogy with call_cpuidle()
> for the s2idle-specific idle state entry and invoke it from
> cpuidle_idle_call() to make the s2idle-specific idle entry code
> path look more similar to the "regular" idle entry one.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/cpuidle/cpuidle.c | 6 +++---
> kernel/sched/idle.c | 15 +++++++++++----
> 2 files changed, 14 insertions(+), 7 deletions(-)
>
> Index: linux-pm/kernel/sched/idle.c
> ===================================================================
> --- linux-pm.orig/kernel/sched/idle.c
> +++ linux-pm/kernel/sched/idle.c
> @@ -96,6 +96,15 @@ void __cpuidle default_idle_call(void)
> }
> }
>
> +static int call_cpuidle_s2idle(struct cpuidle_driver *drv,
> + struct cpuidle_device *dev)
> +{
> + if (current_clr_polling_and_test())
> + return -EBUSY;
> +
> + return cpuidle_enter_s2idle(drv, dev);
> +}
> +
> static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
> int next_state)
> {
> @@ -171,11 +180,9 @@ static void cpuidle_idle_call(void)
> if (idle_should_enter_s2idle()) {
> rcu_idle_enter();
>
> - entered_state = cpuidle_enter_s2idle(drv, dev);
> - if (entered_state > 0) {
> - local_irq_enable();
> + entered_state = call_cpuidle_s2idle(drv, dev);
I guess this changes the context a little bit that(comparing to [1/2 patch],
after this modification, when we found that TIF_NEED_RESCHED is set we can have
a second chance in the following call_cpuidle to do a second s2idle try. However
in [1/2 patch], it might exit the s2idle phase directly once when we see
TIF_NEED_RESCHED is set(because entered_state is postive we treat it as a successful
s2idle). In summary I think the change (patch [2/2]) is more robust.
Acked-by: Chen Yu <yu.c.chen@intel.com>
Thanks,
Chenyu
next prev parent reply other threads:[~2020-06-25 5:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 6:31 [PATCH 0/2][v3] Fix IPI missing issue when woken from suspend to idle Chen Yu
2020-06-23 6:31 ` [PATCH 1/2][v3] PM / s2idle: Clear _TIF_POLLING_NRFLAG before " Chen Yu
2020-06-23 15:13 ` Rafael J. Wysocki
2020-06-23 6:31 ` [PATCH 2/2][v3] PM / s2idle: Code cleanup to make s2idle consistent with normal idle path Chen Yu
2020-06-23 17:57 ` Rafael J. Wysocki
2020-06-25 5:15 ` Chen Yu [this message]
2020-06-25 10:49 ` Rafael J. Wysocki
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=20200625051534.GA22907@chenyu-office.sh.intel.com \
--to=yu.c.chen@intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
/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).