Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 26 Oct 2011 15:15:03 +0000 (17:15 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 26 Oct 2011 15:15:03 +0000 (17:15 +0200)
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
  time, s390: Get rid of compile warning
  dw_apb_timer: constify clocksource name
  time: Cleanup old CONFIG_GENERIC_TIME references that snuck in
  time: Change jiffies_to_clock_t() argument type to unsigned long
  alarmtimers: Fix error handling
  clocksource: Make watchdog reset lockless
  posix-cpu-timers: Cure SMP accounting oddities
  s390: Use direct ktime path for s390 clockevent device
  clockevents: Add direct ktime programming function
  clockevents: Make minimum delay adjustments configurable
  nohz: Remove "Switched to NOHz mode" debugging messages
  proc: Consider NO_HZ when printing idle and iowait times
  nohz: Make idle/iowait counter update conditional
  nohz: Fix update_ts_time_stat idle accounting
  cputime: Clean up cputime_to_usecs and usecs_to_cputime macros
  alarmtimers: Rework RTC device selection using class interface
  alarmtimers: Add try_to_cancel functionality
  alarmtimers: Add more refined alarm state tracking
  alarmtimers: Remove period from alarm structure
  alarmtimers: Remove interval cap limit hack
  ...

1  2 
arch/arm/Kconfig
arch/mn10300/Kconfig
arch/x86/Kconfig
drivers/cpufreq/cpufreq_ondemand.c
kernel/time/tick-sched.c

diff --combined arch/arm/Kconfig
@@@ -3,7 -3,7 +3,7 @@@ config AR
        default y
        select HAVE_AOUT
        select HAVE_DMA_API_DEBUG
 -      select HAVE_IDE
 +      select HAVE_IDE if PCI || ISA || PCMCIA
        select HAVE_MEMBLOCK
        select RTC_LIB
        select SYS_SUPPORTS_APM_EMULATION
@@@ -195,8 -195,8 +195,8 @@@ config VECTORS_BAS
          The base address of exception vectors.
  
  config ARM_PATCH_PHYS_VIRT
 -      bool "Patch physical to virtual translations at runtime (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      bool "Patch physical to virtual translations at runtime" if EMBEDDED
 +      default y
        depends on !XIP_KERNEL && MMU
        depends on !ARCH_REALVIEW || !SPARSEMEM
        help
          kernel in system memory.
  
          This can only be used with non-XIP MMU kernels where the base
 -        of physical memory is at a 16MB boundary, or theoretically 64K
 -        for the MSM machine class.
 +        of physical memory is at a 16MB boundary.
  
 -config ARM_PATCH_PHYS_VIRT_16BIT
 +        Only disable this option if you know that you do not require
 +        this feature (eg, building a kernel for a single machine) and
 +        you need to shrink the kernel to the minimal size.
 +
 +
 +config GENERIC_BUG
        def_bool y
 -      depends on ARM_PATCH_PHYS_VIRT && ARCH_MSM
 -      help
 -        This option extends the physical to virtual translation patching
 -        to allow physical memory down to a theoretical minimum of 64K
 -        boundaries.
 +      depends on BUG
  
  source "init/Kconfig"
  
@@@ -302,6 -302,7 +302,6 @@@ config ARCH_AT9
        select ARCH_REQUIRE_GPIOLIB
        select HAVE_CLK
        select CLKDEV_LOOKUP
 -      select ARM_PATCH_PHYS_VIRT if MMU
        help
          This enables support for systems based on the Atmel AT91RM9200,
          AT91SAM9 and AT91CAP9 processors.
@@@ -346,7 -347,6 +346,6 @@@ config ARCH_GEMIN
  config ARCH_PRIMA2
        bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform"
        select CPU_V7
-       select GENERIC_TIME
        select NO_IOPORT
        select GENERIC_CLOCKEVENTS
        select CLKDEV_LOOKUP
@@@ -385,7 -385,6 +384,7 @@@ config ARCH_FOOTBRIDG
        select CPU_SA110
        select FOOTBRIDGE
        select GENERIC_CLOCKEVENTS
 +      select HAVE_IDE
        help
          Support for systems based on the DC21285 companion chip
          ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
@@@ -520,7 -519,6 +519,6 @@@ config ARCH_LPC32X
        select ARM_AMBA
        select USB_ARCH_HAS_OHCI
        select CLKDEV_LOOKUP
-       select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        help
          Support for the NXP LPC32XX family of processors
@@@ -599,7 -597,6 +597,6 @@@ config ARCH_TEGR
        bool "NVIDIA Tegra"
        select CLKDEV_LOOKUP
        select CLKSRC_MMIO
-       select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        select GENERIC_GPIO
        select HAVE_CLK
@@@ -632,8 -629,6 +629,8 @@@ config ARCH_PX
        select SPARSE_IRQ
        select AUTO_ZRELADDR
        select MULTI_IRQ_HANDLER
 +      select ARM_CPU_SUSPEND if PM
 +      select HAVE_IDE
        help
          Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
  
@@@ -674,7 -669,6 +671,7 @@@ config ARCH_RP
        select NO_IOPORT
        select ARCH_SPARSEMEM_ENABLE
        select ARCH_USES_GETTIMEOFFSET
 +      select HAVE_IDE
        help
          On the Acorn Risc-PC, Linux can support the internal IDE disk and
          CD-ROM interface, serial and parallel port, and the floppy drive.
@@@ -693,7 -687,6 +690,7 @@@ config ARCH_SA110
        select HAVE_SCHED_CLOCK
        select TICK_ONESHOT
        select ARCH_REQUIRE_GPIOLIB
 +      select HAVE_IDE
        help
          Support for StrongARM 11x0 based boards.
  
@@@ -727,6 -720,7 +724,6 @@@ config ARCH_S3C64X
        select ARCH_REQUIRE_GPIOLIB
        select SAMSUNG_CLKSRC
        select SAMSUNG_IRQ_VIC_TIMER
 -      select SAMSUNG_IRQ_UART
        select S3C_GPIO_TRACK
        select S3C_GPIO_PULL_UPDOWN
        select S3C_GPIO_CFG_S3C24XX
@@@ -914,7 -908,6 +911,6 @@@ config ARCH_VT850
  config ARCH_ZYNQ
        bool "Xilinx Zynq ARM Cortex A9 Platform"
        select CPU_V7
-       select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        select CLKDEV_LOOKUP
        select ARM_GIC
@@@ -1275,32 -1268,6 +1271,32 @@@ config ARM_ERRATA_75432
          This workaround defines cpu_relax() as smp_mb(), preventing correctly
          written polling loops from denying visibility of updates to memory.
  
 +config ARM_ERRATA_364296
 +      bool "ARM errata: Possible cache data corruption with hit-under-miss enabled"
 +      depends on CPU_V6 && !SMP
 +      help
 +        This options enables the workaround for the 364296 ARM1136
 +        r0p2 erratum (possible cache data corruption with
 +        hit-under-miss enabled). It sets the undocumented bit 31 in
 +        the auxiliary control register and the FI bit in the control
 +        register, thus disabling hit-under-miss without putting the
 +        processor into full low interrupt latency mode. ARM11MPCore
 +        is not affected.
 +
 +config ARM_ERRATA_764369
 +      bool "ARM errata: Data cache line maintenance operation by MVA may not succeed"
 +      depends on CPU_V7 && SMP
 +      help
 +        This option enables the workaround for erratum 764369
 +        affecting Cortex-A9 MPCore with two or more processors (all
 +        current revisions). Under certain timing circumstances, a data
 +        cache line maintenance operation by MVA targeting an Inner
 +        Shareable memory region may fail to proceed up to either the
 +        Point of Coherency or to the Point of Unification of the
 +        system. This workaround adds a DSB instruction before the
 +        relevant cache maintenance functions and sets a specific bit
 +        in the diagnostic control register of the SCU.
 +
  endmenu
  
  source "arch/arm/common/Kconfig"
@@@ -1379,7 -1346,6 +1375,7 @@@ config SM
                 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
                 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
                 ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE
 +      depends on MMU
        select USE_GENERIC_SMP_HELPERS
        select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP
        help
          processor machines. On a single processor machine, the kernel will
          run faster if you say N here.
  
 -        See also <file:Documentation/i386/IO-APIC.txt>,
 +        See also <file:Documentation/x86/i386/IO-APIC.txt>,
          <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
          <http://tldp.org/HOWTO/SMP-HOWTO.html>.
  
@@@ -1412,31 -1378,6 +1408,31 @@@ config SMP_ON_U
  
          If you don't know what to do here, say Y.
  
 +config ARM_CPU_TOPOLOGY
 +      bool "Support cpu topology definition"
 +      depends on SMP && CPU_V7
 +      default y
 +      help
 +        Support ARM cpu topology definition. The MPIDR register defines
 +        affinity between processors which is then used to describe the cpu
 +        topology of an ARM System.
 +
 +config SCHED_MC
 +      bool "Multi-core scheduler support"
 +      depends on ARM_CPU_TOPOLOGY
 +      help
 +        Multi-core scheduler support improves the CPU scheduler's decision
 +        making when dealing with multi-core CPU chips at a cost of slightly
 +        increased overhead in some places. If unsure say N here.
 +
 +config SCHED_SMT
 +      bool "SMT scheduler support"
 +      depends on ARM_CPU_TOPOLOGY
 +      help
 +        Improves the CPU scheduler's decision making when dealing with
 +        MultiThreading at a cost of slightly increased overhead in some
 +        places. If unsure say N here.
 +
  config HAVE_ARM_SCU
        bool
        help
@@@ -1512,7 -1453,6 +1508,7 @@@ config THUMB2_KERNE
        depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL
        select AEABI
        select ARM_ASM_UNIFIED
 +      select ARM_UNWIND
        help
          By enabling this option, the kernel will be compiled in
          Thumb-2 mode. A compiler/assembler that understand the unified
@@@ -2132,9 -2072,6 +2128,9 @@@ config ARCH_SUSPEND_POSSIBL
                CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE
        def_bool y
  
 +config ARM_CPU_SUSPEND
 +      def_bool PM_SLEEP
 +
  endmenu
  
  source "net/Kconfig"
diff --combined arch/mn10300/Kconfig
@@@ -47,9 -47,6 +47,6 @@@ config GENERIC_CMOS_UPDAT
  config GENERIC_HWEIGHT
        def_bool y
  
- config GENERIC_TIME
-       def_bool y
  config GENERIC_CLOCKEVENTS
        def_bool y
  
@@@ -195,7 -192,7 +192,7 @@@ config SM
          singleprocessor machines. On a singleprocessor machine, the kernel
          will run faster if you say N here.
  
 -        See also <file:Documentation/i386/IO-APIC.txt>,
 +        See also <file:Documentation/x86/i386/IO-APIC.txt>,
          <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
          <http://www.tldp.org/docs.html#howto>.
  
diff --combined arch/x86/Kconfig
@@@ -68,6 -68,7 +68,7 @@@ config X8
        select GENERIC_IRQ_PROBE
        select GENERIC_PENDING_IRQ if SMP
        select GENERIC_IRQ_SHOW
+       select GENERIC_CLOCKEVENTS_MIN_ADJUST
        select IRQ_FORCED_THREADING
        select USE_GENERIC_SMP_HELPERS if SMP
        select HAVE_BPF_JIT if (X86_64 && NET)
@@@ -130,7 -131,7 +131,7 @@@ config SBU
        bool
  
  config NEED_DMA_MAP_STATE
 -       def_bool (X86_64 || DMAR || DMA_API_DEBUG)
 +       def_bool (X86_64 || INTEL_IOMMU || DMA_API_DEBUG)
  
  config NEED_SG_DMA_LENGTH
        def_bool y
@@@ -220,7 -221,7 +221,7 @@@ config ARCH_SUPPORTS_DEBUG_PAGEALLO
  
  config HAVE_INTEL_TXT
        def_bool y
 -      depends on EXPERIMENTAL && DMAR && ACPI
 +      depends on EXPERIMENTAL && INTEL_IOMMU && ACPI
  
  config X86_32_SMP
        def_bool y
@@@ -279,7 -280,7 +280,7 @@@ config SM
          Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
          Management" code will be disabled if you say Y here.
  
 -        See also <file:Documentation/i386/IO-APIC.txt>,
 +        See also <file:Documentation/x86/i386/IO-APIC.txt>,
          <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
          <http://www.tldp.org/docs.html#howto>.
  
  
  config X86_X2APIC
        bool "Support x2apic"
 -      depends on X86_LOCAL_APIC && X86_64 && INTR_REMAP
 +      depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
        ---help---
          This enables x2apic support on CPUs that have this feature.
  
@@@ -144,10 -144,12 +144,12 @@@ static inline cputime64_t get_cpu_idle_
  
  static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
  {
-       u64 idle_time = get_cpu_idle_time_us(cpu, wall);
+       u64 idle_time = get_cpu_idle_time_us(cpu, NULL);
  
        if (idle_time == -1ULL)
                return get_cpu_idle_time_jiffy(cpu, wall);
+       else
+               idle_time += get_cpu_iowait_time_us(cpu, wall);
  
        return idle_time;
  }
@@@ -725,7 -727,7 +727,7 @@@ static int __init cpufreq_gov_dbs_init(
                dbs_tuners_ins.down_differential =
                                        MICRO_FREQUENCY_DOWN_DIFFERENTIAL;
                /*
 -               * In no_hz/micro accounting case we set the minimum frequency
 +               * In nohz/micro accounting case we set the minimum frequency
                 * not depending on HZ, but fixed (very low). The deferred
                 * timer might skip some samples if idle/sleeping as needed.
                */
diff --combined kernel/time/tick-sched.c
@@@ -139,6 -139,7 +139,6 @@@ static void tick_nohz_update_jiffies(kt
        struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
        unsigned long flags;
  
 -      cpumask_clear_cpu(cpu, nohz_cpu_mask);
        ts->idle_waketime = now;
  
        local_irq_save(flags);
@@@ -158,9 -159,10 +158,10 @@@ update_ts_time_stats(int cpu, struct ti
  
        if (ts->idle_active) {
                delta = ktime_sub(now, ts->idle_entrytime);
-               ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
                if (nr_iowait_cpu(cpu) > 0)
                        ts->iowait_sleeptime = ktime_add(ts->iowait_sleeptime, delta);
+               else
+                       ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
                ts->idle_entrytime = now;
        }
  
@@@ -196,11 -198,11 +197,11 @@@ static ktime_t tick_nohz_start_idle(in
  /**
   * get_cpu_idle_time_us - get the total idle time of a cpu
   * @cpu: CPU number to query
-  * @last_update_time: variable to store update time in
+  * @last_update_time: variable to store update time in. Do not update
+  * counters if NULL.
   *
   * Return the cummulative idle time (since boot) for a given
-  * CPU, in microseconds. The idle time returned includes
-  * the iowait time (unlike what "top" and co report).
+  * CPU, in microseconds.
   *
   * This time is measured via accounting rather than sampling,
   * and is as accurate as ktime_get() is.
  u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time)
  {
        struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+       ktime_t now, idle;
  
        if (!tick_nohz_enabled)
                return -1;
  
-       update_ts_time_stats(cpu, ts, ktime_get(), last_update_time);
+       now = ktime_get();
+       if (last_update_time) {
+               update_ts_time_stats(cpu, ts, now, last_update_time);
+               idle = ts->idle_sleeptime;
+       } else {
+               if (ts->idle_active && !nr_iowait_cpu(cpu)) {
+                       ktime_t delta = ktime_sub(now, ts->idle_entrytime);
+                       idle = ktime_add(ts->idle_sleeptime, delta);
+               } else {
+                       idle = ts->idle_sleeptime;
+               }
+       }
+       return ktime_to_us(idle);
  
-       return ktime_to_us(ts->idle_sleeptime);
  }
  EXPORT_SYMBOL_GPL(get_cpu_idle_time_us);
  
- /*
+ /**
   * get_cpu_iowait_time_us - get the total iowait time of a cpu
   * @cpu: CPU number to query
-  * @last_update_time: variable to store update time in
+  * @last_update_time: variable to store update time in. Do not update
+  * counters if NULL.
   *
   * Return the cummulative iowait time (since boot) for a given
   * CPU, in microseconds.
  u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time)
  {
        struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+       ktime_t now, iowait;
  
        if (!tick_nohz_enabled)
                return -1;
  
-       update_ts_time_stats(cpu, ts, ktime_get(), last_update_time);
+       now = ktime_get();
+       if (last_update_time) {
+               update_ts_time_stats(cpu, ts, now, last_update_time);
+               iowait = ts->iowait_sleeptime;
+       } else {
+               if (ts->idle_active && nr_iowait_cpu(cpu) > 0) {
+                       ktime_t delta = ktime_sub(now, ts->idle_entrytime);
  
-       return ktime_to_us(ts->iowait_sleeptime);
+                       iowait = ktime_add(ts->iowait_sleeptime, delta);
+               } else {
+                       iowait = ts->iowait_sleeptime;
+               }
+       }
+       return ktime_to_us(iowait);
  }
  EXPORT_SYMBOL_GPL(get_cpu_iowait_time_us);
  
@@@ -388,6 -418,9 +417,6 @@@ void tick_nohz_stop_sched_tick(int inid
                else
                        expires.tv64 = KTIME_MAX;
  
 -              if (delta_jiffies > 1)
 -                      cpumask_set_cpu(cpu, nohz_cpu_mask);
 -
                /* Skip reprogram of event if its not changed */
                if (ts->tick_stopped && ktime_equal(expires, dev->next_event))
                        goto out;
                 * softirq.
                 */
                tick_do_update_jiffies64(ktime_get());
 -              cpumask_clear_cpu(cpu, nohz_cpu_mask);
        }
        raise_softirq_irqoff(TIMER_SOFTIRQ);
  out:
@@@ -519,6 -553,7 +548,6 @@@ void tick_nohz_restart_sched_tick(void
        /* Update jiffies first */
        select_nohz_load_balancer(0);
        tick_do_update_jiffies64(now);
 -      cpumask_clear_cpu(cpu, nohz_cpu_mask);
  
  #ifndef CONFIG_VIRT_CPU_ACCOUNTING
        /*
@@@ -634,8 -669,6 +663,6 @@@ static void tick_nohz_switch_to_nohz(vo
                next = ktime_add(next, tick_period);
        }
        local_irq_enable();
-       printk(KERN_INFO "Switched to NOHz mode on CPU #%d\n", smp_processor_id());
  }
  
  /*
@@@ -787,10 -820,8 +814,8 @@@ void tick_setup_sched_timer(void
        }
  
  #ifdef CONFIG_NO_HZ
-       if (tick_nohz_enabled) {
+       if (tick_nohz_enabled)
                ts->nohz_mode = NOHZ_MODE_HIGHRES;
-               printk(KERN_INFO "Switched to NOHz mode on CPU #%d\n", smp_processor_id());
-       }
  #endif
  }
  #endif /* HIGH_RES_TIMERS */