login
Header Space

 
 

[PATCH 8/8] handle leap second via timer

Previous thread: [PATCH 2/8] NTP4 user space bits update by zippel on Friday, March 14, 2008 - 2:40 pm. (3 messages)

Next thread: [PATCH 5/8] support for TAI by zippel on Friday, March 14, 2008 - 2:40 pm. (2 messages)
To: <linux-kernel@...>
Cc: <akpm@...>, <johnstul@...>
Date: Friday, March 14, 2008 - 2:40 pm

Remove the leap second handling from second_overflow(), which doesn't
has to check for it every second anymore. With CONFIG_NO_HZ this also
makes sure the leap second is handled close to the full second.
Additionally this makes it possible to abort a leap second properly
by resetting the STA_INS/STA_DEL status bits.

Signed-off-by: Roman Zippel &lt;zippel@linux-m68k.org&gt;

---
 include/linux/clocksource.h |    2 
 include/linux/timex.h       |    1 
 kernel/time/ntp.c           |  133 +++++++++++++++++++++++++++++---------------
 kernel/time/timekeeping.c   |    4 -
 4 files changed, 95 insertions(+), 45 deletions(-)

Index: linux-2.6/include/linux/timex.h
===================================================================
--- linux-2.6.orig/include/linux/timex.h	2008-03-13 10:32:07.000000000 +0100
+++ linux-2.6/include/linux/timex.h	2008-03-13 10:33:24.000000000 +0100
@@ -210,6 +210,7 @@ extern long time_esterror;	/* estimated 
 
 extern long time_adjust;	/* The amount of adjtime left */
 
+extern void ntp_init(void);
 extern void ntp_clear(void);
 
 /**
Index: linux-2.6/kernel/time/ntp.c
===================================================================
--- linux-2.6.orig/kernel/time/ntp.c	2008-03-13 10:32:07.000000000 +0100
+++ linux-2.6/kernel/time/ntp.c	2008-03-13 10:33:24.000000000 +0100
@@ -16,6 +16,7 @@
 #include &lt;linux/hrtimer.h&gt;
 #include &lt;linux/capability.h&gt;
 #include &lt;linux/math64.h&gt;
+#include &lt;linux/clocksource.h&gt;
 #include &lt;asm/timex.h&gt;
 
 /*
@@ -26,6 +27,8 @@ unsigned long tick_nsec;			/* ACTHZ peri
 u64 tick_length;
 static u64 tick_length_base;
 
+static struct hrtimer leap_timer;
+
 #define MAX_TICKADJ		500		/* microsecs */
 #define MAX_TICKADJ_SCALED	(((u64)(MAX_TICKADJ * NSEC_PER_USEC) &lt;&lt; \
 				  NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ)
@@ -120,64 +123,70 @@ void ntp_clear(void)
 }
 
 /*
- * this routine handles the overflow of the microsecond field
- *
- * The tricky bits of code to handle the accurate ...
To: <zippel@...>
Cc: <linux-kernel@...>, <akpm@...>
Date: Friday, March 14, 2008 - 4:24 pm

Instead of exporting the clocksource making it global, could you use a
timekeeping_insert/remove_second() style interface?

That would help remove the xtime/wall_to_monotonic references in ntp.c
as well, cleaning up things nicely.

thanks
-john


--
To: john stultz <johnstul@...>
Cc: <linux-kernel@...>, <akpm@...>
Date: Friday, March 14, 2008 - 11:18 pm

Hi,


Sounds good.

bye, Roman
--
To: Roman Zippel <zippel@...>
Cc: <johnstul@...>, <linux-kernel@...>, Thomas Gleixner <tglx@...>
Date: Monday, March 17, 2008 - 6:18 pm

On Sat, 15 Mar 2008 04:18:39 +0100 (CET)

It sounds like a few updates are in the pipeline, but I merged this series
as-is into -mm.

I'll normally push ntp changes through Thomas's git-hrt tree, however this
patch series has dependencies upon at least

introduce-explicit-signed-unsigned-64bit-divide.patch
convert-a-few-do_div-user.patch
rename-div64_64-to-div64_u64.patch
rename-div64_64-to-div64_u64-mm.patch
remove-div_long_long_rem.patch

so they can't go into git-hrt immediately.

The idealised algorithm is

- 2.6.26 opens
- Thomas merges git-hrt
- I merge the above patches
- I then send these ntp patches to Thomas
- He merges them into git-hrt
- He does another git-hrt -&gt; Linus merge

And that's all OK, but various lags might cause us to miss the merge
window, as I merge the -mm stuff last, and some git-tree maintainers are
dawdlers.

So if Thomas wants to ack these I can merge them directly late in the
2.6.26 merge window.

--
To: Andrew Morton <akpm@...>
Cc: Roman Zippel <zippel@...>, <johnstul@...>, <linux-kernel@...>
Date: Friday, March 21, 2008 - 10:15 am

Fine for me either way.

Thanks,

	tglx

--
Previous thread: [PATCH 2/8] NTP4 user space bits update by zippel on Friday, March 14, 2008 - 2:40 pm. (3 messages)

Next thread: [PATCH 5/8] support for TAI by zippel on Friday, March 14, 2008 - 2:40 pm. (2 messages)
speck-geostationary