public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@kvack.org>
To: torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] kernel/timer.c: xtime lock missing
Date: Thu, 21 Oct 2004 15:03:12 -0400	[thread overview]
Message-ID: <20041021190312.GA30847@kvack.org> (raw)

Hello all,

While looking at the time keeping code for related work, I came across 
the following bug.  During 2.5 development, the smptimers patch removed 
a lock from update_times() that is actually needed over the xtime 
update, since the second overflow is not an atomic operation.  This 
patch fixes that by doing a write_seqlock() over the course of the 
update.

		-ben
-- 
"Time is what keeps everything from happening all at once." -- John Wheeler

===== timer.c 1.93 vs edited =====
--- 1.93/kernel/timer.c	2004-09-17 03:07:06 -04:00
+++ edited/timer.c	2004-10-21 14:51:53 -04:00
@@ -940,11 +940,14 @@
 {
 	unsigned long ticks;
 
+	/* interrupts are disabled */
+	write_seqlock(&xtime_lock);
 	ticks = jiffies - wall_jiffies;
 	if (ticks) {
 		wall_jiffies += ticks;
 		update_wall_time(ticks);
 	}
+	write_sequnlock(&xtime_lock);
 	calc_load(ticks);
 }
   

             reply	other threads:[~2004-10-21 19:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-21 19:03 Benjamin LaHaise [this message]
2004-10-21 20:23 ` [PATCH] kernel/timer.c: xtime lock missing john stultz
2004-10-21 20:29   ` Benjamin LaHaise
2004-10-25 23:09     ` George Anzinger
2004-10-26 11:04       ` Russell King

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=20041021190312.GA30847@kvack.org \
    --to=bcrl@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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