Commit 3386c05bdbd3e60ca7158253442f0a00133db28e

Authored by Linus Torvalds

Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel…

…/git/tip/linux-2.6-tip

* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  debugobjects: add and use INIT_WORK_ON_STACK
  rcu: remove duplicate CONFIG_RCU_CPU_STALL_DETECTOR
  relay: fix lock imbalance in relay_late_setup_files
  oprofile: fix uninitialized use of struct op_entry
  rcu: move Kconfig menu
  softlock: fix false panic which can occur if softlockup_thresh is reduced
  rcu: add __cpuinit to rcu_init_percpu_data()

Showing 12 changed files Side-by-side Diff

arch/x86/kernel/hpet.c
... ... @@ -633,6 +633,7 @@
633 633 /* FIXME: add schedule_work_on() */
634 634 schedule_delayed_work_on(cpu, &work.work, 0);
635 635 wait_for_completion(&work.complete);
  636 + destroy_timer_on_stack(&work.work.timer);
636 637 break;
637 638 case CPU_DEAD:
638 639 if (hdev) {
drivers/oprofile/cpu_buffer.c
... ... @@ -393,16 +393,21 @@
393 393 return;
394 394  
395 395 fail:
  396 + entry->event = NULL;
396 397 cpu_buf->sample_lost_overflow++;
397 398 }
398 399  
399 400 int oprofile_add_data(struct op_entry *entry, unsigned long val)
400 401 {
  402 + if (!entry->event)
  403 + return 0;
401 404 return op_cpu_buffer_add_data(entry, val);
402 405 }
403 406  
404 407 int oprofile_write_commit(struct op_entry *entry)
405 408 {
  409 + if (!entry->event)
  410 + return -EINVAL;
406 411 return op_cpu_buffer_write_commit(entry);
407 412 }
408 413  
drivers/oprofile/cpu_buffer.h
... ... @@ -66,6 +66,13 @@
66 66 cpu_buf->last_task = NULL;
67 67 }
68 68  
  69 +/*
  70 + * op_cpu_buffer_add_data() and op_cpu_buffer_write_commit() may be
  71 + * called only if op_cpu_buffer_write_reserve() did not return NULL or
  72 + * entry->event != NULL, otherwise entry->size or entry->event will be
  73 + * used uninitialized.
  74 + */
  75 +
69 76 struct op_sample
70 77 *op_cpu_buffer_write_reserve(struct op_entry *entry, unsigned long size);
71 78 int op_cpu_buffer_write_commit(struct op_entry *entry);
include/linux/sched.h
... ... @@ -293,6 +293,9 @@
293 293 extern void softlockup_tick(void);
294 294 extern void touch_softlockup_watchdog(void);
295 295 extern void touch_all_softlockup_watchdogs(void);
  296 +extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
  297 + struct file *filp, void __user *buffer,
  298 + size_t *lenp, loff_t *ppos);
296 299 extern unsigned int softlockup_panic;
297 300 extern unsigned long sysctl_hung_task_check_count;
298 301 extern unsigned long sysctl_hung_task_timeout_secs;
include/linux/workqueue.h
... ... @@ -130,6 +130,12 @@
130 130 init_timer_deferrable(&(_work)->timer); \
131 131 } while (0)
132 132  
  133 +#define INIT_DELAYED_WORK_ON_STACK(_work, _func) \
  134 + do { \
  135 + INIT_WORK(&(_work)->work, (_func)); \
  136 + init_timer_on_stack(&(_work)->timer); \
  137 + } while (0)
  138 +
