public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	eric.dumazet@gmail.com, oleg@redhat.com
Subject: Re: [PATCH] time/fs - file's time race with vgettimeofday
Date: Wed, 07 Jul 2010 09:20:38 -0700	[thread overview]
Message-ID: <1278519638.1774.19.camel@work-vm> (raw)
In-Reply-To: <20100707104709.GA2710@jolsa.brq.redhat.com>

On Wed, 2010-07-07 at 12:47 +0200, Jiri Olsa wrote:
> On Tue, Jul 06, 2010 at 04:11:40PM -0700, john stultz wrote:
> > [PATCH] x86: Fix vtime/file timestamp inconsistencies
> > 
> > Due to vtime calling vgettimeofday(), its possible that an application
> > could call  time();create("stuff",O_RDRW);  only to see the file's
> > creation timestamp to be before the value returned by time.
> > 
> > The proper fix is to make vtime use the same time value as
> > current_kernel_time() (which is exported via update_vsyscall) instead of
> > vgettime().
> 
> hm, this would be solution for the time() call.
> 
> But I think the issue still stays for gettimeofday and clock_gettime
> (CLOCK_REALTIME/CLOCK_MONOTONIC) because they call vread from
> clocksource to get the real time.
> 
> Thats where I'm not sure if this race is that "bad", compared either
> to performance hit or inaccuracy of user time calls.. which are possible
> solutions..

Right, so as long as the file timestamps are tick-granular (like other
tick-granular interfaces: current_kernel_time(), time(),
CLOCK_REALTIME_COARSE) you will have the possibility of inconsistencies
against the clocksource resolution interfaces (gettimeofday(),
CLOCK_REALTIME, etc).

But that is to be expected as a constraint of the granularity. So I
don't really see this as an issue.

Folks may want to increase the granularity of filesystem timestamps, but
that will come at the possibly very expensive cost of reading the
clocksource hardware (which can have different access latencies between
architectures and even machines of the same arch). I suspect its not
worth it.

The concerning issue here that you pointed out are the inconsistencies
could be seen between vsyscall time() and time() (or filesystem
timestamps). That is a problem, and my patch should resolve that one.

thanks
-john







  reply	other threads:[~2010-07-07 16:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02  7:41 [PATCH] time/fs - file's time race with vgettimeofday Jiri Olsa
2010-07-02 16:14 ` Oleg Nesterov
2010-07-02 16:20   ` Oleg Nesterov
2010-07-02 23:58   ` Jiri Olsa
2010-07-06 23:03 ` john stultz
2010-07-06 23:11   ` john stultz
2010-07-07 10:47     ` Jiri Olsa
2010-07-07 16:20       ` john stultz [this message]
2010-07-07 17:11     ` Jiri Olsa
2010-07-07 17:20       ` john stultz

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=1278519638.1774.19.camel@work-vm \
    --to=johnstul@us.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.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