* [RFC][PATCH 13/14] Convert sh to read/update_persistent_clock
[not found] ` <1261541643.3508.74.camel@localhost.localdomain>
@ 2009-12-23 4:15 ` john stultz
0 siblings, 0 replies; 7+ messages in thread
From: john stultz @ 2009-12-23 4:15 UTC (permalink / raw)
To: lkml; +Cc: Paul Mundt, linux-sh
This patch converts the sh architecture to use the generic
read_persistent_clock and update_persistent_clock interfaces, reducing
the amount of arch specific code we have to maintain, and allowing for
further cleanups in the future.
I have not built or tested this patch, so help from arch maintainers
would be appreciated.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
---
time.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
Index: gettimeoffset/arch/sh/kernel/time.c
=================================--- gettimeoffset.orig/arch/sh/kernel/time.c 2009-12-22 18:50:55.000000000 -0800
+++ gettimeoffset/arch/sh/kernel/time.c 2009-12-22 18:51:12.000000000 -0800
@@ -39,12 +39,12 @@ static int null_rtc_set_time(const time_
void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time;
-#ifdef CONFIG_GENERIC_CMOS_UPDATE
void read_persistent_clock(struct timespec *ts)
{
rtc_sh_get_time(ts);
}
+#ifdef CONFIG_GENERIC_CMOS_UPDATE
int update_persistent_clock(struct timespec now)
{
return rtc_sh_set_time(now.tv_sec);
@@ -113,9 +113,5 @@ void __init time_init(void)
hwblk_init();
clk_init();
- rtc_sh_get_time(&xtime);
- set_normalized_timespec(&wall_to_monotonic,
- -xtime.tv_sec, -xtime.tv_nsec);
-
late_time_init = sh_late_time_init;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 0/14] Convert remaining arches to read/update_persistent_clock
[not found] <1261540762.3508.61.camel@localhost.localdomain>
[not found] ` <1261540826.3508.62.camel@localhost.localdomain>
@ 2009-12-23 5:08 ` Paul Mundt
2009-12-23 10:08 ` [RFC][PATCH 0/14] Convert remaining arches to Geert Uytterhoeven
` (2 more replies)
1 sibling, 3 replies; 7+ messages in thread
From: Paul Mundt @ 2009-12-23 5:08 UTC (permalink / raw)
To: john stultz
Cc: lkml, Richard Henderson, linux-alpha, linux-sh, Russell King,
Haavard Skinnemoen, Mike Frysinger, Mikael Starvik, David Howells,
Yoshinori Sato, Tony Luck, Hirokazu Takata, Geert Uytterhoeven,
Koichi Yasutake, Kyle McMartin, David S. Miller
On Tue, Dec 22, 2009 at 07:59:22PM -0800, john stultz wrote:
> In this case the generic read_persistent_clock() and
> update_persistent_clock() methods have been provided to allow the
> generic timekeeping code to initialize xtime and set the persistent
> clock when NTP is synced. However many arches haven't converted, so the
> generic code has to handle the case where the arch is doing this
> management itself.
>
> This patch series tries to convert the following 14 architectures over
> to use read_persistent_clock() and update_persistent_clock() as
> applicable, killing off about 200 lines of arch specific code.
>
While I think that this is a good goal, many of the underlying
architectures have veered pretty far away from having meaningful
persistent clock interfaces after having moved entirely to generic
timekeeping and the RTC subsystem.
In the case of SH at least that interface along with the generic CMOS
stuff is largely a stop-gap for antiquated platforms that don't have
proper RTC drivers and likely never will, while the default for all of
the rest of the platforms effectively returns a fixed dummy value. I
copied this approach from MIPS originally, so there are at least a few
architectures that this will apply to.
In any event, I wonder if it might make more sense to take something like
the SPARC implementation that is simply a wrapper around the RTC, move
that out in to a more generic place, and permit architectures to select
an RTC class backed persistent clock instead (it seems to be only
platforms that haven't caught up yet in terms of generic time and RTC
migration that would want to define this interface on their own at all at
this point)?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 0/14] Convert remaining arches to
2009-12-23 5:08 ` [RFC][PATCH 0/14] Convert remaining arches " Paul Mundt
@ 2009-12-23 10:08 ` Geert Uytterhoeven
2009-12-23 22:04 ` john stultz
2009-12-24 4:54 ` [RFC][PATCH 0/14] Convert remaining arches to David Miller
2 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2009-12-23 10:08 UTC (permalink / raw)
To: Paul Mundt
Cc: john stultz, lkml, Richard Henderson, linux-alpha, linux-sh,
Russell King, Haavard Skinnemoen, Mike Frysinger, Mikael Starvik,
David Howells, Yoshinori Sato, Tony Luck, Hirokazu Takata,
Koichi Yasutake, Kyle McMartin, David S. Miller
On Wed, Dec 23, 2009 at 06:08, Paul Mundt <lethal@linux-sh.org> wrote:
> On Tue, Dec 22, 2009 at 07:59:22PM -0800, john stultz wrote:
>> In this case the generic read_persistent_clock() and
>> update_persistent_clock() methods have been provided to allow the
>> generic timekeeping code to initialize xtime and set the persistent
>> clock when NTP is synced. However many arches haven't converted, so the
>> generic code has to handle the case where the arch is doing this
>> management itself.
>>
>> This patch series tries to convert the following 14 architectures over
>> to use read_persistent_clock() and update_persistent_clock() as
>> applicable, killing off about 200 lines of arch specific code.
>>
> While I think that this is a good goal, many of the underlying
> architectures have veered pretty far away from having meaningful
> persistent clock interfaces after having moved entirely to generic
> timekeeping and the RTC subsystem.
Indeed. When moving to the RTC subsystem, you loose the persistent
clock at boot;
i.e. on m68k, mach_hwclk() can no longer be set, as the RTC driver is
in a separate
(possible loadable) module.
> In the case of SH at least that interface along with the generic CMOS
> stuff is largely a stop-gap for antiquated platforms that don't have
> proper RTC drivers and likely never will, while the default for all of
> the rest of the platforms effectively returns a fixed dummy value. I
> copied this approach from MIPS originally, so there are at least a few
> architectures that this will apply to.
>
> In any event, I wonder if it might make more sense to take something like
> the SPARC implementation that is simply a wrapper around the RTC, move
> that out in to a more generic place, and permit architectures to select
> an RTC class backed persistent clock instead (it seems to be only
> platforms that haven't caught up yet in terms of generic time and RTC
> migration that would want to define this interface on their own at all at
> this point)?
Hmm, haven't looked into how SPARC handles this yet...
Yes, looks like a good idea to me. Any disadvantages with this approach?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 0/14] Convert remaining arches to
2009-12-23 5:08 ` [RFC][PATCH 0/14] Convert remaining arches " Paul Mundt
2009-12-23 10:08 ` [RFC][PATCH 0/14] Convert remaining arches to Geert Uytterhoeven
@ 2009-12-23 22:04 ` john stultz
2009-12-24 0:27 ` [RFC][PATCH 0/14] Convert remaining arches to read/update_persistent_clock Dialup Jon Norstog
2009-12-24 4:54 ` [RFC][PATCH 0/14] Convert remaining arches to David Miller
2 siblings, 1 reply; 7+ messages in thread
From: john stultz @ 2009-12-23 22:04 UTC (permalink / raw)
To: Paul Mundt
Cc: lkml, Richard Henderson, linux-alpha, linux-sh, Russell King,
Haavard Skinnemoen, Mike Frysinger, Mikael Starvik, David Howells,
Yoshinori Sato, Tony Luck, Hirokazu Takata, Geert Uytterhoeven,
Koichi Yasutake, Kyle McMartin, David S. Miller, David Brownell
On Wed, 2009-12-23 at 14:08 +0900, Paul Mundt wrote:
> On Tue, Dec 22, 2009 at 07:59:22PM -0800, john stultz wrote:
> > In this case the generic read_persistent_clock() and
> > update_persistent_clock() methods have been provided to allow the
> > generic timekeeping code to initialize xtime and set the persistent
> > clock when NTP is synced. However many arches haven't converted, so the
> > generic code has to handle the case where the arch is doing this
> > management itself.
> >
> > This patch series tries to convert the following 14 architectures over
> > to use read_persistent_clock() and update_persistent_clock() as
> > applicable, killing off about 200 lines of arch specific code.
> >
> While I think that this is a good goal, many of the underlying
> architectures have veered pretty far away from having meaningful
> persistent clock interfaces after having moved entirely to generic
> timekeeping and the RTC subsystem.
>
> In the case of SH at least that interface along with the generic CMOS
> stuff is largely a stop-gap for antiquated platforms that don't have
> proper RTC drivers and likely never will, while the default for all of
> the rest of the platforms effectively returns a fixed dummy value. I
> copied this approach from MIPS originally, so there are at least a few
> architectures that this will apply to.
>
> In any event, I wonder if it might make more sense to take something like
> the SPARC implementation that is simply a wrapper around the RTC, move
> that out in to a more generic place, and permit architectures to select
> an RTC class backed persistent clock instead (it seems to be only
> platforms that haven't caught up yet in terms of generic time and RTC
> migration that would want to define this interface on their own at all at
> this point)?
Yea, there's some additional complications with the RTC interface via
read_persistent_clock, as some RTC clocks require irqs enabled to be
able to read. This keeps them from being used via
read_persistent_clock() as it is used prior to irqs being enabled, and
then again with irqs disabled in the suspend and resume path.
This has a bit of a trade-off, as we can better handle timekeeping
around a suspend/resume with read_persistent_clock(), but for some
hardware we just can't use the RTC for that.
Anyway, if we can improve the timekeeping/RTC interface used for
initialization and suspend/resume, I'm all for it (maybe having the RTC
code to tell the timekeeping code if it can be accessed with irqs off?).
But for hardware that needs irqs, i'm not sure how we can handle resumes
correctly there. So suggestions would be welcome.
Anyway, the main point of this patch set is to remove the direct access
to timekeeping internals (xtime, wall_to_monotonic). Those need to go
soon, as they're limiting changes in the timekeeping code.
read_persistent_clock() is the current way to avoid it, but if systems
are fine doing a settimeofday() at init that's ok too (although some
oddities may be seen wrt boot time with the direct settimeofday, I need
to refresh my head on how the varying default boot times between arches
may be effected).
thanks
-john
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 0/14] Convert remaining arches to read/update_persistent_clock
2009-12-23 22:04 ` john stultz
@ 2009-12-24 0:27 ` Dialup Jon Norstog
0 siblings, 0 replies; 7+ messages in thread
From: Dialup Jon Norstog @ 2009-12-24 0:27 UTC (permalink / raw)
To: john stultz, Paul Mundt
Cc: lkml, Richard Henderson, linux-alpha, linux-sh, Russell King,
Haavard Skinnemoen, Mike Frysinger, Mikael Starvik, David Howells,
Yoshinori Sato, Tony Luck, Hirokazu Takata, Geert Uytterhoeven,
Koichi Yasutake, Kyle McMartin, David S. Miller, David Brownell
john,
IMO the biggest clock problem on Alpha is that dual booting Tru64 and Linux
whacks the clock every time you go from one OS to the other. Allowing Linux
to decouple from SRM's TOY clock would be a signal advance.
jon norstog
---------- Original Message -----------
From: john stultz <johnstul@us.ibm.com>
To: Paul Mundt <lethal@linux-sh.org>
Cc: lkml <linux-kernel@vger.kernel.org>, Richard Henderson
<rth@twiddle.net>, linux-alpha@vger.kernel.org, linux-sh@vger.kernel.org,
Russell King <linux@arm.linux.org.uk>, Haavard Skinnemoen
<hskinnemoen@atmel.com>, Mike Frysinger <vapier@gentoo.org>, Mikael Starvik
<starvik@axis.com>, David Howells <dhowells@redhat.com>, Yoshinori Sato
<ysato@users.sourceforge.jp>, Tony Luck <tony.luck@intel.com>, Hirokazu
Takata <takata@linux-m32r.org>, Geert Uytterhoeven <geert@linux-m68k.org>,
Koichi Yasutake <yasutake.koichi@jp.panasonic.com>, Kyle McMartin
<kyle@mcmartin.ca>, "David S. Miller" <davem@davemloft.net>, David Brownell
<dbrownell@users.sourceforge.net>
Sent: Wed, 23 Dec 2009 14:04:59 -0800
Subject: Re: [RFC][PATCH 0/14] Convert remaining arches to
read/update_persistent_clock
> On Wed, 2009-12-23 at 14:08 +0900, Paul Mundt wrote:
> > On Tue, Dec 22, 2009 at 07:59:22PM -0800, john stultz wrote:
> > > In this case the generic read_persistent_clock() and
> > > update_persistent_clock() methods have been provided to allow the
> > > generic timekeeping code to initialize xtime and set the persistent
> > > clock when NTP is synced. However many arches haven't converted, so the
> > > generic code has to handle the case where the arch is doing this
> > > management itself.
> > >
> > > This patch series tries to convert the following 14 architectures over
> > > to use read_persistent_clock() and update_persistent_clock() as
> > > applicable, killing off about 200 lines of arch specific code.
> > >
> > While I think that this is a good goal, many of the underlying
> > architectures have veered pretty far away from having meaningful
> > persistent clock interfaces after having moved entirely to generic
> > timekeeping and the RTC subsystem.
> >
> > In the case of SH at least that interface along with the generic CMOS
> > stuff is largely a stop-gap for antiquated platforms that don't have
> > proper RTC drivers and likely never will, while the default for all of
> > the rest of the platforms effectively returns a fixed dummy value. I
> > copied this approach from MIPS originally, so there are at least a few
> > architectures that this will apply to.
> >
> > In any event, I wonder if it might make more sense to take something like
> > the SPARC implementation that is simply a wrapper around the RTC, move
> > that out in to a more generic place, and permit architectures to select
> > an RTC class backed persistent clock instead (it seems to be only
> > platforms that haven't caught up yet in terms of generic time and RTC
> > migration that would want to define this interface on their own at all at
> > this point)?
>
> Yea, there's some additional complications with the RTC interface via
> read_persistent_clock, as some RTC clocks require irqs enabled to be
> able to read. This keeps them from being used via
> read_persistent_clock() as it is used prior to irqs being enabled,
> and then again with irqs disabled in the suspend and resume path.
>
> This has a bit of a trade-off, as we can better handle timekeeping
> around a suspend/resume with read_persistent_clock(), but for some
> hardware we just can't use the RTC for that.
>
> Anyway, if we can improve the timekeeping/RTC interface used for
> initialization and suspend/resume, I'm all for it (maybe having the RTC
> code to tell the timekeeping code if it can be accessed with irqs
> off?). But for hardware that needs irqs, i'm not sure how we can
> handle resumes correctly there. So suggestions would be welcome.
>
> Anyway, the main point of this patch set is to remove the direct access
> to timekeeping internals (xtime, wall_to_monotonic). Those need to go
> soon, as they're limiting changes in the timekeeping code.
> read_persistent_clock() is the current way to avoid it, but if
> systems are fine doing a settimeofday() at init that's ok too
> (although some oddities may be seen wrt boot time with the direct
> settimeofday, I need to refresh my head on how the varying default
> boot times between arches may be effected).
>
> thanks
> -john
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> alpha" in the body of a message to majordomo@vger.kernel.org More
> majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
------- End of Original Message -------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 0/14] Convert remaining arches to
2009-12-23 5:08 ` [RFC][PATCH 0/14] Convert remaining arches " Paul Mundt
2009-12-23 10:08 ` [RFC][PATCH 0/14] Convert remaining arches to Geert Uytterhoeven
2009-12-23 22:04 ` john stultz
@ 2009-12-24 4:54 ` David Miller
2009-12-24 5:10 ` [RFC][PATCH 0/14] Convert remaining arches to read/update_persistent_clock Paul Mundt
2 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2009-12-24 4:54 UTC (permalink / raw)
To: lethal
Cc: johnstul, linux-kernel, rth, linux-alpha, linux-sh, linux,
hskinnemoen, vapier, starvik, dhowells, ysato, tony.luck, takata,
geert, yasutake.koichi, kyle
From: Paul Mundt <lethal@linux-sh.org>
Date: Wed, 23 Dec 2009 14:08:10 +0900
> In any event, I wonder if it might make more sense to take something like
> the SPARC implementation that is simply a wrapper around the RTC, move
> that out in to a more generic place, and permit architectures to select
> an RTC class backed persistent clock instead (it seems to be only
> platforms that haven't caught up yet in terms of generic time and RTC
> migration that would want to define this interface on their own at all at
> this point)?
This sounds nice but don't we have a slew of RTC types that need
to be accessed over I2C and thus you can't touch them without
sleeping?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 0/14] Convert remaining arches to read/update_persistent_clock
2009-12-24 4:54 ` [RFC][PATCH 0/14] Convert remaining arches to David Miller
@ 2009-12-24 5:10 ` Paul Mundt
0 siblings, 0 replies; 7+ messages in thread
From: Paul Mundt @ 2009-12-24 5:10 UTC (permalink / raw)
To: David Miller
Cc: johnstul, linux-kernel, rth, linux-alpha, linux-sh, linux,
hskinnemoen, vapier, starvik, dhowells, ysato, tony.luck, takata,
geert, yasutake.koichi, kyle
On Wed, Dec 23, 2009 at 08:54:15PM -0800, David Miller wrote:
> From: Paul Mundt <lethal@linux-sh.org>
> Date: Wed, 23 Dec 2009 14:08:10 +0900
>
> > In any event, I wonder if it might make more sense to take something like
> > the SPARC implementation that is simply a wrapper around the RTC, move
> > that out in to a more generic place, and permit architectures to select
> > an RTC class backed persistent clock instead (it seems to be only
> > platforms that haven't caught up yet in terms of generic time and RTC
> > migration that would want to define this interface on their own at all at
> > this point)?
>
> This sounds nice but don't we have a slew of RTC types that need
> to be accessed over I2C and thus you can't touch them without
> sleeping?
Yes, and SPI and so on. We do however have plenty of available room for
adding a valid-for-persistent-clock flag to permit drivers to opt-in, so
we can certainly still do better than the status quo. I'll hack something
up and see how it goes.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-12-24 5:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1261540762.3508.61.camel@localhost.localdomain>
[not found] ` <1261540826.3508.62.camel@localhost.localdomain>
[not found] ` <1261540902.3508.63.camel@localhost.localdomain>
[not found] ` <1261540988.3508.64.camel@localhost.localdomain>
[not found] ` <1261541054.3508.65.camel@localhost.localdomain>
[not found] ` <1261541130.3508.66.camel@localhost.localdomain>
[not found] ` <1261541188.3508.67.camel@localhost.localdomain>
[not found] ` <1261541286.3508.69.camel@localhost.localdomain>
[not found] ` <1261541342.3508.70.camel@localhost.localdomain>
[not found] ` <1261541415.3508.71.camel@localhost.localdomain>
[not found] ` <1261541491.3508.72.camel@localhost.localdomain>
[not found] ` <1261541567.3508.73.camel@localhost.localdomain>
[not found] ` <1261541643.3508.74.camel@localhost.localdomain>
2009-12-23 4:15 ` [RFC][PATCH 13/14] Convert sh to read/update_persistent_clock john stultz
2009-12-23 5:08 ` [RFC][PATCH 0/14] Convert remaining arches " Paul Mundt
2009-12-23 10:08 ` [RFC][PATCH 0/14] Convert remaining arches to Geert Uytterhoeven
2009-12-23 22:04 ` john stultz
2009-12-24 0:27 ` [RFC][PATCH 0/14] Convert remaining arches to read/update_persistent_clock Dialup Jon Norstog
2009-12-24 4:54 ` [RFC][PATCH 0/14] Convert remaining arches to David Miller
2009-12-24 5:10 ` [RFC][PATCH 0/14] Convert remaining arches to read/update_persistent_clock Paul Mundt
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).