public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: Ingo Molnar <mingo@elte.hu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] to fix xtime lock for in the RT kernel patch
Date: Thu, 20 Jan 2005 15:57:39 -0800	[thread overview]
Message-ID: <41F04573.7070508@mvista.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

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/

[-- Attachment #2: timefixes.patch --]
[-- Type: text/plain, Size: 2810 bytes --]

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);
 

             reply	other threads:[~2005-01-20 23:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-20 23:57 George Anzinger [this message]
2005-01-21  6:35 ` [PATCH] to fix xtime lock for in the RT kernel patch Ingo Molnar
2005-01-21  8:16   ` George Anzinger
2005-01-21  8:21     ` Ingo Molnar
2005-01-21  8:39       ` George Anzinger
2005-01-21  8:45         ` Ingo Molnar
2005-01-21  8:54           ` George Anzinger
2005-01-21  9:00             ` Ingo Molnar
2005-01-21  9:08               ` George Anzinger
2005-01-27 20:53                 ` George Anzinger
2005-01-28  4:35                   ` Ingo Molnar

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=41F04573.7070508@mvista.com \
    --to=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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