26 Mar, 2008

1 commit

  • Revert

    commit 1077f5a917b7c630231037826b344b2f7f5b903f
    Author: Parag Warudkar
    Date: Wed Jan 30 13:30:01 2008 +0100

    clocksource.c: use init_timer_deferrable for clocksource_watchdog

    clocksource_watchdog can use a deferrable timer - reduces wakeups from
    idle per second.

    The watchdog timer needs to run with the specified interval. Otherwise
    it will miss the possible wrap of the watchdog clocksource.

    Signed-off-by: Thomas Gleixner
    Cc: stable@kernel.org

    Thomas Gleixner
     

25 Mar, 2008

1 commit


20 Mar, 2008

1 commit

  • Revert commit 1ada5cba6a0318f90e45b38557e7b5206a9cba38 ("clocksource:
    make clocksource watchdog cycle through online CPUs") due to the
    regression reported by Gabriel C at

    http://lkml.org/lkml/2008/2/24/281

    (short vesion: it makes TSC be marked as always unstable on his
    machine).

    Cc: Andi Kleen
    Acked-by: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Robert Hancock
    Acked-by: Linus Torvalds
    Cc: "Rafael J. Wysocki"
    Cc: Gabriel C
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

09 Mar, 2008

3 commits

  • The first version of the ntp_interval/tick_length inconsistent usage patch was
    recently merged as bbe4d18ac2e058c56adb0cd71f49d9ed3216a405

    http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bbe4d18ac2e058c56adb0cd71f49d9ed3216a405

    While the fix did greatly improve the situation, it was correctly pointed out
    by Roman that it does have a small bug: If the users change clocksources after
    the system has been running and NTP has made corrections, the correctoins made
    against the old clocksource will be applied against the new clocksource,
    causing error.

    The second attempt, which corrects the issue in the NTP_INTERVAL_LENGTH
    definition has also made it up-stream as commit
    e13a2e61dd5152f5499d2003470acf9c838eab84

    http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e13a2e61dd5152f5499d2003470acf9c838eab84

    Roman has correctly pointed out that CLOCK_TICK_ADJUST is calculated
    based on the PIT's frequency, and isn't really relevant to non-PIT
    driven clocksources (that is, clocksources other then jiffies and pit).

    This patch reverts both of those changes, and simply removes
    CLOCK_TICK_ADJUST.

    This does remove the granularity error correction for users of PIT and Jiffies
    clocksource users, but the granularity error but for the majority of users, it
    should be within the 500ppm range NTP can accommodate for.

    For systems that have granularity errors greater then 500ppm, the
    "ntp_tick_adj=" boot option can be used to compensate.

    [johnstul@us.ibm.com: provided changelog]
    [mattilinnanvuori@yahoo.com: maek ntp_tick_adj static]
    Signed-off-by: Roman Zippel
    Acked-by: john stultz
    Signed-off-by: Matti Linnanvuori
    Signed-off-by: Andrew Morton
    Cc: mingo@elte.hu
    Signed-off-by: Thomas Gleixner

    Roman Zippel
     
  • Silences WARN_ONs in rcu_enter_nohz() and rcu_exit_nohz(), which appeared
    before caused by (repeated) calls to:
    $ echo 0 > /sys/devices/system/cpu/cpu1/online
    $ echo 1 > /sys/devices/system/cpu/cpu1/online

    Signed-off-by: Karsten Wiese
    Cc: johnstul@us.ibm.com
    Cc: Rafael Wysocki
    Cc: Steven Rostedt
    Cc: Ingo Molnar
    Acked-by: Paul E. McKenney
    Signed-off-by: Andrew Morton
    Signed-off-by: Thomas Gleixner

    Karsten Wiese
     
  • The kernel NTP code shouldn't hand 64-bit *signed* values to do_div(). Make it
    instead hand 64-bit unsigned values. This gets rid of a couple of warnings.

    Signed-off-by: David Howells
    Cc: Roman Zippel
    Cc: Ingo Molnar
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Thomas Gleixner

    David Howells
     

01 Mar, 2008

1 commit

  • The PREEMPT-RCU can get stuck if a CPU goes idle and NO_HZ is set. The
    idle CPU will not progress the RCU through its grace period and a
    synchronize_rcu my get stuck. Without this patch I have a box that will
    not boot when PREEMPT_RCU and NO_HZ are set. That same box boots fine
    with this patch.

    This patch comes from the -rt kernel where it has been tested for
    several months.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Paul E. McKenney
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

18 Feb, 2008

1 commit


10 Feb, 2008

1 commit

  • clocksource initialization and error accumulation. This corrects a 280ppm
    drift seen on some systems using acpi_pm, and affects other clocksources as
    well (likely to a lesser degree).

    Signed-off-by: John Stultz
    Cc: Roman Zippel
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    john stultz
     

09 Feb, 2008

4 commits

  • Fix typo in comments.

    BTW: I have to fix coding style in arch/ia64/kernel/time.c also, otherwise
    checkpatch.pl will be complaining.

    Signed-off-by: Li Zefan
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Li Zefan
     
  • Function timekeeping_is_continuous() no longer checks flag
    CLOCK_IS_CONTINUOUS, and it checks CLOCK_SOURCE_VALID_FOR_HRES now. So rename
    the function accordingly.

    Signed-off-by: Li Zefan
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Li Zefan
     
  • list_for_each_safe() suffices here.

    Signed-off-by: Li Zefan
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Li Zefan
     
  • Flag CLOCK_SOURCE_WATCHDOG is cleared twice. Note clocksource_change_rating()
    won't do anyting with the cs flag.

    Signed-off-by: Li Zefan
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Li Zefan
     

07 Feb, 2008

1 commit

  • I found that there is a buffer overflow problem in the following code.

    Version: 2.6.24-rc2,
    File: kernel/time/clocksource.c:417-432
    --------------------------------------------------------------------
    static ssize_t
    sysfs_show_available_clocksources(struct sys_device *dev, char *buf)
    {
    struct clocksource *src;
    char *curr = buf;

    spin_lock_irq(&clocksource_lock);
    list_for_each_entry(src, &clocksource_list, list) {
    curr += sprintf(curr, "%s ", src->name);
    }
    spin_unlock_irq(&clocksource_lock);

    curr += sprintf(curr, "\n");

    return curr - buf;
    }
    -----------------------------------------------------------------------

    sysfs_show_current_clocksources() also has the same problem though in practice
    the size of current clocksource's name won't exceed PAGE_SIZE.

    I fix the bug by using snprintf according to the specification of the kernel
    (Version:2.6.24-rc2,File:Documentation/filesystems/sysfs.txt)

    Fix sysfs_show_available_clocksources() and sysfs_show_current_clocksources()
    buffer overflow problem with snprintf().

    Signed-off-by: Miao Xie
    Cc: WANG Cong
    Cc: Thomas Gleixner
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miao Xie
     

02 Feb, 2008

2 commits

  • To allow better diagnosis of tick-sched related, especially NOHZ
    related problems, we need to know when the last wakeup via an irq
    happened and when the CPU left the idle state.

    Add two fields (idle_waketime, idle_exittime) to the tick_sched
    structure and add them to the timer_list output.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     
  • xtime_cache needs to be updated whenever xtime and or wall_to_monotic
    are changed. Otherwise users of xtime_cache might see a stale (and in
    the case of timezone changes utterly wrong) value until the next
    update happens.

    Fixup the obvious places, which miss this update.

    Signed-off-by: Thomas Gleixner
    Acked-by: John Stultz
    Tested-by: Dhaval Giani
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

30 Jan, 2008

10 commits

  • Current idle time in kstat is based on jiffies and is coarse grained.
    tick_sched.idle_sleeptime is making some attempt to keep track of idle time
    in a fine grained manner. But, it is not handling the time spent in
    interrupts fully.

    Make tick_sched.idle_sleeptime accurate with respect to time spent on
    handling interrupts and also add tick_sched.idle_lastupdate, which keeps
    track of last time when idle_sleeptime was updated.

    This statistics will be crucial for cpufreq-ondemand governor, which can
    shed some conservative gaurd band that is uses today while setting the
    frequency. The ondemand changes that uses the exact idle time is coming
    soon.

    Signed-off-by: Venkatesh Pallipadi
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Venki Pallipadi
     
  • I recently noticed on one of my boxes that when synched with an NTP
    server, the drift value reported for the system was ~283ppm. While in
    some cases, clock hardware can be that bad, it struck me as unusual as
    the system was using the acpi_pm clocksource, which is one of the more
    trustworthy and accurate clocksources on x86 hardware.

    I brought up another system and let it sync to the same NTP server, and
    I noticed a similar 280some ppm drift.

    In looking at the code, I found that the acpi_pm's constant frequency
    was being computed correctly at boot-up, however once the system was up,
    even without the ntp daemon running, the clocksource's frequency was
    being modified by the clocksource_adjust() function.

    Digging deeper, I realized that in the code that keeps track of how much
    the clocksource is skewing from the ntp desired time, we were using
    different lengths to establish how long an time interval was.

    The clocksource was being setup with the following interval:
    NTP_INTERVAL_LENGTH = NSEC_PER_SEC/NTP_INTERVAL_FREQ

    While the ntp code was using the tick_length_base value:
    tick_length_base ~= (tick_usec * NSEC_PER_USEC * USER_HZ)
    /NTP_INTERVAL_FREQ

    The subtle difference is:
    (tick_usec * NSEC_PER_USEC * USER_HZ) != NSEC_PER_SEC

    This difference in calculation was causing the clocksource correction
    code to apply a correction factor to the clocksource so the two
    intervals were the same, however this results in the actual frequency of
    the clocksource to be made incorrect. I believe this difference would
    affect all clocksources, although to differing degrees depending on the
    clocksource resolution.

    The issue was introduced when my HZ free ntp patch landed in 2.6.21-rc1,
    so my apologies for the mistake, and for not noticing it until now.

    The following patch, corrects the clocksource's initialization code so
    it uses the same interval length as the code in ntp.c. After applying
    this patch, the drift value for the same system went from ~283ppm to
    only 2.635ppm.

    I believe this patch to be good, however it does affect all arches and
    I've only tested on x86, so some caution is advised. I do think it would
    be a likely candidate for a stable 2.6.24.x release.

    Any thoughts or feedback would be appreciated.

    Signed-off-by: John Stultz
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    john stultz
     
  • detect zero event-device multiplicators - they then cause
    division-by-zero crashes if a clockevent has been initialized
    incorrectly.

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Ingo Molnar
     
  • On x86 the PIT might become an unusable clocksource. Add an unregister
    function to provide a possibilty to remove the PIT from the list of
    available clock sources.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     
  • This way it checks if the clocks are synchronized between CPUs too.
    This might be able to detect slowly drifting TSCs which only
    go wrong over longer time.

    Signed-off-by: Andi Kleen
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Andi Kleen
     
  • clocksource_watchdog can use a deferrable timer - reduces wakeups from
    idle per second.

    Signed-off-by: Parag Warudkar
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Parag Warudkar
     
  • - getnstimeofday() was just a wrapper around __get_realtime_clock_ts()
    - Replace calls to __get_realtime_clock_ts() by calls to getnstimeofday()
    - Fix bogus reference to get_realtime_clock_ts(), which never existed

    Signed-off-by: Geert Uytterhoeven
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Geert Uytterhoeven
     
  • clean up tick-broadcast.c

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     
  • I was confused by FSEC = 10^15 NSEC statement, plus small whitespace
    fixes. When there's copyright, there should be GPL.

    Signed-off-by: Pavel Machek
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Pavel Machek
     
  • Small cleanups to tick-related code. Wrong preempt count is followed
    by BUG(), so it is hardly KERN_WARNING.

    Signed-off-by: Pavel Machek
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Pavel Machek
     

26 Jan, 2008

2 commits


25 Jan, 2008

1 commit


19 Dec, 2007

1 commit

  • Resolve the following regression of a choppy, almost unusable laptop:

    http://lkml.org/lkml/2007/12/7/299
    http://bugzilla.kernel.org/show_bug.cgi?id=9525

    A previous version of the code did the reprogramming of the broadcast
    device in the return from idle code. This was removed, but the logic in
    tick_handle_oneshot_broadcast() was kept the same.

    When a broadcast interrupt happens we signal the expiry to all CPUs
    which have an expired event. If none of the CPUs has an expired event,
    which can happen in dyntick mode, then we reprogram the broadcast
    device. We do not reprogram otherwise, but this is only correct if all
    CPUs, which are in the idle broadcast state have been woken up.

    The code ignores, that there might be pending not yet expired events on
    other CPUs, which are in the idle broadcast state. So the delivery of
    those events can be delayed for quite a time.

    Change the tick_handle_oneshot_broadcast() function to check for CPUs,
    which are in broadcast state and are not woken up by the current event,
    and enforce the rearming of the broadcast device for those CPUs.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

08 Dec, 2007

1 commit


28 Nov, 2007

1 commit

  • David Miller reported soft lockup false-positives that trigger
    on NOHZ due to CPUs idling for more than 10 seconds.

    The solution is touch the softlockup watchdog when we return from
    idle. (by definition we are not 'locked up' when we were idle)

    http://bugzilla.kernel.org/show_bug.cgi?id=9409

    Reported-by: David Miller
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

27 Nov, 2007

1 commit

  • Michael Kerrisk reported that a long standing bug in the adjtimex()
    system call causes glibc's adjtime(3) function to deliver the wrong
    results if 'delta' is NULL.

    add the ADJ_OFFSET_SS_READ API detail, which will be used by glibc
    to fix this API compatibility bug.

    Also see: http://bugzilla.kernel.org/show_bug.cgi?id=6761

    [ mingo@elte.hu: added patch description and made it backwards compatible ]

    NOTE: the new flag is defined 0xa001 so that it returns -EINVAL on
    older kernels - this way glibc can use it safely. Suggested by Ulrich
    Drepper.

    Acked-by: Ulrich Drepper
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    John Stultz
     

17 Nov, 2007

1 commit

  • Fix a typo in ntp.c that has caused updating of the persistent (RTC)
    clock when synced to NTP to behave erratically.

    When debugging a freeze that arises on my AMD64 machines when I
    run the ntpd service, I added a number of printk's to monitor the
    sync_cmos_clock procedure. I discovered that it was not syncing to
    cmos RTC every 11 minutes as documented, but instead would keep trying
    every second for hours at a time. The reason turned out to be a typo
    in sync_cmos_clock, where it attempts to ensure that
    update_persistent_clock is called very close to 500 msec. after a 1
    second boundary (required by the PC RTC's spec). That typo referred to
    "xtime" in one spot, rather than "now", which is derived from "xtime"
    but not equal to it. This makes the test erratic, creating a
    "coin-flip" that decides when update_persistent_clock is called - when
    it is called, which is rarely, it may be at any time during the one
    second period, rather than close to 500 msec, so the value written is
    needlessly incorrect, too.

    Signed-off-by: David P. Reed
    Signed-off-by: Thomas Gleixner

    David P. Reed
     

06 Nov, 2007

1 commit


29 Oct, 2007

2 commits


20 Oct, 2007

2 commits

  • * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (41 commits)
    ACPICA: hw: Don't carry spinlock over suspend
    ACPICA: hw: remove use_lock flag from acpi_hw_register_{read, write}
    ACPI: cpuidle: port idle timer suspend/resume workaround to cpuidle
    ACPI: clean up acpi_enter_sleep_state_prep
    Hibernation: Make sure that ACPI is enabled in acpi_hibernation_finish
    ACPI: suppress uninitialized var warning
    cpuidle: consolidate 2.6.22 cpuidle branch into one patch
    ACPI: thinkpad-acpi: skip blanks before the data when parsing sysfs
    ACPI: AC: Add sysfs interface
    ACPI: SBS: Add sysfs alarm
    ACPI: SBS: Add ACPI_PROCFS around procfs handling code.
    ACPI: SBS: Add support for power_supply class (and sysfs)
    ACPI: SBS: Make SBS reads table-driven.
    ACPI: SBS: Simplify data structures in SBS
    ACPI: SBS: Split host controller (ACPI0001) from SBS driver (ACPI0002)
    ACPI: EC: Add new query handler to list head.
    ACPI: Add acpi_bus_generate_event4() function
    ACPI: Battery: add sysfs alarm
    ACPI: Battery: Add sysfs support
    ACPI: Battery: Misc clean-ups, no functional changes
    ...

    Fix up conflicts in drivers/misc/thinkpad_acpi.[ch] manually

    Linus Torvalds
     
  • kernel/time/clocksource.c: Convert list_for_each to
    list_for_each_entry in clocksource_resume(),
    sysfs_override_clocksource() and show_available_clocksources()

    Signed-off-by: Matthias Kaehlcke
    Acked-by: Thomas Gleixner
    Cc: john stultz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthias Kaehlcke
     

18 Oct, 2007

1 commit