26 Jul, 2007

2 commits

  • This avoids xtime lag seen with dynticks, because while 'xtime' itself
    is still not updated often, we keep a 'xtime_cache' variable around that
    contains the approximate real-time that _is_ updated each time we do a
    'update_wall_time()', and is thus never off by more than one tick.

    IOW, this restores the original semantics for 'xtime' users, as long as
    you use the proper abstraction functions (ie 'current_kernel_time()' or
    'get_seconds()' depending on whether you want a timespec or just the
    seconds field).

    [ Updated Patch. As penance for my sins I've also yanked another #ifdef
    that was added to avoid the xtime lag w/ hrtimers. ]

    Signed-off-by: John Stultz
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Linus Torvalds

    john stultz
     
  • This avoids use of the kernel-internal "xtime" variable directly outside
    of the actual time-related functions. Instead, use the helper functions
    that we already have available to us.

    This doesn't actually change any behaviour, but this will allow us to
    fix the fact that "xtime" isn't updated very often with CONFIG_NO_HZ
    (because much of the realtime information is maintained as separate
    offsets to 'xtime'), which has caused interfaces that use xtime directly
    to get a time that is out of sync with the real-time clock by up to a
    third of a second or so.

    Signed-off-by: John Stultz
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Linus Torvalds

    john stultz
     

22 Jul, 2007

1 commit

  • i386 and sparc64 have the identical code to update the cmos clock. Move it
    into kernel/time/ntp.c as there are other architectures coming along with the
    same requirements.

    [akpm@linux-foundation.org: build fixes]
    Signed-off-by: Thomas Gleixner
    Cc: Chris Wright
    Cc: Ingo Molnar
    Cc: john stultz
    Cc: David Miller
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     

18 Jul, 2007

1 commit


17 Jul, 2007

1 commit

  • The commits

    411187fb05cd11676b0979d9fbf3291db69dbce2 (GTOD: persistent clock support)
    c1d370e167d66b10bca3b602d3740405469383de (i386: use GTOD persistent clock
    support)

    changed the monotonic time so that it no longer jumps after resume, but it's
    not possible to use it for boot time and process start time calculations then.
    Also, the uptime no longer increases during suspend.

    I add a variable to track the wall_to_monotonic changes, a function to get the
    real boot time and a function to get the boot based time from the monotonic
    one.

    [akpm@linux-foundation.org: remove exports, add comment]
    Signed-off-by: Tomas Janousek
    Cc: Tomas Smetana
    Cc: John Stultz
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tomas Janousek
     

09 May, 2007

