linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Cc: Michael <michael@mipisi.de>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org, John Stultz <jstultz@google.com>
Subject: Re: Problem when function alarmtimer_suspend returns 0 if time delta is zero
Date: Thu, 09 Feb 2023 16:40:49 +0100	[thread overview]
Message-ID: <87zg9m26f2.ffs@tglx> (raw)
In-Reply-To: <CAOf5uwn1SKBR+pREZy9f-wnQf6Lw3epyHxiX_hjf_pOaiiSDWA@mail.gmail.com>

Michael!

On Thu, Feb 09 2023 at 12:19, Michael Nazzareno Trimarchi wrote:
> On Wed, Feb 8, 2023 at 7:06 PM Thomas Gleixner <tglx@linutronix.de> wrote:
>> I wrote that patch against the back then mainline code. No idea if it's
>> still applying, but the underlying issue is still the same AFAICT.
>>
>> It needs some polishing and a proper changelog.
>>
> Ok, I will try to update it on some mainline kernel in my environment
> and test it back. I need
> a little information if it's possible. Consider that I have no
> experience in this area. I understand how
> code was designed in general but the part around the freezer and all
> those code you remove, what was the logic behind in the removed code?

What I can oracle out of that well commented gem is:

  A userspace task invokes clock_nanosleep(CLOCK_*_ALARM, ...), which
  arms an alarm timer. The expiry of an alarmtimer causes the system to
  come out of suspend.

  As the task invokes schedule() it can also be brought back from
  schedule() via a signal. If that happens then the task cancels the
  alarmtimer and returns to handle the signal. While doing that it can
  be frozen, which means the alarm and therefore the wake from suspend
  is lost.

  To prevent that the code tries to save the earliest expiring alarm if
  the task is marked freezing() and the suspend code takes that into
  account.

John, did I summarize that correctly?

The change I made remove that magic and marks the task freezable when it
goes to schedule, which prevents the signal wakeup. That ensures that
the alarm stays armed during freeze/suspend.

That obviously needs some testing and scrunity by the folks which use
this mechanism. IIRC that's used by android, but I might be wrong.

Thanks,

        tglx



  reply	other threads:[~2023-02-09 15:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <S1728511AbfHaSEm/20190831180442Z+580@vger.kernel.org>
2019-08-31 18:32 ` Problem when function alarmtimer_suspend returns 0 if time delta is zero Michael
2019-09-02  7:49   ` Alexandre Belloni
2019-09-02 10:57     ` Thomas Gleixner
2019-09-03 18:48       ` Michael
2019-09-03 22:49         ` Thomas Gleixner
2023-02-08 15:23           ` Michael Trimarchi
2023-02-08 18:06             ` Thomas Gleixner
2023-02-09 11:19               ` Michael Nazzareno Trimarchi
2023-02-09 15:40                 ` Thomas Gleixner [this message]
2023-02-11  1:04                   ` John Stultz
2023-02-11  1:18                     ` John Stultz
2023-02-11  6:25                       ` Michael Nazzareno Trimarchi

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=87zg9m26f2.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=michael@amarulasolutions.com \
    --cc=michael@mipisi.de \
    --cc=sboyd@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).