Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Feb 2017 18:06:32 +0000 (10:06 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Feb 2017 18:06:32 +0000 (10:06 -0800)
Pull timer updates from Thomas Gleixner:
 "Nothing exciting, just the usual pile of fixes, updates and cleanups:

   - A bunch of clocksource driver updates

   - Removal of CONFIG_TIMER_STATS and the related /proc file

   - More posix timer slim down work

   - A scalability enhancement in the tick broadcast code

   - Math cleanups"

* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
  hrtimer: Catch invalid clockids again
  math64, tile: Fix build failure
  clocksource/drivers/arm_arch_timer:: Mark cyclecounter __ro_after_init
  timerfd: Protect the might cancel mechanism proper
  timer_list: Remove useless cast when printing
  time: Remove CONFIG_TIMER_STATS
  clocksource/drivers/arm_arch_timer: Work around Hisilicon erratum 161010101
  clocksource/drivers/arm_arch_timer: Introduce generic errata handling infrastructure
  clocksource/drivers/arm_arch_timer: Remove fsl-a008585 parameter
  clocksource/drivers/arm_arch_timer: Add dt binding for hisilicon-161010101 erratum
  clocksource/drivers/ostm: Add renesas-ostm timer driver
  clocksource/drivers/ostm: Document renesas-ostm timer DT bindings
  clocksource/drivers/tcb_clksrc: Use 32 bit tcb as sched_clock
  clocksource/drivers/gemini: Add driver for the Cortina Gemini
  clocksource: add DT bindings for Cortina Gemini
  clockevents: Add a clkevt-of mechanism like clksrc-of
  tick/broadcast: Reduce lock cacheline contention
  timers: Omit POSIX timer stuff from task_struct when disabled
  x86/timer: Make delay() work during early bootup
  delay: Add explanation of udelay() inaccuracy
  ...

1  2 
fs/proc/base.c
include/linux/cpumask.h
kernel/time/tick-broadcast.c

diff --combined fs/proc/base.c
index 87c9a9aacda3601e2686e239243f447728137943,03deeac1e835d3cfbb8841fe78fdc5c5a3c789be..b1f7d30e96c27aa5d3e2a9abe0052e123087a448
@@@ -2179,7 -2179,7 +2179,7 @@@ static const struct file_operations pro
        .llseek         = generic_file_llseek,
  };
  
- #ifdef CONFIG_CHECKPOINT_RESTORE
+ #if defined(CONFIG_CHECKPOINT_RESTORE) && defined(CONFIG_POSIX_TIMERS)
  struct timers_private {
        struct pid *pid;
        struct task_struct *task;
@@@ -2936,7 -2936,7 +2936,7 @@@ static const struct pid_entry tgid_base
        REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
        REG("setgroups",  S_IRUGO|S_IWUSR, proc_setgroups_operations),
  #endif
- #ifdef CONFIG_CHECKPOINT_RESTORE
+ #if defined(CONFIG_CHECKPOINT_RESTORE) && defined(CONFIG_POSIX_TIMERS)
        REG("timers",     S_IRUGO, proc_timers_operations),
  #endif
        REG("timerslack_ns", S_IRUGO|S_IWUGO, proc_pid_set_timerslack_ns_operations),
@@@ -3179,8 -3179,6 +3179,8 @@@ int proc_pid_readdir(struct file *file
             iter.tgid += 1, iter = next_tgid(ns, iter)) {
                char name[PROC_NUMBUF];
                int len;
 +
 +              cond_resched();
                if (!has_pid_permissions(ns, iter.task, 2))
                        continue;
  
diff --combined include/linux/cpumask.h
index b3d2c1a89ac48fb8257c32cf070e551f1cc22c4e,23c1a6d09ec56a697881b48f9a467577ab0199e2..96f1e88b767c0058bee7f3dbcc0d175e68735cfe
@@@ -560,7 -560,7 +560,7 @@@ static inline void cpumask_copy(struct 
  static inline int cpumask_parse_user(const char __user *buf, int len,
                                     struct cpumask *dstp)
  {
 -      return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpu_ids);
 +      return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
  }
  
  /**
@@@ -575,7 -575,7 +575,7 @@@ static inline int cpumask_parselist_use
                                     struct cpumask *dstp)
  {
        return bitmap_parselist_user(buf, len, cpumask_bits(dstp),
 -                                   nr_cpu_ids);
 +                                   nr_cpumask_bits);
  }
  
  /**
@@@ -590,7 -590,7 +590,7 @@@ static inline int cpumask_parse(const c
        char *nl = strchr(buf, '\n');
        unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
  
 -      return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpu_ids);
 +      return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
  }
  
  /**
   */
  static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
  {
 -      return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpu_ids);
 +      return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits);
  }
  
  /**
@@@ -649,11 -649,15 +649,15 @@@ static inline size_t cpumask_size(void
   * used. Please use this_cpu_cpumask_var_t in those cases. The direct use
   * of this_cpu_ptr() or this_cpu_read() will lead to failures when the
   * other type of cpumask_var_t implementation is configured.
+  *
+  * Please also note that __cpumask_var_read_mostly can be used to declare
+  * a cpumask_var_t variable itself (not its content) as read mostly.
   */
  #ifdef CONFIG_CPUMASK_OFFSTACK
  typedef struct cpumask *cpumask_var_t;
  
