From: David Brownell <david-b@pacbell.net>
To: john stultz <johnstul@us.ibm.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [patch 02/23] GTOD: persistent clock support, core
Date: Tue, 3 Oct 2006 06:53:11 -0700 [thread overview]
Message-ID: <200610030653.12411.david-b@pacbell.net> (raw)
> Implement generic timekeeping suspend/resume accounting by introducing
> the read_persistent_clock() interface. This is an arch specific
> function that returns the seconds since the epoch using the arch
> defined battery backed clock.
I remain unclear what's expected to happen when there IS no such
architcture-defined clock ... but where the system itself still
has one, e.g. a board may access one through I2C or SPI once IRQs
are working normally.
You'll recall that I had pointed out that the drivers/rtc framework
provides CONFIG_RTC_HCTOSYS, which already unifies quite a lot of
the "persistent" clocks in the way you described above, but without
that nasty requirement of working without IRQs enabled.
> +/**
> + * read_persistent_clock - Return time in seconds from the persistent clock.
> + *
> + * Weak dummy function for arches that do not yet support it.
> + * Returns seconds from epoch using the battery backed persistent clock.
> + * Returns zero if unsupported.
> + *
> + * XXX - Do be sure to remove it once all arches implement it.
But not all architectures **CAN** support this notion ...
> + */
> +unsigned long __attribute__((weak)) read_persistent_clock(void)
> +{
> + return 0;
> +}
> +
>
> /*
> * timekeeping_init - Initializes the clocksource and common timekeeping values
> */
> void __init timekeeping_init(void)
> {
> unsigned long flags;
> + unsigned long sec = read_persistent_clock();
... and timekeeping_init() is called before I2C or SPI could be used,
since IRQs aren't enabled yet and accessing those busses can't be
done in general without IRQs enabled.
> @@ -774,13 +801,23 @@ static int timekeeping_suspended;
> static int timekeeping_resume(struct sys_device *dev)
> {
> unsigned long flags;
> + unsigned long now = read_persistent_clock();
Again: sys_device resume() is called with IRQs disabled, which
prevents access to many systems' persistent clocks. In fact,
after posting this example patch
http://marc.theaimsgroup.com/?l=linux-kernel&m=115600629813751&w=2
I never heard anything more from you on this issue. Given this
particular patch (in $SUBJECT) should I assume you're going to
just ignore the issues whereby RTCs ("persistent clocks") can't
always meet the no-IRQs-needed assumptions being made here? Or
address isssues like using pointer-to-function instead of using
linker tricks?
http://marc.theaimsgroup.com/?l=linux-kernel&m=115600629825461&w=2
Those class suspend/resume hooks are now merged to kernel.org, by
the way, so that example patch is now pretty much deployable.
- Dave
next reply other threads:[~2006-10-03 13:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-03 13:53 David Brownell [this message]
2006-10-03 19:19 ` [patch 02/23] GTOD: persistent clock support, core john stultz
2006-10-04 17:50 ` David Brownell
2006-10-04 19:09 ` john stultz
-- strict thread matches above, loose matches on Subject: below --
2006-09-29 23:58 [patch 00/23] Thomas Gleixner
2006-09-29 23:58 ` [patch 02/23] GTOD: persistent clock support, core Thomas Gleixner
2006-09-30 8:35 ` Andrew Morton
2006-09-30 17:15 ` Jan Engelhardt
2006-10-02 21:49 ` john stultz
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=200610030653.12411.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@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