All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claude.Yen <Claude.Yen@mediatek.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: wsd_upstream <wsd_upstream@mediatek.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Douglas Anderson <dianders@chromium.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"moderated list:ARM/Mediatek SoC..."
	<linux-mediatek@lists.infradead.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Stephen Boyd <swboyd@chromium.org>,
	Ingo Molnar <mingo@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PM: s2idle: Introduce syscore callbacks in s2idle flow
Date: Thu, 3 Sep 2020 10:14:07 +0800	[thread overview]
Message-ID: <1599099247.4435.4.camel@mtksdccf07> (raw)
In-Reply-To: <CAJZ5v0hOGEUamXw124q4CnL67o97qRHy9Vv9_F2AQqefDdu3vQ@mail.gmail.com>

On Tue, 2020-09-01 at 13:57 +0200, Rafael J. Wysocki wrote:
> On Tue, Sep 1, 2020 at 9:05 AM Claude Yen <claude.yen@mediatek.com> wrote:
> >
> > This series based on 5.9-rc1
> > This patch makes s2idle call existing syscore callbacks. Currently,
> > when s2idle is selected as system suspend method, callbacks hooked
> > by register_syscore_ops() will not be triggered. This may induce
> > unexpected results.
> 
> They are not executed by design.
> 
> > For example, sched_clock_suspend() was added to s2idle flow in
> > commit 3f2552f7e9c5 ("timers/sched_clock: Prevent generic sched_clock
> > wrap caused by tick_freeze()") to fix clock wrap problem. However,
> > sched_clock_suspend() is originally registered in syscore callback.
> 
> I'm not sure why this matters here.

If functions in syscore callbacks are needed in s2idle, explicit
migration is needed like commit 3f2552f7e9c5 ("timers/sched_clock:
Prevent generic sched_clock wrap caused by tick_freeze()").
Thus, I am wondering if such effort could be saved.

> > With this patch, if another syscore callback is needed in s2idle,
> > additional migration effort could be saved.
> 
> s2idle cannot execute syscore callbacks, because it doesn' take
> non-boot CPUs offline and it won't do that.
> 
> Thanks!

Yes, the current design of syscore callback needs non-boot CPUs offline.
Considering the following case: in s2idle flow, there is a status that
only one CPU is alive and other CPUs have enter deepest idle state.
This situation is similar to getting non-boot CPUs offline, though all
CPUs are online from kernel's perspective.

Reply from Stephen mentioned that if an operation is needed in both
S2R and s2idle, CPU_PM notifier can be utilized. 
In my opinion, CPU_PM notifier is particularly for CPU entering idle
state. In contrast, syscore callback is for system going low power
state. There exists semantic difference between these two callbacks.

Could the current design of syscore callback be re-designed as
system-wide suspend callback?

Proposed suspend flow in this patch:

    Freeze tasks
        |
        V
    Device suspend callbacks
        |
        |-------------s2idle----------
        |                            |
        V                            |
    Disable nonboot CPUs    Is this CPU last core to enter idle?
        |                            |
        V                            |-------------
    syscore callbacks                |            |
        |                           No           Yes
        V                            |            |
    platform suspend                 V            V
                                 enter idle     syscore callback
                                                  |
                                                  V
                                                enter idle

Regards,
Claude

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Claude.Yen <Claude.Yen@mediatek.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: wsd_upstream <wsd_upstream@mediatek.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Douglas Anderson <dianders@chromium.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"moderated list:ARM/Mediatek SoC..."
	<linux-mediatek@lists.infradead.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Stephen Boyd <swboyd@chromium.org>,
	Ingo Molnar <mingo@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PM: s2idle: Introduce syscore callbacks in s2idle flow
Date: Thu, 3 Sep 2020 10:14:07 +0800	[thread overview]
Message-ID: <1599099247.4435.4.camel@mtksdccf07> (raw)
In-Reply-To: <CAJZ5v0hOGEUamXw124q4CnL67o97qRHy9Vv9_F2AQqefDdu3vQ@mail.gmail.com>

On Tue, 2020-09-01 at 13:57 +0200, Rafael J. Wysocki wrote:
> On Tue, Sep 1, 2020 at 9:05 AM Claude Yen <claude.yen@mediatek.com> wrote:
> >
> > This series based on 5.9-rc1
> > This patch makes s2idle call existing syscore callbacks. Currently,
> > when s2idle is selected as system suspend method, callbacks hooked
> > by register_syscore_ops() will not be triggered. This may induce
> > unexpected results.
> 
> They are not executed by design.
> 
> > For example, sched_clock_suspend() was added to s2idle flow in
> > commit 3f2552f7e9c5 ("timers/sched_clock: Prevent generic sched_clock
> > wrap caused by tick_freeze()") to fix clock wrap problem. However,
> > sched_clock_suspend() is originally registered in syscore callback.
> 
> I'm not sure why this matters here.

If functions in syscore callbacks are needed in s2idle, explicit
migration is needed like commit 3f2552f7e9c5 ("timers/sched_clock:
Prevent generic sched_clock wrap caused by tick_freeze()").
Thus, I am wondering if such effort could be saved.

> > With this patch, if another syscore callback is needed in s2idle,
> > additional migration effort could be saved.
> 
> s2idle cannot execute syscore callbacks, because it doesn' take
> non-boot CPUs offline and it won't do that.
> 
> Thanks!

Yes, the current design of syscore callback needs non-boot CPUs offline.
Considering the following case: in s2idle flow, there is a status that
only one CPU is alive and other CPUs have enter deepest idle state.
This situation is similar to getting non-boot CPUs offline, though all
CPUs are online from kernel's perspective.

Reply from Stephen mentioned that if an operation is needed in both
S2R and s2idle, CPU_PM notifier can be utilized. 
In my opinion, CPU_PM notifier is particularly for CPU entering idle
state. In contrast, syscore callback is for system going low power
state. There exists semantic difference between these two callbacks.

Could the current design of syscore callback be re-designed as
system-wide suspend callback?

Proposed suspend flow in this patch:

    Freeze tasks
        |
        V
    Device suspend callbacks
        |
        |-------------s2idle----------
        |                            |
        V                            |
    Disable nonboot CPUs    Is this CPU last core to enter idle?
        |                            |
        V                            |-------------
    syscore callbacks                |            |
        |                           No           Yes
        V                            |            |
    platform suspend                 V            V
                                 enter idle     syscore callback
                                                  |
                                                  V
                                                enter idle

Regards,
Claude

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

  reply	other threads:[~2020-09-03  2:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01  7:04 [PATCH] PM: s2idle: Introduce syscore callbacks in s2idle flow Claude Yen
2020-09-01  7:04 ` Claude Yen
2020-09-01  7:04 ` Claude Yen
2020-09-01  7:04 ` [PATCH 1/1] " Claude Yen
2020-09-01  7:04   ` Claude Yen
2020-09-01  7:40   ` Stephen Boyd
2020-09-01  7:40     ` Stephen Boyd
2020-09-03  3:43     ` Claude.Yen
2020-09-03  3:43       ` Claude.Yen
2020-09-01 11:57 ` [PATCH] " Rafael J. Wysocki
2020-09-01 11:57   ` Rafael J. Wysocki
2020-09-01 11:57   ` Rafael J. Wysocki
2020-09-03  2:14   ` Claude.Yen [this message]
2020-09-03  2:14     ` Claude.Yen
2020-09-10 12:55     ` Rafael J. Wysocki
2020-09-10 12:55       ` Rafael J. Wysocki
2020-09-10 12:55       ` 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=1599099247.4435.4.camel@mtksdccf07 \
    --to=claude.yen@mediatek.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dianders@chromium.org \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mingo@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=swboyd@chromium.org \
    --cc=tglx@linutronix.de \
    --cc=wsd_upstream@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.