- #define this_cpu_cpumask_var_ptr(x) this_cpu_read(x)
+ #define this_cpu_cpumask_var_ptr(x)   this_cpu_read(x)
+ #define __cpumask_var_read_mostly     __read_mostly
  
  bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
  bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
@@@ -667,6 -671,7 +671,7 @@@ void free_bootmem_cpumask_var(cpumask_v
  typedef struct cpumask cpumask_var_t[1];
  
  #define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x)
+ #define __cpumask_var_read_mostly
  
  static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
  {
index 17ac99b60ee58e78975d415f34ddc4ce5a2e5342,244c93544150be2c72ba5b39cd85dbb417ea3dc6..987e496bb51a9cc84c92bedc62cf8d69e8e85668
   */
  
  static struct tick_device tick_broadcast_device;
- static cpumask_var_t tick_broadcast_mask;
- static cpumask_var_t tick_broadcast_on;
- static cpumask_var_t tmpmask;
- static DEFINE_RAW_SPINLOCK(tick_broadcast_lock);
+ static cpumask_var_t tick_broadcast_mask __cpumask_var_read_mostly;
+ static cpumask_var_t tick_broadcast_on __cpumask_var_read_mostly;
+ static cpumask_var_t tmpmask __cpumask_var_read_mostly;
  static int tick_broadcast_forced;
  
+ static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock);
  #ifdef CONFIG_TICK_ONESHOT
  static void tick_broadcast_clear_oneshot(int cpu);
  static void tick_resume_broadcast_oneshot(struct clock_event_device *bc);
@@@ -347,16 -348,17 +348,16 @@@ static void tick_handle_periodic_broadc
   *
   * Called when the system enters a state where affected tick devices
   * might stop. Note: TICK_BROADCAST_FORCE cannot be undone.
 - *
 - * Called with interrupts disabled, so clockevents_lock is not
 - * required here because the local clock event device cannot go away
 - * under us.
   */
  void tick_broadcast_control(enum tick_broadcast_mode mode)
  {
        struct clock_event_device *bc, *dev;
        struct tick_device *td;
        int cpu, bc_stopped;
 +      unsigned long flags;
  
 +      /* Protects also the local clockevent device. */
 +      raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
        td = this_cpu_ptr(&tick_cpu_device);
        dev = td->evtdev;
  
         * Is the device not affected by the powerstate ?
         */
        if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP))
 -              return;
 +              goto out;
  
        if (!tick_device_is_functional(dev))
 -              return;
 +              goto out;
  
 -      raw_spin_lock(&tick_broadcast_lock);
        cpu = smp_processor_id();
        bc = tick_broadcast_device.evtdev;
        bc_stopped = cpumask_empty(tick_broadcast_mask);
                                tick_broadcast_setup_oneshot(bc);
                }
        }
 -      raw_spin_unlock(&tick_broadcast_lock);
 +out:
 +      raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  }
  EXPORT_SYMBOL_GPL(tick_broadcast_control);
  
@@@ -516,9 -518,9 +517,9 @@@ void tick_resume_broadcast(void
  
  #ifdef CONFIG_TICK_ONESHOT
  
- static cpumask_var_t tick_broadcast_oneshot_mask;
- static cpumask_var_t tick_broadcast_pending_mask;
- static cpumask_var_t tick_broadcast_force_mask;
+ static cpumask_var_t tick_broadcast_oneshot_mask __cpumask_var_read_mostly;
+ static cpumask_var_t tick_broadcast_pending_mask __cpumask_var_read_mostly;
+ static cpumask_var_t tick_broadcast_force_mask __cpumask_var_read_mostly;
  
  /*
   * Exposed for debugging: see timer_list.c