All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claude.Yen <Claude.Yen@mediatek.com>
To: Stephen Boyd <swboyd@chromium.org>
Cc: wsd_upstream@mediatek.com, 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>,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] PM: s2idle: Introduce syscore callbacks in s2idle flow
Date: Thu, 3 Sep 2020 11:43:24 +0800	[thread overview]
Message-ID: <1599104604.4435.7.camel@mtksdccf07> (raw)
In-Reply-To: <159894602346.334488.4470501636825871587@swboyd.mtv.corp.google.com>

On Tue, 2020-09-01 at 00:40 -0700, Stephen Boyd wrote:
> Quoting Claude Yen (2020-09-01 00:04:19)
> > From: "claude.yen" <claude.yen@mediatek.com>
> > 
> > Adding syscore callbacks to s2idle makes the behavior of s2idle become
> > more similar to Suspend-to-Ram (S2R) and reduces potential porting
> > effort.
> > 
> > tick_freeze() in s2idle flow calls sched_clock_suspend() and
> > timekeeping_suspend(), which both functions are also registered as
> > syscore callback. sched_clock_suspend() introduced in
> > commit 3f2552f7e9c5 ("timers/sched_clock: Prevent generic sched_clock
> > wrap caused by tick_freeze()") is added due to clock wrap issue.
> > By adding syscore callbacks in s2idle, if there is any syscore callbacks
> > also required in s2idle, additional porting effort could be saved.
> > 
> > Besides, in both S2R and s2idle, before the system entering low power
> > state, there is a state when only one cpu alive with interrupt-disabled,
> > which is syscore callback designed for. Adding syscore callbacks in
> > s2idle is feasible option.
> > 
> > Scenarios to call syscore callback:
> > S2R: one cpu alive when nonboot cpus are hotplug-ed off
> > s2idle: one cpu alive when other cpus have enter idle state
> > 
> 
> Do you have syscore ops that can't be converted to something else like
> CPU_PM notifier? At this point most syscore code that is important has
> been converted so I don't see much benefit for this patch. If anything,
> it will prevent conversions to code that works for both cases.

In Mediatek SoC's implementation, battery voltage and remaining capacity
are tracked in syscore callback when system going to suspend. The reason
to hook callback in syscore is that all devices are suspended, and thus
battery output become steady and suitable for measurement. Such callback
is not suitable for CPU_PM notifier.

If s2idle is applied, the callback to track battery status is not
triggered due to syscore is not called by current design.

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: Stephen Boyd <swboyd@chromium.org>
Cc: wsd_upstream@mediatek.com, 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>,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] PM: s2idle: Introduce syscore callbacks in s2idle flow
Date: Thu, 3 Sep 2020 11:43:24 +0800	[thread overview]
Message-ID: <1599104604.4435.7.camel@mtksdccf07> (raw)
In-Reply-To: <159894602346.334488.4470501636825871587@swboyd.mtv.corp.google.com>

On Tue, 2020-09-01 at 00:40 -0700, Stephen Boyd wrote:
> Quoting Claude Yen (2020-09-01 00:04:19)
> > From: "claude.yen" <claude.yen@mediatek.com>
> > 
> > Adding syscore callbacks to s2idle makes the behavior of s2idle become
> > more similar to Suspend-to-Ram (S2R) and reduces potential porting
> > effort.
> > 
> > tick_freeze() in s2idle flow calls sched_clock_suspend() and
> > timekeeping_suspend(), which both functions are also registered as
> > syscore callback. sched_clock_suspend() introduced in
> > commit 3f2552f7e9c5 ("timers/sched_clock: Prevent generic sched_clock
> > wrap caused by tick_freeze()") is added due to clock wrap issue.
> > By adding syscore callbacks in s2idle, if there is any syscore callbacks
> > also required in s2idle, additional porting effort could be saved.
> > 
> > Besides, in both S2R and s2idle, before the system entering low power
> > state, there is a state when only one cpu alive with interrupt-disabled,
> > which is syscore callback designed for. Adding syscore callbacks in
> > s2idle is feasible option.
> > 
> > Scenarios to call syscore callback:
> > S2R: one cpu alive when nonboot cpus are hotplug-ed off
> > s2idle: one cpu alive when other cpus have enter idle state
> > 
> 
> Do you have syscore ops that can't be converted to something else like
> CPU_PM notifier? At this point most syscore code that is important has
> been converted so I don't see much benefit for this patch. If anything,
> it will prevent conversions to code that works for both cases.

In Mediatek SoC's implementation, battery voltage and remaining capacity
are tracked in syscore callback when system going to suspend. The reason
to hook callback in syscore is that all devices are suspended, and thus
battery output become steady and suitable for measurement. Such callback
is not suitable for CPU_PM notifier.

If s2idle is applied, the callback to track battery status is not
triggered due to syscore is not called by current design.

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  3:53 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 [this message]
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
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=1599104604.4435.7.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=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.