From: Guenter Roeck <linux@roeck-us.net>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
Benson Leung <bleung@chromium.org>,
linux-rtc@vger.kernel.org, chrome-platform@lists.linux.dev,
linux-kernel@vger.kernel.org,
Brian Norris <briannorris@chromium.org>
Subject: Re: [PATCH] rtc: cros-ec: Limit RTC alarm range if needed
Date: Wed, 2 Nov 2022 11:48:04 -0700 [thread overview]
Message-ID: <20221102184804.GA1918067@roeck-us.net> (raw)
In-Reply-To: <20221031230749.GB2082109@roeck-us.net>
Alexandre,
On Mon, Oct 31, 2022 at 04:07:51PM -0700, Guenter Roeck wrote:
[ ... ]
> > >
> > > On a side note, I tried an alternate implementation by adding a retry into
> > > alarmtimer_suspend(), where it would request a smaller timeout if the
> > > requested timeout failed. I did not pursue/submit this since it seemed
> > > hacky. To solve that problem, I'd rather discuss extending the RTC API
> > > to provide a maximum offset to its users. Such a solution would probably
> > > be desirable, but that it more longer term and would not solve the
> > > immediate problem.
> >
> > Yes, this is what I was aiming for. This is something that is indeed
> > missing in the RTC API and that I already thought about. But indeed, it
> > would be great to have a way to set the alarm range separately from the
> > time keeping range. This would indeed have to be a range relative to the
> > current time.
> >
> > alarmtimer_suspend() can then get the allowed alarm range for the RTC,
> > and set the alarm to max(alarm range, timer value) and loop until the
> > timer has expired. Once we have this API, userspace can do the same.
> >
> > I guess that ultimately, this doesn't help your driver unless you are
> > wanting to wakeup all the chromebooks at least once a day regardless of
> > their EC.
>
> That is a no-go. It would reduce battery lifetime on all Chromebooks,
> including those not affected by the problem (that is, almost all of them).
>
> To implement reporting the maximum supported offset, I'd probably either
> try to identify affected Chromebooks using devicetree information,
> or by sending am alarm request > 24h in the future in the probe function
> and setting the maximum offset just below 24h if that request fails.
> We'd have to discuss the best approach internally.
>
> Either case, that doesn't help with the short term problem that we
> have to solve now and that can be backported to older kernels. It also
> won't help userspace - userspace alarm requests, as Brian has pointed out,
> are separate from limits supported by the RTC hardware. We can not change
> the API for CLOCK_xxx_ALARM to userspace, and doing so would not make
> sense anyway since it works just fine as long as the system isn't
> suspended. Besides, changing alarmtimer_suspend() as you suggest above
> would solve the problem for userspace, so I don't see a need for a
> userspace API/ABI change unless I am missing something.
>
Would you be open to accepting this patch, with me starting to work
on the necessary infastructure changes as suggested above for a more
comprehensive solution ?
Thanks,
Guenter
next prev parent reply other threads:[~2022-11-02 18:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 0:54 [PATCH] rtc: cros-ec: Limit RTC alarm range if needed Guenter Roeck
2022-10-29 1:50 ` Brian Norris
2022-10-31 3:26 ` Tzung-Bi Shih
2022-10-31 16:36 ` Brian Norris
2022-10-31 17:10 ` Alexandre Belloni
2022-10-31 17:56 ` Brian Norris
2022-10-31 21:55 ` Alexandre Belloni
2022-10-31 22:47 ` Guenter Roeck
2022-10-31 18:19 ` Guenter Roeck
2022-10-31 22:14 ` Alexandre Belloni
2022-10-31 23:07 ` Guenter Roeck
2022-11-02 18:48 ` Guenter Roeck [this message]
2022-11-07 22:52 ` Alexandre Belloni
2022-11-08 16:59 ` Guenter Roeck
2022-11-14 18:08 ` Alexandre Belloni
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=20221102184804.GA1918067@roeck-us.net \
--to=linux@roeck-us.net \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=bleung@chromium.org \
--cc=briannorris@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.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