lkml.org 
[lkml]   [2005]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] to fix xtime lock for in the RT kernel patch
It seems to me that we need to either do the attached or to rewrite the timer 
front end code to just gather the offset info and defer to the timer irq thread
to update jiffies and the offset stuff. In either case we really can not split
the two and we do need the xtime_lock protection.
--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Source: MontaVista Software, Inc. George Anzinger <george@mvista.com>
Type: Defect Fix
Keywords:
Signed-off-by: George Anzinger <george@mvista.com>
Description:
This patch changes the timer interrupt code for the RT patch to
respect the xtime_lock which should protect jiffies and to collect
offset information on jiffies interrupts. This offset info must
be collected as soon as possible during the jiffies interrupt and
also needs to be protected by the xtime_lock.

The xtime_lock is thus a "raw" lock.

arch/i386/kernel/time.c | 8 +++++---
include/linux/time.h | 2 +-
kernel/timer.c | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)

Index: topdir/kernel/timer.c
===================================================================
--- topdir.orig/kernel/timer.c
+++ topdir/kernel/timer.c
@@ -946,7 +946,7 @@ unsigned long wall_jiffies = INITIAL_JIF
* playing with xtime and avenrun.
*/
#ifndef ARCH_HAVE_XTIME_LOCK
-DECLARE_SEQLOCK(xtime_lock);
+DECLARE_RAW_SEQLOCK(xtime_lock);

EXPORT_SYMBOL(xtime_lock);
#endif
Index: topdir/include/linux/time.h
===================================================================
--- topdir.orig/include/linux/time.h
+++ topdir/include/linux/time.h
@@ -80,7 +80,7 @@ mktime (unsigned int year, unsigned int

extern struct timespec xtime;
extern struct timespec wall_to_monotonic;
-extern seqlock_t xtime_lock;
+extern raw_seqlock_t xtime_lock;

static inline unsigned long get_seconds(void)
{
Index: topdir/arch/i386/kernel/time.c
===================================================================
--- topdir.orig/arch/i386/kernel/time.c
+++ topdir/arch/i386/kernel/time.c
@@ -20,7 +20,7 @@
* monotonic gettimeofday() with fast_get_timeoffset(),
* drift-proof precision TSC calibration on boot
* (C. Scott Ananian <cananian@alumni.princeton.edu>, Andrew D.
- * Balsa <andrebalsa@altern.org>, Philip Gladstone <philip@raptor.com>;
+ * Balsa <andrebalsa@altern.org>, Philip Gladstone <philip@raptor.com>;
* ported from 2.0.35 Jumbo-9 by Michael Krause <m.krause@tu-harburg.de>).
* 1998-12-16 Andrea Arcangeli
* Fixed Jumbo-9 code in 2.1.131: do_gettimeofday was missing 1 jiffy
@@ -224,7 +224,10 @@ EXPORT_SYMBOL(profile_pc);
*/
void direct_timer_interrupt(struct pt_regs *regs)
{
+ write_seqlock(&xtime_lock);
+ cur_timer->mark_offset();
do_timer_interrupt_hook(regs);
+ write_sequnlock(&xtime_lock);
}

#endif
@@ -254,6 +257,7 @@ static inline void do_timer_interrupt(in
#endif

#ifndef CONFIG_PREEMPT_HARDIRQS
+ cur_timer->mark_offset();
do_timer_interrupt_hook(regs);
#endif

@@ -312,8 +316,6 @@ irqreturn_t timer_interrupt(int irq, voi
* locally disabled. -arca
*/
write_seqlock(&xtime_lock);
-
- cur_timer->mark_offset();

do_timer_interrupt(irq, NULL, regs);
\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.055 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site