133 139 /**
134 140 * work_pending - Find out whether a work item is currently pending
135 141 * @work: The work item in question
... ... @@ -238,6 +238,98 @@
238 238 def_bool y
239 239 depends on AUDITSYSCALL && INOTIFY
240 240  
  241 +menu "RCU Subsystem"
  242 +
  243 +choice
  244 + prompt "RCU Implementation"
  245 + default CLASSIC_RCU
  246 +
  247 +config CLASSIC_RCU
  248 + bool "Classic RCU"
  249 + help
  250 + This option selects the classic RCU implementation that is
  251 + designed for best read-side performance on non-realtime
  252 + systems.
  253 +
  254 + Select this option if you are unsure.
  255 +
  256 +config TREE_RCU
  257 + bool "Tree-based hierarchical RCU"
  258 + help
  259 + This option selects the RCU implementation that is
  260 + designed for very large SMP system with hundreds or
  261 + thousands of CPUs.
  262 +
  263 +config PREEMPT_RCU
  264 + bool "Preemptible RCU"
  265 + depends on PREEMPT
  266 + help
  267 + This option reduces the latency of the kernel by making certain
  268 + RCU sections preemptible. Normally RCU code is non-preemptible, if
  269 + this option is selected then read-only RCU sections become
  270 + preemptible. This helps latency, but may expose bugs due to
  271 + now-naive assumptions about each RCU read-side critical section
  272 + remaining on a given CPU through its execution.
  273 +
  274 +endchoice
  275 +
  276 +config RCU_TRACE
  277 + bool "Enable tracing for RCU"
  278 + depends on TREE_RCU || PREEMPT_RCU
  279 + help
  280 + This option provides tracing in RCU which presents stats
  281 + in debugfs for debugging RCU implementation.
  282 +
  283 + Say Y here if you want to enable RCU tracing
  284 + Say N if you are unsure.
  285 +
  286 +config RCU_FANOUT
  287 + int "Tree-based hierarchical RCU fanout value"
  288 + range 2 64 if 64BIT
  289 + range 2 32 if !64BIT
  290 + depends on TREE_RCU
  291 + default 64 if 64BIT
  292 + default 32 if !64BIT
  293 + help
  294 + This option controls the fanout of hierarchical implementations
  295 + of RCU, allowing RCU to work efficiently on machines with
  296 + large numbers of CPUs. This value must be at least the cube
  297 + root of NR_CPUS, which allows NR_CPUS up to 32,768 for 32-bit
  298 + systems and up to 262,144 for 64-bit systems.
  299 +
  300 + Select a specific number if testing RCU itself.
  301 + Take the default if unsure.
  302 +
  303 +config RCU_FANOUT_EXACT
  304 + bool "Disable tree-based hierarchical RCU auto-balancing"
  305 + depends on TREE_RCU
  306 + default n
  307 + help
  308 + This option forces use of the exact RCU_FANOUT value specified,
  309 + regardless of imbalances in the hierarchy. This is useful for
  310 + testing RCU itself, and might one day be useful on systems with
  311 + strong NUMA behavior.
  312 +
  313 + Without RCU_FANOUT_EXACT, the code will balance the hierarchy.
  314 +
  315 + Say N if unsure.
  316 +
  317 +config TREE_RCU_TRACE
  318 + def_bool RCU_TRACE && TREE_RCU
  319 + select DEBUG_FS
  320 + help
  321 + This option provides tracing for the TREE_RCU implementation,
  322 + permitting Makefile to trivially select kernel/rcutree_trace.c.
  323 +
  324 +config PREEMPT_RCU_TRACE
  325 + def_bool RCU_TRACE && PREEMPT_RCU
  326 + select DEBUG_FS
  327 + help
  328 + This option provides tracing for the PREEMPT_RCU implementation,
  329 + permitting Makefile to trivially select kernel/rcupreempt_trace.c.
  330 +
  331 +endmenu # "RCU Subsystem"
  332 +
241 333 config IKCONFIG
242 334 tristate "Kernel .config support"
243 335 ---help---
... ... @@ -971,92 +1063,4 @@
971 1063  
972 1064 config PREEMPT_NOTIFIERS
973 1065 bool
974   -
975   -choice
976   - prompt "RCU Implementation"
977   - default CLASSIC_RCU
978   -
979   -config CLASSIC_RCU
980   - bool "Classic RCU"
981   - help
982   - This option selects the classic RCU implementation that is
983   - designed for best read-side performance on non-realtime
984   - systems.
985   -
986   - Select this option if you are unsure.
987   -
988   -config TREE_RCU
989   - bool "Tree-based hierarchical RCU"
990   - help
991   - This option selects the RCU implementation that is
992   - designed for very large SMP system with hundreds or
993   - thousands of CPUs.
994   -
995   -config PREEMPT_RCU
996   - bool "Preemptible RCU"
997   - depends on PREEMPT
998   - help
999   - This option reduces the latency of the kernel by making certain
1000   - RCU sections preemptible. Normally RCU code is non-preemptible, if
1001   - this option is selected then read-only RCU sections become
1002   - preemptible. This helps latency, but may expose bugs due to
1003   - now-naive assumptions about each RCU read-side critical section
1004   - remaining on a given CPU through its execution.
1005   -
1006   -endchoice
1007   -
1008   -config RCU_TRACE
1009   - bool "Enable tracing for RCU"
1010   - depends on TREE_RCU || PREEMPT_RCU
1011   - help
1012   - This option provides tracing in RCU which presents stats
1013   - in debugfs for debugging RCU implementation.
1014   -
1015   - Say Y here if you want to enable RCU tracing
1016   - Say N if you are unsure.
1017   -
1018   -config RCU_FANOUT
1019   - int "Tree-based hierarchical RCU fanout value"
1020   - range 2 64 if 64BIT
1021   - range 2 32 if !64BIT
1022   - depends on TREE_RCU
1023   - default 64 if 64BIT
1024   - default 32 if !64BIT
1025   - help
1026   - This option controls the fanout of hierarchical implementations
1027   - of RCU, allowing RCU to work efficiently on machines with
1028   - large numbers of CPUs. This value must be at least the cube
1029   - root of NR_CPUS, which allows NR_CPUS up to 32,768 for 32-bit
1030   - systems and up to 262,144 for 64-bit systems.
1031   -
1032   - Select a specific number if testing RCU itself.
1033   - Take the default if unsure.
1034   -
1035   -config RCU_FANOUT_EXACT
1036   - bool "Disable tree-based hierarchical RCU auto-balancing"
1037   - depends on TREE_RCU
1038   - default n
1039   - help
1040   - This option forces use of the exact RCU_FANOUT value specified,
1041   - regardless of imbalances in the hierarchy. This is useful for
1042   - testing RCU itself, and might one day be useful on systems with
1043   - strong NUMA behavior.
1044   -
1045   - Without RCU_FANOUT_EXACT, the code will balance the hierarchy.
1046   -
1047   - Say N if unsure.
1048   -
1049   -config TREE_RCU_TRACE
1050   - def_bool RCU_TRACE && TREE_RCU
1051   - select DEBUG_FS
1052   - help
1053   - This option provides tracing for the TREE_RCU implementation,
1054   - permitting Makefile to trivially select kernel/rcutree_trace.c.
1055   -
1056   -config PREEMPT_RCU_TRACE
1057   - def_bool RCU_TRACE && PREEMPT_RCU
1058   - select DEBUG_FS
1059   - help
1060   - This option provides tracing for the PREEMPT_RCU implementation,
1061   - permitting Makefile to trivially select kernel/rcupreempt_trace.c.
... ... @@ -716,7 +716,7 @@
716 716 raise_rcu_softirq();
717 717 }
718 718  
719   -static void rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp,
  719 +static void __cpuinit rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp,
720 720 struct rcu_data *rdp)
721 721 {
722 722 unsigned long flags;
... ... @@ -1314,7 +1314,7 @@
1314 1314 * access due to the fact that this CPU cannot possibly have any RCU
1315 1315 * callbacks in flight yet.
1316 1316 */
1317   -static void
  1317 +static void __cpuinit