2 commits

  • Implement utimensat(2) which is an extension to futimesat(2) in that it

    a) supports nano-second resolution for the timestamps
    b) allows to selectively ignore the atime/mtime value
    c) allows to selectively use the current time for either atime or mtime
    d) supports changing the atime/mtime of a symlink itself along the lines
    of the BSD lutimes(3) functions

    For this change the internally used do_utimes() functions was changed to
    accept a timespec time value and an additional flags parameter.

    Additionally the sys_utime function was changed to match compat_sys_utime
    which already use do_utimes instead of duplicating the work.

    Also, the completely missing futimensat() functionality is added. We have
    such a function in glibc but we have to resort to using /proc/self/fd/* which
    not everybody likes (chroot etc).

    Test application (the syscall number will need per-arch editing):

    #include
    #include
    #include
    #include
    #include
    #include

    #define __NR_utimensat 280

    #define UTIME_NOW ((1l << 30) - 1l)
    #define UTIME_OMIT ((1l << 30) - 2l)

    int
    main(void)
    {
    int status = 0;

    int fd = open("ttt", O_RDWR|O_CREAT|O_EXCL, 0666);
    if (fd == -1)
    error (1, errno, "failed to create test file \"ttt\"");

    struct stat64 st1;
    if (fstat64 (fd, &st1) != 0)
    error (1, errno, "fstat failed");

    struct timespec t[2];
    t[0].tv_sec = 0;
    t[0].tv_nsec = 0;
    t[1].tv_sec = 0;
    t[1].tv_nsec = 0;
    if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
    error (1, errno, "utimensat failed");

    struct stat64 st2;
    if (fstat64 (fd, &st2) != 0)
    error (1, errno, "fstat failed");

    if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
    {
    puts ("atim not reset to zero");
    status = 1;
    }
    if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
    {
    puts ("mtim not reset to zero");
    status = 1;
    }
    if (status != 0)
    goto out;

    t[0] = st1.st_atim;
    t[1].tv_sec = 0;
    t[1].tv_nsec = UTIME_OMIT;
    if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
    error (1, errno, "utimensat failed");

    if (fstat64 (fd, &st2) != 0)
    error (1, errno, "fstat failed");

    if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
    || st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
    {
    puts ("atim not set");
    status = 1;
    }
    if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
    {
    puts ("mtim changed from zero");
    status = 1;
    }
    if (status != 0)
    goto out;

    t[0].tv_sec = 0;
    t[0].tv_nsec = UTIME_OMIT;
    t[1] = st1.st_mtim;
    if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
    error (1, errno, "utimensat failed");

    if (fstat64 (fd, &st2) != 0)
    error (1, errno, "fstat failed");

    if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
    || st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
    {
    puts ("mtim changed from original time");
    status = 1;
    }
    if (st2.st_mtim.tv_sec != st1.st_mtim.tv_sec
    || st2.st_mtim.tv_nsec != st1.st_mtim.tv_nsec)
    {
    puts ("mtim not set");
    status = 1;
    }
    if (status != 0)
    goto out;

    sleep (2);

    t[0].tv_sec = 0;
    t[0].tv_nsec = UTIME_NOW;
    t[1].tv_sec = 0;
    t[1].tv_nsec = UTIME_NOW;
    if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
    error (1, errno, "utimensat failed");

    if (fstat64 (fd, &st2) != 0)
    error (1, errno, "fstat failed");

    struct timeval tv;
    gettimeofday(&tv,NULL);

    if (st2.st_atim.tv_sec tv.tv_sec)
    {
    puts ("atim not set to NOW");
    status = 1;
    }
    if (st2.st_mtim.tv_sec tv.tv_sec)
    {
    puts ("mtim not set to NOW");
    status = 1;
    }

    if (symlink ("ttt", "tttsym") != 0)
    error (1, errno, "cannot create symlink");

    t[0].tv_sec = 0;
    t[0].tv_nsec = 0;
    t[1].tv_sec = 0;
    t[1].tv_nsec = 0;
    if (syscall(__NR_utimensat, AT_FDCWD, "tttsym", t, AT_SYMLINK_NOFOLLOW) != 0)
    error (1, errno, "utimensat failed");

    if (lstat64 ("tttsym", &st2) != 0)
    error (1, errno, "lstat failed");

    if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
    {
    puts ("symlink atim not reset to zero");
    status = 1;
    }
    if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
    {
    puts ("symlink mtim not reset to zero");
    status = 1;
    }
    if (status != 0)
    goto out;

    t[0].tv_sec = 1;
    t[0].tv_nsec = 0;
    t[1].tv_sec = 1;
    t[1].tv_nsec = 0;
    if (syscall(__NR_utimensat, fd, NULL, t, 0) != 0)
    error (1, errno, "utimensat failed");

    if (fstat64 (fd, &st2) != 0)
    error (1, errno, "fstat failed");

    if (st2.st_atim.tv_sec != 1 || st2.st_atim.tv_nsec != 0)
    {
    puts ("atim not reset to one");
    status = 1;
    }
    if (st2.st_mtim.tv_sec != 1 || st2.st_mtim.tv_nsec != 0)
    {
    puts ("mtim not reset to one");
    status = 1;
    }

    if (status == 0)
    puts ("all OK");

    out:
    close (fd);
    unlink ("ttt");
    unlink ("tttsym");

    return status;
    }

    [akpm@linux-foundation.org: add missing i386 syscall table entry]
    Signed-off-by: Ulrich Drepper
    Cc: Alexey Dobriyan
    Cc: Michael Kerrisk
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ulrich Drepper
     
  • Move the timekeeping code out of kernel/timer.c and into
    kernel/time/timekeeping.c. I made no cleanups or other changes in transit.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: John Stultz
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     

17 Feb, 2007

1 commit

  • Persistent clock support: do proper timekeeping across suspend/resume.

    [bunk@stusta.de: cleanup]
    Signed-off-by: John Stultz
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Cc: Roman Zippel
    Cc: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    John Stultz
     

13 Feb, 2007

1 commit

  • ARCH_HAVE_XTIME_LOCK is used by x86_64 arch . This arch needs to place a
    read only copy of xtime_lock into vsyscall page. This read only copy is
    named __xtime_lock, and xtime_lock is defined in
    arch/x86_64/kernel/vmlinux.lds.S as an alias. So the declaration of
    xtime_lock in kernel/timer.c was guarded by ARCH_HAVE_XTIME_LOCK define,
    defined to true on x86_64.

    We can get same result with _attribute__((weak)) in the declaration. linker
    should do the job.

    Signed-off-by: Eric Dumazet
    Signed-off-by: Andi Kleen
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton

    Eric Dumazet
     

12 Feb, 2007

1 commit


15 Jul, 2006

1 commit

  • Initialization code related to collection of per-task "delay" statistics which
    measure how long it had to wait for cpu, sync block io, swapping etc. The
    collection of statistics and the interface are in other patches. This patch
    sets up the data structures and allows the statistics collection to be
    disabled through a kernel boot parameter.

    Signed-off-by: Shailabh Nagar
    Signed-off-by: Balbir Singh
    Cc: Jes Sorensen
    Cc: Peter Chubb
    Cc: Erich Focht
    Cc: Levent Serinol
    Cc: Jay Lan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shailabh Nagar
     

27 Jun, 2006

4 commits

  • * x86-64: (83 commits)
    [PATCH] x86_64: x86_64 stack usage debugging
    [PATCH] x86_64: (resend) x86_64 stack overflow debugging
    [PATCH] x86_64: msi_apic.c build fix
    [PATCH] x86_64: i386/x86-64 Add nmi watchdog support for new Intel CPUs
    [PATCH] x86_64: Avoid broadcasting NMI IPIs
    [PATCH] x86_64: fix apic error on bootup
    [PATCH] x86_64: enlarge window for stack growth
    [PATCH] x86_64: Minor string functions optimizations
    [PATCH] x86_64: Move export symbols to their C functions
    [PATCH] x86_64: Standardize i386/x86_64 handling of NMI_VECTOR
    [PATCH] x86_64: Fix modular pc speaker
    [PATCH] x86_64: remove sys32_ni_syscall()
    [PATCH] x86_64: Do not use -ffunction-sections for modules
    [PATCH] x86_64: Add cpu_relax to apic_wait_icr_idle
    [PATCH] x86_64: adjust kstack_depth_to_print default
    [PATCH] i386/x86-64: adjust /proc/interrupts column headings
    [PATCH] x86_64: Fix race in cpu_local_* on preemptible kernels
    [PATCH] x86_64: Fix fast check in safe_smp_processor_id
    [PATCH] x86_64: x86_64 setup.c - printing cmp related boottime information
    [PATCH] i386/x86-64/ia64: Move polling flag into thread_info_status
    ...

    Manual resolve of trivial conflict in arch/i386/kernel/Makefile

    Linus Torvalds
     
  • In timekeeping code, one often does need to use conversion constants. Naming
    these leads to code that's easier to understand, showing the reader between
    which units the conversion is made.

    Signed-off-by: Vojtech Pavlik
    Signed-off-by: Andi Kleen
    Signed-off-by: Linus Torvalds

    Vojtech Pavlik
     
  • Introduces clocksource switching code and the arch generic time accessor
    functions that use the clocksource infrastructure.

    Signed-off-by: John Stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     
  • Modify the update_wall_time function so it increments time using the
    clocksource abstraction instead of jiffies. Since the only clocksource driver
    currently provided is the jiffies clocksource, this should result in no
    functional change. Additionally, a timekeeping_init and timekeeping_resume
    function has been added to initialize and maintain some of the new timekeping
    state.

    [hirofumi@mail.parknet.co.jp: fixlet]
    Signed-off-by: John Stultz
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     

27 Mar, 2006

1 commit

  • nsec_t predates ktime_t and has mostly been superseded by it. In the few
    places that are left it's better to make it explicit that we're dealing with
    64 bit values here.

    Signed-off-by: Roman Zippel
    Acked-by: Thomas Gleixner
    Acked-by: John Stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roman Zippel
     

26 Mar, 2006

1 commit

  • alarm() calls the kernel with an unsigend int timeout in seconds. The
    value is stored in the tv_sec field of a struct timeval to setup the
    itimer. The tv_sec field of struct timeval is of type long, which causes
    the tv_sec value to be negative on 32 bit machines if seconds > INT_MAX.

    Before the hrtimer merge (pre 2.6.16) such a negative value was converted
    to the maximum jiffies timeout by the timeval_to_jiffies conversion. It's
    not clear whether this was intended or just happened to be done by the
    timeval_to_jiffies code.

    hrtimers expect a timeval in canonical form and treat a negative timeout as
    already expired. This breaks the legitimate usage of alarm() with a
    timeout value > INT_MAX seconds.

    For 32 bit machines it is therefor necessary to limit the internal seconds
    value to avoid API breakage. Instead of doing this in all implementations
    of sys_alarm the duplicated sys_alarm code is moved into a common function
    in itimer.c

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     

12 Feb, 2006

1 commit

  • With David Woodhouse

    select() presently has a habit of increasing the value of the user's
    `timeout' argument on return.

    We were writing back a timeout larger than the original. We _deliberately_
    round up, since we know we must wait at _least_ as long as the caller asks
    us to.

    The patch adds a couple of helper functions for magnitude comparison of
    timespecs and of timevals, and uses them to prevent the various poll and
    select functions from returning a timeout which is larger than the one which
    was passed in.

    The patch also fixes a bug in compat_sys_pselect7(): it was adding the new
    timeout value to the old one and was returning that. It should just return
    the new timeout value.

    (We have various handy timespec/timeval-to-from-nsec conversion functions in
    time.h. But this code open-codes it all).

    Cc: "David S. Miller"
    Cc: Andi Kleen
    Cc: Ulrich Drepper
    Cc: Thomas Gleixner
    Cc: george anzinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

01 Feb, 2006

1 commit


19 Jan, 2006

1 commit

  • Here is a series of patches which introduce in total 13 new system calls
    which take a file descriptor/filename pair instead of a single file
    name. These functions, openat etc, have been discussed on numerous
    occasions. They are needed to implement race-free filesystem traversal,
    they are necessary to implement a virtual per-thread current working
    directory (think multi-threaded backup software), etc.

    We have in glibc today implementations of the interfaces which use the
    /proc/self/fd magic. But this code is rather expensive. Here are some
    results (similar to what Jim Meyering posted before).

    The test creates a deep directory hierarchy on a tmpfs filesystem. Then
    rm -fr is used to remove all directories. Without syscall support I get
    this:

    real 0m31.921s
    user 0m0.688s
    sys 0m31.234s

    With syscall support the results are much better:

    real 0m20.699s
    user 0m0.536s
    sys 0m20.149s

    The interfaces are for obvious reasons currently not much used. But they'll
    be used. coreutils (and Jeff's posixutils) are already using them.
    Furthermore, code like ftw/fts in libc (maybe even glob) will also start using
    them. I expect a patch to make follow soon. Every program which is walking
    the filesystem tree will benefit.

    Signed-off-by: Ulrich Drepper
    Signed-off-by: Alexey Dobriyan
    Cc: Christoph Hellwig
    Cc: Al Viro
    Acked-by: Ingo Molnar
    Cc: Michael Kerrisk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ulrich Drepper
     

11 Jan, 2006

9 commits


13 Dec, 2005

1 commit

  • There are several functions that might seem appropriate for a timestamp:

    get_cycles()
    current_kernel_time()
    do_gettimeofday()

    Each has problems with combinations of SMP-safety, low resolution, and
    monotonicity. This patch adds a new function that returns a monotonic SMP-safe
    timestamp with nanosecond resolution where available.

    Changes:
    Split timestamp into separate patch
    Moved to kernel/time.c
    Renamed to getnstimestamp
    Fixed unintended-pointer-arithmetic bug

    Signed-off-by: Matt Helsley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matt Helsley
     

14 Nov, 2005

1 commit


11 Sep, 2005

2 commits


08 Sep, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds