From: john stultz <johnstul@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@suse.de>
Cc: lkml <linux-kernel@vger.kernel.org>,
Sripathi Kodi <sripathi@in.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] vsyscall time() fix
Date: Thu, 17 May 2007 19:25:10 -0700 [thread overview]
Message-ID: <1179455110.6177.36.camel@localhost.localdomain> (raw)
Hey Andrew, Andi,
The vsyscall time() function basically returns the second portion of
xtime directly. This however means that there is about a ticks worth of
time each second where time() will return a second value less then what
gettimeofday() does.
Additionally, this window where vtime() is behind vgettimeofday() grows
when dynticks is enabled, so its probably good to get this in before
dynticks lands.
Big thanks to Sripathi for noticing this issue and creating a test case
to work with!
Andi: I can rediff this against 2.6.21-stable as well if you want,
although the behavior has been around for awhile, so I'm not sure how
urgent you feel it is.
thanks
-john
This patch changes the vtime() implemenation to call vgettimeofday(),
much as syscall time() implementation calls gettimeofday().
Signed-off-by: John Stultz <johnstul@us.ibm.com>
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
index 51d4c6f..57660d5 100644
--- a/arch/x86_64/kernel/vsyscall.c
+++ b/arch/x86_64/kernel/vsyscall.c
@@ -175,10 +175,13 @@ int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)
* unlikely */
time_t __vsyscall(1) vtime(time_t *t)
{
+ struct timeval tv;
time_t result;
if (unlikely(!__vsyscall_gtod_data.sysctl_enabled))
return time_syscall(t);
- result = __vsyscall_gtod_data.wall_time_sec;
+
+ vgettimeofday(&tv, 0);
+ result = tv.tv_sec;
if (t)
*t = result;
return result;
reply other threads:[~2007-05-18 2:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1179455110.6177.36.camel@localhost.localdomain \
--to=johnstul@us.ibm.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sripathi@in.ibm.com \
--cc=tglx@linutronix.de \
/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