1318 1318 rcu_init_percpu_data(int cpu, struct rcu_state *rsp)
1319 1319 {
1320 1320 unsigned long flags;
... ... @@ -663,8 +663,10 @@
663 663  
664 664 mutex_lock(&relay_channels_mutex);
665 665 /* Is chan already set up? */
666   - if (unlikely(chan->has_base_filename))
  666 + if (unlikely(chan->has_base_filename)) {
  667 + mutex_unlock(&relay_channels_mutex);
667 668 return -EEXIST;
  669 + }
668 670 chan->has_base_filename = 1;
669 671 chan->parent = parent;
670 672 curr_cpu = get_cpu();
... ... @@ -16,6 +16,7 @@
16 16 #include <linux/lockdep.h>
17 17 #include <linux/notifier.h>
18 18 #include <linux/module.h>
  19 +#include <linux/sysctl.h>
19 20  
20 21 #include <asm/irq_regs.h>
21 22  
... ... @@ -87,6 +88,14 @@
87 88 per_cpu(touch_timestamp, cpu) = 0;
88 89 }
89 90 EXPORT_SYMBOL(touch_all_softlockup_watchdogs);
  91 +
  92 +int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
  93 + struct file *filp, void __user *buffer,
  94 + size_t *lenp, loff_t *ppos)
  95 +{
  96 + touch_all_softlockup_watchdogs();
  97 + return proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos);
  98 +}
90 99  
91 100 /*
92 101 * This callback runs from the timer interrupt, and checks
... ... @@ -809,7 +809,7 @@
809 809 .data = &softlockup_thresh,
810 810 .maxlen = sizeof(int),
811 811 .mode = 0644,
812   - .proc_handler = &proc_dointvec_minmax,
  812 + .proc_handler = &proc_dosoftlockup_thresh,
813 813 .strategy = &sysctl_intvec,
814 814 .extra1 = &neg_one,
815 815 .extra2 = &sixty,
... ... @@ -642,19 +642,6 @@
642 642  
643 643 config RCU_CPU_STALL_DETECTOR
644 644 bool "Check for stalled CPUs delaying RCU grace periods"
645   - depends on CLASSIC_RCU
646   - default n
647   - help
648   - This option causes RCU to printk information on which
649   - CPUs are delaying the current grace period, but only when
650   - the grace period extends for excessive time periods.
651   -
652   - Say Y if you want RCU to perform such checks.
653   -
654   - Say N if you are unsure.
655   -
656   -config RCU_CPU_STALL_DETECTOR
657   - bool "Check for stalled CPUs delaying RCU grace periods"
658 645 depends on CLASSIC_RCU || TREE_RCU
659 646 default n
660 647 help