diff options
| author | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:57:10 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:57:10 -0400 |
| commit | a385ec4f11bdcf81af094c03e2444ee9b7fad2e5 (patch) | |
| tree | a2c186cb828e3713c2ec48a4d7191166fb798b3d /kernel | |
| parent | 659c36fcda403013a01b85da07cf2d9711e6d6c7 (diff) | |
| parent | 0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff) | |
Merge tag 'v3.4-rc2' into perf/core
Merge Linux 3.4-rc2: we were on v3.3, update the base.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
45 files changed, 671 insertions, 414 deletions
diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks index 5068e2a4e75f..2251882daf53 100644 --- a/kernel/Kconfig.locks +++ b/kernel/Kconfig.locks | |||
| @@ -124,8 +124,8 @@ config INLINE_SPIN_LOCK_IRQSAVE | |||
| 124 | def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \ | 124 | def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \ |
| 125 | ARCH_INLINE_SPIN_LOCK_IRQSAVE | 125 | ARCH_INLINE_SPIN_LOCK_IRQSAVE |
| 126 | 126 | ||
| 127 | config INLINE_SPIN_UNLOCK | 127 | config UNINLINE_SPIN_UNLOCK |
| 128 | def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_SPIN_UNLOCK) | 128 | bool |
| 129 | 129 | ||
| 130 | config INLINE_SPIN_UNLOCK_BH | 130 | config INLINE_SPIN_UNLOCK_BH |
| 131 | def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_UNLOCK_BH | 131 | def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_UNLOCK_BH |
diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt index 24e7cb0ba26a..3f9c97419f02 100644 --- a/kernel/Kconfig.preempt +++ b/kernel/Kconfig.preempt | |||
| @@ -36,6 +36,7 @@ config PREEMPT_VOLUNTARY | |||
| 36 | config PREEMPT | 36 | config PREEMPT |
| 37 | bool "Preemptible Kernel (Low-Latency Desktop)" | 37 | bool "Preemptible Kernel (Low-Latency Desktop)" |
| 38 | select PREEMPT_COUNT | 38 | select PREEMPT_COUNT |
| 39 | select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK | ||
| 39 | help | 40 | help |
| 40 | This option reduces the latency of the kernel by making | 41 | This option reduces the latency of the kernel by making |
| 41 | all kernel code (that is not executing in a critical section) | 42 | all kernel code (that is not executing in a critical section) |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index f4ea4b6f3cf1..ed64ccac67c9 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -1883,7 +1883,7 @@ static void cgroup_task_migrate(struct cgroup *cgrp, struct cgroup *oldcgrp, | |||
| 1883 | */ | 1883 | */ |
| 1884 | int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk) | 1884 | int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk) |
| 1885 | { | 1885 | { |
| 1886 | int retval; | 1886 | int retval = 0; |
| 1887 | struct cgroup_subsys *ss, *failed_ss = NULL; | 1887 | struct cgroup_subsys *ss, *failed_ss = NULL; |
| 1888 | struct cgroup *oldcgrp; | 1888 | struct cgroup *oldcgrp; |
| 1889 | struct cgroupfs_root *root = cgrp->root; | 1889 | struct cgroupfs_root *root = cgrp->root; |
diff --git a/kernel/compat.c b/kernel/compat.c index f346cedfe24d..74ff8498809a 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
| @@ -31,11 +31,10 @@ | |||
| 31 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
| 32 | 32 | ||
| 33 | /* | 33 | /* |
| 34 | * Note that the native side is already converted to a timespec, because | 34 | * Get/set struct timeval with struct timespec on the native side |
| 35 | * that's what we want anyway. | ||
| 36 | */ | 35 | */ |
| 37 | static int compat_get_timeval(struct timespec *o, | 36 | static int compat_get_timeval_convert(struct timespec *o, |
| 38 | struct compat_timeval __user *i) | 37 | struct compat_timeval __user *i) |
| 39 | { | 38 | { |
| 40 | long usec; | 39 | long usec; |
| 41 | 40 | ||
| @@ -46,8 +45,8 @@ static int compat_get_timeval(struct timespec *o, | |||
| 46 | return 0; | 45 | return 0; |
| 47 | } | 46 | } |
| 48 | 47 | ||
| 49 | static int compat_put_timeval(struct compat_timeval __user *o, | 48 | static int compat_put_timeval_convert(struct compat_timeval __user *o, |
| 50 | struct timeval *i) | 49 | struct timeval *i) |
| 51 | { | 50 | { |
| 52 | return (put_user(i->tv_sec, &o->tv_sec) || | 51 | return (put_user(i->tv_sec, &o->tv_sec) || |
| 53 | put_user(i->tv_usec, &o->tv_usec)) ? -EFAULT : 0; | 52 | put_user(i->tv_usec, &o->tv_usec)) ? -EFAULT : 0; |
| @@ -117,7 +116,7 @@ asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, | |||
| 117 | if (tv) { | 116 | if (tv) { |
| 118 | struct timeval ktv; | 117 | struct timeval ktv; |
| 119 | do_gettimeofday(&ktv); | 118 | do_gettimeofday(&ktv); |
| 120 | if (compat_put_timeval(tv, &ktv)) | 119 | if (compat_put_timeval_convert(tv, &ktv)) |
| 121 | return -EFAULT; | 120 | return -EFAULT; |
| 122 | } | 121 | } |
| 123 | if (tz) { | 122 | if (tz) { |
| @@ -135,7 +134,7 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, | |||
| 135 | struct timezone ktz; | 134 | struct timezone ktz; |
| 136 | 135 | ||
| 137 | if (tv) { | 136 | if (tv) { |
| 138 | if (compat_get_timeval(&kts, tv)) | 137 | if (compat_get_timeval_convert(&kts, tv)) |
| 139 | return -EFAULT; | 138 | return -EFAULT; |
| 140 | } | 139 | } |
| 141 | if (tz) { | 140 | if (tz) { |
| @@ -146,12 +145,29 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, | |||
| 146 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); | 145 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); |
| 147 | } | 146 | } |
| 148 | 147 | ||
| 148 | int get_compat_timeval(struct timeval *tv, const struct compat_timeval __user *ctv) | ||
| 149 | { | ||
| 150 | return (!access_ok(VERIFY_READ, ctv, sizeof(*ctv)) || | ||
| 151 | __get_user(tv->tv_sec, &ctv->tv_sec) || | ||
| 152 | __get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; | ||
| 153 | } | ||
| 154 | EXPORT_SYMBOL_GPL(get_compat_timeval); | ||
| 155 | |||
| 156 | int put_compat_timeval(const struct timeval *tv, struct compat_timeval __user *ctv) | ||
| 157 | { | ||
| 158 | return (!access_ok(VERIFY_WRITE, ctv, sizeof(*ctv)) || | ||
| 159 | __put_user(tv->tv_sec, &ctv->tv_sec) || | ||
| 160 | __put_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; | ||
| 161 | } | ||
| 162 | EXPORT_SYMBOL_GPL(put_compat_timeval); | ||
| 163 | |||
| 149 | int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) | 164 | int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) |
| 150 | { | 165 | { |
| 151 | return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || | 166 | return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || |
| 152 | __get_user(ts->tv_sec, &cts->tv_sec) || | 167 | __get_user(ts->tv_sec, &cts->tv_sec) || |
| 153 | __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; | 168 | __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; |
| 154 | } | 169 | } |
| 170 | EXPORT_SYMBOL_GPL(get_compat_timespec); | ||
| 155 | 171 | ||
| 156 | int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts) | 172 | int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts) |
| 157 | { | 173 | { |
| @@ -161,6 +177,42 @@ int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user | |||
| 161 | } | 177 | } |
| 162 | EXPORT_SYMBOL_GPL(put_compat_timespec); | 178 | EXPORT_SYMBOL_GPL(put_compat_timespec); |
| 163 | 179 | ||
| 180 | int compat_get_timeval(struct timeval *tv, const void __user *utv) | ||
| 181 | { | ||
| 182 | if (COMPAT_USE_64BIT_TIME) | ||
| 183 | return copy_from_user(tv, utv, sizeof *tv) ? -EFAULT : 0; | ||
| 184 | else | ||
| 185 | return get_compat_timeval(tv, utv); | ||
| 186 | } | ||
| 187 | EXPORT_SYMBOL_GPL(compat_get_timeval); | ||
| 188 | |||
| 189 | int compat_put_timeval(const struct timeval *tv, void __user *utv) | ||
| 190 | { | ||
| 191 | if (COMPAT_USE_64BIT_TIME) | ||
| 192 | return copy_to_user(utv, tv, sizeof *tv) ? -EFAULT : 0; | ||
| 193 | else | ||
| 194 | return put_compat_timeval(tv, utv); | ||
| 195 | } | ||
| 196 | EXPORT_SYMBOL_GPL(compat_put_timeval); | ||
| 197 | |||
| 198 | int compat_get_timespec(struct timespec *ts, const void __user *uts) | ||
| 199 | { | ||
| 200 | if (COMPAT_USE_64BIT_TIME) | ||
| 201 | return copy_from_user(ts, uts, sizeof *ts) ? -EFAULT : 0; | ||
| 202 | else | ||
| 203 | return get_compat_timespec(ts, uts); | ||
| 204 | } | ||
| 205 | EXPORT_SYMBOL_GPL(compat_get_timespec); | ||
| 206 | |||
| 207 | int compat_put_timespec(const struct timespec *ts, void __user *uts) | ||
| 208 | { | ||
| 209 | if (COMPAT_USE_64BIT_TIME) | ||
| 210 | return copy_to_user(uts, ts, sizeof *ts) ? -EFAULT : 0; | ||
| 211 | else | ||
| 212 | return put_compat_timespec(ts, uts); | ||
| 213 | } | ||
| 214 | EXPORT_SYMBOL_GPL(compat_put_timespec); | ||
| 215 | |||
| 164 | static long compat_nanosleep_restart(struct restart_block *restart) | 216 | static long compat_nanosleep_restart(struct restart_block *restart) |
| 165 | { | 217 | { |
| 166 | struct compat_timespec __user *rmtp; | 218 | struct compat_timespec __user *rmtp; |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 1010cc61931f..14f7070b4ba2 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
| @@ -270,11 +270,11 @@ static struct file_system_type cpuset_fs_type = { | |||
| 270 | * are online. If none are online, walk up the cpuset hierarchy | 270 | * are online. If none are online, walk up the cpuset hierarchy |
| 271 | * until we find one that does have some online cpus. If we get | 271 | * until we find one that does have some online cpus. If we get |
| 272 | * all the way to the top and still haven't found any online cpus, | 272 | * all the way to the top and still haven't found any online cpus, |
| 273 | * return cpu_online_map. Or if passed a NULL cs from an exit'ing | 273 | * return cpu_online_mask. Or if passed a NULL cs from an exit'ing |
| 274 | * task, return cpu_online_map. | 274 | * task, return cpu_online_mask. |
| 275 | * | 275 | * |
| 276 | * One way or another, we guarantee to return some non-empty subset | 276 | * One way or another, we guarantee to return some non-empty subset |
| 277 | * of cpu_online_map. | 277 | * of cpu_online_mask. |
| 278 | * | 278 | * |
| 279 | * Call with callback_mutex held. | 279 | * Call with callback_mutex held. |
| 280 | */ | 280 | */ |
| @@ -867,7 +867,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, | |||
| 867 | int retval; | 867 | int retval; |
| 868 | int is_load_balanced; | 868 | int is_load_balanced; |
| 869 | 869 | ||
| 870 | /* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */ | 870 | /* top_cpuset.cpus_allowed tracks cpu_online_mask; it's read-only */ |
| 871 | if (cs == &top_cpuset) | 871 | if (cs == &top_cpuset) |
| 872 | return -EACCES; | 872 | return -EACCES; |
| 873 | 873 | ||
| @@ -2149,7 +2149,7 @@ void __init cpuset_init_smp(void) | |||
| 2149 | * | 2149 | * |
| 2150 | * Description: Returns the cpumask_var_t cpus_allowed of the cpuset | 2150 | * Description: Returns the cpumask_var_t cpus_allowed of the cpuset |
| 2151 | * attached to the specified @tsk. Guaranteed to return some non-empty | 2151 | * attached to the specified @tsk. Guaranteed to return some non-empty |
| 2152 | * subset of cpu_online_map, even if this means going outside the | 2152 | * subset of cpu_online_mask, even if this means going outside the |
| 2153 | * tasks cpuset. | 2153 | * tasks cpuset. |
| 2154 | **/ | 2154 | **/ |
| 2155 | 2155 | ||
| @@ -2162,10 +2162,9 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) | |||
| 2162 | mutex_unlock(&callback_mutex); | 2162 | mutex_unlock(&callback_mutex); |
| 2163 | } | 2163 | } |
| 2164 | 2164 | ||
| 2165 | int cpuset_cpus_allowed_fallback(struct task_struct *tsk) | 2165 | void cpuset_cpus_allowed_fallback(struct task_struct *tsk) |
| 2166 | { | 2166 | { |
| 2167 | const struct cpuset *cs; | 2167 | const struct cpuset *cs; |
| 2168 | int cpu; | ||
| 2169 | 2168 | ||
| 2170 | rcu_read_lock(); | 2169 | rcu_read_lock(); |
| 2171 | cs = task_cs(tsk); | 2170 | cs = task_cs(tsk); |
| @@ -2186,22 +2185,10 @@ int cpuset_cpus_allowed_fallback(struct task_struct *tsk) | |||
| 2186 | * changes in tsk_cs()->cpus_allowed. Otherwise we can temporary | 2185 | * changes in tsk_cs()->cpus_allowed. Otherwise we can temporary |
| 2187 | * set any mask even if it is not right from task_cs() pov, | 2186 | * set any mask even if it is not right from task_cs() pov, |
| 2188 | * the pending set_cpus_allowed_ptr() will fix things. | 2187 | * the pending set_cpus_allowed_ptr() will fix things. |
| 2188 | * | ||
| 2189 | * select_fallback_rq() will fix things ups and set cpu_possible_mask | ||
| 2190 | * if required. | ||
| 2189 | */ | 2191 | */ |
| 2190 | |||
| 2191 | cpu = cpumask_any_and(&tsk->cpus_allowed, cpu_active_mask); | ||
| 2192 | if (cpu >= nr_cpu_ids) { | ||
| 2193 | /* | ||
| 2194 | * Either tsk->cpus_allowed is wrong (see above) or it | ||
| 2195 | * is actually empty. The latter case is only possible | ||
| 2196 | * if we are racing with remove_tasks_in_empty_cpuset(). | ||
| 2197 | * Like above we can temporary set any mask and rely on | ||
| 2198 | * set_cpus_allowed_ptr() as synchronization point. | ||
| 2199 | */ | ||
| 2200 | do_set_cpus_allowed(tsk, cpu_possible_mask); | ||
| 2201 | cpu = cpumask_any(cpu_active_mask); | ||
| 2202 | } | ||
| 2203 | |||
| 2204 | return cpu; | ||
| 2205 | } | 2192 | } |
| 2206 | 2193 | ||
| 2207 | void cpuset_init_current_mems_allowed(void) | 2194 | void cpuset_init_current_mems_allowed(void) |
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 3f88a45e6f0a..0557f24c6bca 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
| @@ -53,7 +53,6 @@ | |||
| 53 | #include <asm/cacheflush.h> | 53 | #include <asm/cacheflush.h> |
| 54 | #include <asm/byteorder.h> | 54 | #include <asm/byteorder.h> |
| 55 | #include <linux/atomic.h> | 55 | #include <linux/atomic.h> |
| 56 | #include <asm/system.h> | ||
| 57 | 56 | ||
| 58 | #include "debug_core.h" | 57 | #include "debug_core.h" |
| 59 | 58 | ||
| @@ -161,37 +160,39 @@ early_param("nokgdbroundup", opt_nokgdbroundup); | |||
| 161 | * Weak aliases for breakpoint management, | 160 | * Weak aliases for breakpoint management, |
| 162 | * can be overriden by architectures when needed: | 161 | * can be overriden by architectures when needed: |
| 163 | */ | 162 | */ |
| 164 | int __weak kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr) | 163 | int __weak kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) |
| 165 | { | 164 | { |
| 166 | int err; | 165 | int err; |
| 167 | 166 | ||
| 168 | err = probe_kernel_read(saved_instr, (char *)addr, BREAK_INSTR_SIZE); | 167 | err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr, |
| 168 | BREAK_INSTR_SIZE); | ||
| 169 | if (err) | 169 | if (err) |
| 170 | return err; | 170 | return err; |
| 171 | 171 | err = probe_kernel_write((char *)bpt->bpt_addr, | |
| 172 | return probe_kernel_write((char *)addr, arch_kgdb_ops.gdb_bpt_instr, | 172 | arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE); |
| 173 | BREAK_INSTR_SIZE); | 173 | return err; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | int __weak kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle) | 176 | int __weak kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) |
| 177 | { | 177 | { |
| 178 | return probe_kernel_write((char *)addr, | 178 | return probe_kernel_write((char *)bpt->bpt_addr, |
| 179 | (char *)bundle, BREAK_INSTR_SIZE); | 179 | (char *)bpt->saved_instr, BREAK_INSTR_SIZE); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | int __weak kgdb_validate_break_address(unsigned long addr) | 182 | int __weak kgdb_validate_break_address(unsigned long addr) |
| 183 | { | 183 | { |
| 184 | char tmp_variable[BREAK_INSTR_SIZE]; | 184 | struct kgdb_bkpt tmp; |
| 185 | int err; | 185 | int err; |
| 186 | /* Validate setting the breakpoint and then removing it. In the | 186 | /* Validate setting the breakpoint and then removing it. If the |
| 187 | * remove fails, the kernel needs to emit a bad message because we | 187 | * remove fails, the kernel needs to emit a bad message because we |
| 188 | * are deep trouble not being able to put things back the way we | 188 | * are deep trouble not being able to put things back the way we |
| 189 | * found them. | 189 | * found them. |
| 190 | */ | 190 | */ |
| 191 | err = kgdb_arch_set_breakpoint(addr, tmp_variable); | 191 | tmp.bpt_addr = addr; |
| 192 | err = kgdb_arch_set_breakpoint(&tmp); | ||
| 192 | if (err) | 193 | if (err) |
| 193 | return err; | 194 | return err; |
| 194 | err = kgdb_arch_remove_breakpoint(addr, tmp_variable); | 195 | err = kgdb_arch_remove_breakpoint(&tmp); |
| 195 | if (err) | 196 | if (err) |
| 196 | printk(KERN_ERR "KGDB: Critical breakpoint error, kernel " | 197 | printk(KERN_ERR "KGDB: Critical breakpoint error, kernel " |
| 197 | "memory destroyed at: %lx", addr); | 198 | "memory destroyed at: %lx", addr); |
| @@ -235,7 +236,6 @@ static void kgdb_flush_swbreak_addr(unsigned long addr) | |||
| 235 | */ | 236 | */ |
| 236 | int dbg_activate_sw_breakpoints(void) | 237 | int dbg_activate_sw_breakpoints(void) |
| 237 | { | 238 | { |
| 238 | unsigned long addr; | ||
| 239 | int error; | 239 | int error; |
| 240 | int ret = 0; | 240 | int ret = 0; |
| 241 | int i; | 241 | int i; |
| @@ -244,16 +244,15 @@ int dbg_activate_sw_breakpoints(void) | |||
| 244 | if (kgdb_break[i].state != BP_SET) | 244 | if (kgdb_break[i].state != BP_SET) |
| 245 | continue; | 245 | continue; |
| 246 | 246 | ||
| 247 | addr = kgdb_break[i].bpt_addr; | 247 | error = kgdb_arch_set_breakpoint(&kgdb_break[i]); |
| 248 | error = kgdb_arch_set_breakpoint(addr, | ||
| 249 | kgdb_break[i].saved_instr); | ||
| 250 | if (error) { | 248 | if (error) { |
| 251 | ret = error; | 249 | ret = error; |
| 252 | printk(KERN_INFO "KGDB: BP install failed: %lx", addr); | 250 | printk(KERN_INFO "KGDB: BP install failed: %lx", |
| 251 | kgdb_break[i].bpt_addr); | ||
| 253 | continue; | 252 | continue; |
| 254 | } | 253 | } |
| 255 | 254 | ||
| 256 | kgdb_flush_swbreak_addr(addr); | 255 | kgdb_flush_swbreak_addr(kgdb_break[i].bpt_addr); |
| 257 | kgdb_break[i].state = BP_ACTIVE; | 256 | kgdb_break[i].state = BP_ACTIVE; |
| 258 | } | 257 | } |
| 259 | return ret; | 258 | return ret; |
| @@ -302,7 +301,6 @@ int dbg_set_sw_break(unsigned long addr) | |||
| 302 | 301 | ||
| 303 | int dbg_deactivate_sw_breakpoints(void) | 302 | int dbg_deactivate_sw_breakpoints(void) |
| 304 | { | 303 | { |
| 305 | unsigned long addr; | ||
| 306 | int error; | 304 | int error; |
| 307 | int ret = 0; | 305 | int ret = 0; |
| 308 | int i; | 306 | int i; |
| @@ -310,15 +308,14 @@ int dbg_deactivate_sw_breakpoints(void) | |||
| 310 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { | 308 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { |
| 311 | if (kgdb_break[i].state != BP_ACTIVE) | 309 | if (kgdb_break[i].state != BP_ACTIVE) |
| 312 | continue; | 310 | continue; |
| 313 | addr = kgdb_break[i].bpt_addr; | 311 | error = kgdb_arch_remove_breakpoint(&kgdb_break[i]); |
| 314 | error = kgdb_arch_remove_breakpoint(addr, | ||
| 315 | kgdb_break[i].saved_instr); | ||
| 316 | if (error) { | 312 | if (error) { |
| 317 | printk(KERN_INFO "KGDB: BP remove failed: %lx\n", addr); | 313 | printk(KERN_INFO "KGDB: BP remove failed: %lx\n", |
| 314 | kgdb_break[i].bpt_addr); | ||
| 318 | ret = error; | 315 | ret = error; |
| 319 | } | 316 | } |
| 320 | 317 | ||
| 321 | kgdb_flush_swbreak_addr(addr); | 318 | kgdb_flush_swbreak_addr(kgdb_break[i].bpt_addr); |
| 322 | kgdb_break[i].state = BP_SET; | 319 | kgdb_break[i].state = BP_SET; |
| 323 | } | 320 | } |
| 324 | return ret; | 321 | return ret; |
| @@ -352,7 +349,6 @@ int kgdb_isremovedbreak(unsigned long addr) | |||
| 352 | 349 | ||
| 353 | int dbg_remove_all_break(void) | 350 | int dbg_remove_all_break(void) |
| 354 | { | 351 | { |
| 355 | unsigned long addr; | ||
| 356 | int error; | 352 | int error; |
| 357 | int i; | 353 | int i; |
| 358 | 354 | ||
| @@ -360,12 +356,10 @@ int dbg_remove_all_break(void) | |||
| 360 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { | 356 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { |
| 361 | if (kgdb_break[i].state != BP_ACTIVE) | 357 | if (kgdb_break[i].state != BP_ACTIVE) |
| 362 | goto setundefined; | 358 | goto setundefined; |
| 363 | addr = kgdb_break[i].bpt_addr; | 359 | error = kgdb_arch_remove_breakpoint(&kgdb_break[i]); |
| 364 | error = kgdb_arch_remove_breakpoint(addr, | ||
| 365 | kgdb_break[i].saved_instr); | ||
| 366 | if (error) | 360 | if (error) |
| 367 | printk(KERN_ERR "KGDB: breakpoint remove failed: %lx\n", | 361 | printk(KERN_ERR "KGDB: breakpoint remove failed: %lx\n", |
| 368 | addr); | 362 | kgdb_break[i].bpt_addr); |
| 369 | setundefined: | 363 | setundefined: |
| 370 | kgdb_break[i].state = BP_UNDEFINED; | 364 | kgdb_break[i].state = BP_UNDEFINED; |
| 371 | } | 365 | } |
diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c index 7179eac7b41c..07c9bbb94a0b 100644 --- a/kernel/debug/kdb/kdb_bt.c +++ b/kernel/debug/kdb/kdb_bt.c | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
| 16 | #include <linux/kdb.h> | 16 | #include <linux/kdb.h> |
| 17 | #include <linux/nmi.h> | 17 | #include <linux/nmi.h> |
| 18 | #include <asm/system.h> | ||
| 19 | #include "kdb_private.h" | 18 | #include "kdb_private.h" |
| 20 | 19 | ||
| 21 | 20 | ||
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 9b5f17da1c56..bb9520f0f6ff 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c | |||
| @@ -743,7 +743,7 @@ kdb_printit: | |||
| 743 | kdb_input_flush(); | 743 | kdb_input_flush(); |
| 744 | c = console_drivers; | 744 | c = console_drivers; |
| 745 | 745 | ||
| 746 | if (!dbg_io_ops->is_console) { | 746 | if (dbg_io_ops && !dbg_io_ops->is_console) { |
| 747 | len = strlen(moreprompt); | 747 | len = strlen(moreprompt); |
| 748 | cp = moreprompt; | 748 | cp = moreprompt; |
| 749 | while (len--) { | 749 | while (len--) { |
diff --git a/kernel/dma.c b/kernel/dma.c index 68a2306522c8..6c6262f86c17 100644 --- a/kernel/dma.c +++ b/kernel/dma.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
| 19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 20 | #include <asm/dma.h> | 20 | #include <asm/dma.h> |
| 21 | #include <asm/system.h> | ||
| 22 | 21 | ||
| 23 | 22 | ||
| 24 | 23 | ||
diff --git a/kernel/exit.c b/kernel/exit.c index 3db1909faed9..d8bd3b425fa7 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -474,7 +474,7 @@ static void close_files(struct files_struct * files) | |||
| 474 | i = j * __NFDBITS; | 474 | i = j * __NFDBITS; |
| 475 | if (i >= fdt->max_fds) | 475 | if (i >= fdt->max_fds) |
| 476 | break; | 476 | break; |
| 477 | set = fdt->open_fds->fds_bits[j++]; | 477 | set = fdt->open_fds[j++]; |
| 478 | while (set) { | 478 | while (set) { |
| 479 | if (set & 1) { | 479 | if (set & 1) { |
| 480 | struct file * file = xchg(&fdt->fd[i], NULL); | 480 | struct file * file = xchg(&fdt->fd[i], NULL); |
diff --git a/kernel/futex.c b/kernel/futex.c index 72efa1e4359a..e2b0fb9a0b3b 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #include <linux/magic.h> | 59 | #include <linux/magic.h> |
| 60 | #include <linux/pid.h> | 60 | #include <linux/pid.h> |
| 61 | #include <linux/nsproxy.h> | 61 | #include <linux/nsproxy.h> |
| 62 | #include <linux/ptrace.h> | ||
| 62 | 63 | ||
| 63 | #include <asm/futex.h> | 64 | #include <asm/futex.h> |
| 64 | 65 | ||
| @@ -2443,40 +2444,31 @@ SYSCALL_DEFINE3(get_robust_list, int, pid, | |||
| 2443 | { | 2444 | { |
| 2444 | struct robust_list_head __user *head; | 2445 | struct robust_list_head __user *head; |
| 2445 | unsigned long ret; | 2446 | unsigned long ret; |
| 2446 | const struct cred *cred = current_cred(), *pcred; | 2447 | struct task_struct *p; |
| 2447 | 2448 | ||
| 2448 | if (!futex_cmpxchg_enabled) | 2449 | if (!futex_cmpxchg_enabled) |
| 2449 | return -ENOSYS; | 2450 | return -ENOSYS; |
| 2450 | 2451 | ||
| 2452 | WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n"); | ||
| 2453 | |||
| 2454 | rcu_read_lock(); | ||
| 2455 | |||
| 2456 | ret = -ESRCH; | ||
| 2451 | if (!pid) | 2457 | if (!pid) |
| 2452 | head = current->robust_list; | 2458 | p = current; |
| 2453 | else { | 2459 | else { |
| 2454 | struct task_struct *p; | ||
| 2455 | |||
| 2456 | ret = -ESRCH; | ||
| 2457 | rcu_read_lock(); | ||
| 2458 | p = find_task_by_vpid(pid); | 2460 | p = find_task_by_vpid(pid); |
| 2459 | if (!p) | 2461 | if (!p) |
| 2460 | goto err_unlock; | 2462 | goto err_unlock; |
| 2461 | ret = -EPERM; | ||
| 2462 | pcred = __task_cred(p); | ||
| 2463 | /* If victim is in different user_ns, then uids are not | ||
| 2464 | comparable, so we must have CAP_SYS_PTRACE */ | ||
| 2465 | if (cred->user->user_ns != pcred->user->user_ns) { | ||
| 2466 | if (!ns_capable(pcred->user->user_ns, CAP_SYS_PTRACE)) | ||
| 2467 | goto err_unlock; | ||
| 2468 | goto ok; | ||
| 2469 | } | ||
| 2470 | /* If victim is in same user_ns, then uids are comparable */ | ||
| 2471 | if (cred->euid != pcred->euid && | ||
| 2472 | cred->euid != pcred->uid && | ||
| 2473 | !ns_capable(pcred->user->user_ns, CAP_SYS_PTRACE)) | ||
| 2474 | goto err_unlock; | ||
| 2475 | ok: | ||
| 2476 | head = p->robust_list; | ||
| 2477 | rcu_read_unlock(); | ||
| 2478 | } | 2463 | } |
| 2479 | 2464 | ||
| 2465 | ret = -EPERM; | ||
| 2466 | if (!ptrace_may_access(p, PTRACE_MODE_READ)) | ||
| 2467 | goto err_unlock; | ||
| 2468 | |||
| 2469 | head = p->robust_list; | ||
| 2470 | rcu_read_unlock(); | ||
| 2471 | |||
| 2480 | if (put_user(sizeof(*head), len_ptr)) | 2472 | if (put_user(sizeof(*head), len_ptr)) |
| 2481 | return -EFAULT; | 2473 | return -EFAULT; |
| 2482 | return put_user(head, head_ptr); | 2474 | return put_user(head, head_ptr); |
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index 5f9e689dc8f0..83e368b005fc 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <linux/compat.h> | 10 | #include <linux/compat.h> |
| 11 | #include <linux/nsproxy.h> | 11 | #include <linux/nsproxy.h> |
| 12 | #include <linux/futex.h> | 12 | #include <linux/futex.h> |
| 13 | #include <linux/ptrace.h> | ||
| 13 | 14 | ||
| 14 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
| 15 | 16 | ||
| @@ -136,40 +137,31 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, | |||
| 136 | { | 137 | { |
| 137 | struct compat_robust_list_head __user *head; | 138 | struct compat_robust_list_head __user *head; |
| 138 | unsigned long ret; | 139 | unsigned long ret; |
| 139 | const struct cred *cred = current_cred(), *pcred; | 140 | struct task_struct *p; |
| 140 | 141 | ||
| 141 | if (!futex_cmpxchg_enabled) | 142 | if (!futex_cmpxchg_enabled) |
| 142 | return -ENOSYS; | 143 | return -ENOSYS; |
| 143 | 144 | ||
| 145 | WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n"); | ||
| 146 | |||
| 147 | rcu_read_lock(); | ||
| 148 | |||
| 149 | ret = -ESRCH; | ||
| 144 | if (!pid) | 150 | if (!pid) |
| 145 | head = current->compat_robust_list; | 151 | p = current; |
| 146 | else { | 152 | else { |
| 147 | struct task_struct *p; | ||
| 148 | |||
| 149 | ret = -ESRCH; | ||
| 150 | rcu_read_lock(); | ||
| 151 | p = find_task_by_vpid(pid); | 153 | p = find_task_by_vpid(pid); |
| 152 | if (!p) | 154 | if (!p) |
| 153 | goto err_unlock; | 155 | goto err_unlock; |
| 154 | ret = -EPERM; | ||
| 155 | pcred = __task_cred(p); | ||
| 156 | /* If victim is in different user_ns, then uids are not | ||
| 157 | comparable, so we must have CAP_SYS_PTRACE */ | ||
| 158 | if (cred->user->user_ns != pcred->user->user_ns) { | ||
| 159 | if (!ns_capable(pcred->user->user_ns, CAP_SYS_PTRACE)) | ||
| 160 | goto err_unlock; | ||
| 161 | goto ok; | ||
| 162 | } | ||
| 163 | /* If victim is in same user_ns, then uids are comparable */ | ||
| 164 | if (cred->euid != pcred->euid && | ||
| 165 | cred->euid != pcred->uid && | ||
| 166 | !ns_capable(pcred->user->user_ns, CAP_SYS_PTRACE)) | ||
| 167 | goto err_unlock; | ||
| 168 | ok: | ||
| 169 | head = p->compat_robust_list; | ||
| 170 | rcu_read_unlock(); | ||
| 171 | } | 156 | } |
| 172 | 157 | ||
| 158 | ret = -EPERM; | ||
| 159 | if (!ptrace_may_access(p, PTRACE_MODE_READ)) | ||
| 160 | goto err_unlock; | ||
| 161 | |||
| 162 | head = p->compat_robust_list; | ||
| 163 | rcu_read_unlock(); | ||
| 164 | |||
| 173 | if (put_user(sizeof(*head), len_ptr)) | 165 | if (put_user(sizeof(*head), len_ptr)) |
| 174 | return -EFAULT; | 166 | return -EFAULT; |
| 175 | return put_user(ptr_to_compat(head), head_ptr); | 167 | return put_user(ptr_to_compat(head), head_ptr); |
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig index 5a38bf4de641..cf1a4a68ce44 100644 --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig | |||
| @@ -13,7 +13,7 @@ config GENERIC_HARDIRQS | |||
| 13 | # Options selectable by the architecture code | 13 | # Options selectable by the architecture code |
| 14 | 14 | ||
| 15 | # Make sparse irq Kconfig switch below available | 15 | # Make sparse irq Kconfig switch below available |
| 16 | config HAVE_SPARSE_IRQ | 16 | config MAY_HAVE_SPARSE_IRQ |
| 17 | bool | 17 | bool |
| 18 | 18 | ||
| 19 | # Enable the generic irq autoprobe mechanism | 19 | # Enable the generic irq autoprobe mechanism |
| @@ -56,13 +56,22 @@ config GENERIC_IRQ_CHIP | |||
| 56 | config IRQ_DOMAIN | 56 | config IRQ_DOMAIN |
| 57 | bool | 57 | bool |
| 58 | 58 | ||
| 59 | config IRQ_DOMAIN_DEBUG | ||
| 60 | bool "Expose hardware/virtual IRQ mapping via debugfs" | ||
| 61 | depends on IRQ_DOMAIN && DEBUG_FS | ||
| 62 | help | ||
| 63 | This option will show the mapping relationship between hardware irq | ||
| 64 | numbers and Linux irq numbers. The mapping is exposed via debugfs | ||
| 65 | in the file "virq_mapping". | ||
| 66 | |||
| 67 | If you don't know what this means you don't need it. | ||
| 68 | |||
| 59 | # Support forced irq threading | 69 | # Support forced irq threading |
| 60 | config IRQ_FORCED_THREADING | 70 | config IRQ_FORCED_THREADING |
| 61 | bool | 71 | bool |
| 62 | 72 | ||
| 63 | config SPARSE_IRQ | 73 | config SPARSE_IRQ |
| 64 | bool "Support sparse irq numbering" | 74 | bool "Support sparse irq numbering" if MAY_HAVE_SPARSE_IRQ |
| 65 | depends on HAVE_SPARSE_IRQ | ||
| 66 | ---help--- | 75 | ---help--- |
| 67 | 76 | ||
| 68 | Sparse irq numbering is useful for distro kernels that want | 77 | Sparse irq numbering is useful for distro kernels that want |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 6ff84e6a954c..bdb180325551 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
| @@ -54,14 +54,18 @@ static void warn_no_thread(unsigned int irq, struct irqaction *action) | |||
| 54 | static void irq_wake_thread(struct irq_desc *desc, struct irqaction *action) | 54 | static void irq_wake_thread(struct irq_desc *desc, struct irqaction *action) |
| 55 | { | 55 | { |
| 56 | /* | 56 | /* |
| 57 | * Wake up the handler thread for this action. In case the | 57 | * In case the thread crashed and was killed we just pretend that |
| 58 | * thread crashed and was killed we just pretend that we | 58 | * we handled the interrupt. The hardirq handler has disabled the |
| 59 | * handled the interrupt. The hardirq handler has disabled the | 59 | * device interrupt, so no irq storm is lurking. |
| 60 | * device interrupt, so no irq storm is lurking. If the | 60 | */ |
| 61 | if (action->thread->flags & PF_EXITING) | ||
| 62 | return; | ||
| 63 | |||
| 64 | /* | ||
| 65 | * Wake up the handler thread for this action. If the | ||
| 61 | * RUNTHREAD bit is already set, nothing to do. | 66 | * RUNTHREAD bit is already set, nothing to do. |
| 62 | */ | 67 | */ |
| 63 | if ((action->thread->flags & PF_EXITING) || | 68 | if (test_and_set_bit(IRQTF_RUNTHREAD, &action->thread_flags)) |
| 64 | test_and_set_bit(IRQTF_RUNTHREAD, &action->thread_flags)) | ||
| 65 | return; | 69 | return; |
| 66 | 70 | ||
| 67 | /* | 71 | /* |
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index af48e59bc2ff..3601f3fbf67c 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
| @@ -632,7 +632,7 @@ unsigned int irq_linear_revmap(struct irq_domain *domain, | |||
| 632 | return revmap[hwirq]; | 632 | return revmap[hwirq]; |
| 633 | } | 633 | } |
| 634 | 634 | ||
| 635 | #ifdef CONFIG_VIRQ_DEBUG | 635 | #ifdef CONFIG_IRQ_DOMAIN_DEBUG |
| 636 | static int virq_debug_show(struct seq_file *m, void *private) | 636 | static int virq_debug_show(struct seq_file *m, void *private) |
| 637 | { | 637 | { |
| 638 | unsigned long flags; | 638 | unsigned long flags; |
| @@ -668,7 +668,7 @@ static int virq_debug_show(struct seq_file *m, void *private) | |||
| 668 | data = irq_desc_get_chip_data(desc); | 668 | data = irq_desc_get_chip_data(desc); |
| 669 | seq_printf(m, "0x%16p ", data); | 669 | seq_printf(m, "0x%16p ", data); |
| 670 | 670 | ||
| 671 | if (desc->irq_data.domain->of_node) | 671 | if (desc->irq_data.domain && desc->irq_data.domain->of_node) |
| 672 | p = desc->irq_data.domain->of_node->full_name; | 672 | p = desc->irq_data.domain->of_node->full_name; |
| 673 | else | 673 | else |
| 674 | p = none; | 674 | p = none; |
| @@ -695,14 +695,14 @@ static const struct file_operations virq_debug_fops = { | |||
| 695 | 695 | ||
| 696 | static int __init irq_debugfs_init(void) | 696 | static int __init irq_debugfs_init(void) |
| 697 | { | 697 | { |
| 698 | if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root, | 698 | if (debugfs_create_file("irq_domain_mapping", S_IRUGO, NULL, |
| 699 | NULL, &virq_debug_fops) == NULL) | 699 | NULL, &virq_debug_fops) == NULL) |
| 700 | return -ENOMEM; | 700 | return -ENOMEM; |
| 701 | 701 | ||
| 702 | return 0; | 702 | return 0; |
| 703 | } | 703 | } |
| 704 | __initcall(irq_debugfs_init); | 704 | __initcall(irq_debugfs_init); |
| 705 | #endif /* CONFIG_VIRQ_DEBUG */ | 705 | #endif /* CONFIG_IRQ_DOMAIN_DEBUG */ |
| 706 | 706 | ||
| 707 | int irq_domain_simple_map(struct irq_domain *d, unsigned int irq, | 707 | int irq_domain_simple_map(struct irq_domain *d, unsigned int irq, |
| 708 | irq_hw_number_t hwirq) | 708 | irq_hw_number_t hwirq) |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index b0ccd1ac2d6a..89a3ea82569b 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
| @@ -282,7 +282,7 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask) | |||
| 282 | { | 282 | { |
| 283 | struct irq_chip *chip = irq_desc_get_chip(desc); | 283 | struct irq_chip *chip = irq_desc_get_chip(desc); |
| 284 | struct cpumask *set = irq_default_affinity; | 284 | struct cpumask *set = irq_default_affinity; |
| 285 | int ret; | 285 | int ret, node = desc->irq_data.node; |
| 286 | 286 | ||
| 287 | /* Excludes PER_CPU and NO_BALANCE interrupts */ | 287 | /* Excludes PER_CPU and NO_BALANCE interrupts */ |
| 288 | if (!irq_can_set_affinity(irq)) | 288 | if (!irq_can_set_affinity(irq)) |
| @@ -301,6 +301,13 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask) | |||
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | cpumask_and(mask, cpu_online_mask, set); | 303 | cpumask_and(mask, cpu_online_mask, set); |
| 304 | if (node != NUMA_NO_NODE) { | ||
| 305 | const struct cpumask *nodemask = cpumask_of_node(node); | ||
| 306 | |||
| 307 | /* make sure at least one of the cpus in nodemask is online */ | ||
| 308 | if (cpumask_intersects(mask, nodemask)) | ||
| 309 | cpumask_and(mask, mask, nodemask); | ||
| 310 | } | ||
| 304 | ret = chip->irq_set_affinity(&desc->irq_data, mask, false); | 311 | ret = chip->irq_set_affinity(&desc->irq_data, mask, false); |
| 305 | switch (ret) { | 312 | switch (ret) { |
| 306 | case IRQ_SET_MASK_OK: | 313 | case IRQ_SET_MASK_OK: |
| @@ -645,7 +652,7 @@ static int irq_wait_for_interrupt(struct irqaction *action) | |||
| 645 | * is marked MASKED. | 652 | * is marked MASKED. |
| 646 | */ | 653 | */ |
| 647 | static void irq_finalize_oneshot(struct irq_desc *desc, | 654 | static void irq_finalize_oneshot(struct irq_desc *desc, |
| 648 | struct irqaction *action, bool force) | 655 | struct irqaction *action) |
| 649 | { | 656 | { |
| 650 | if (!(desc->istate & IRQS_ONESHOT)) | 657 | if (!(desc->istate & IRQS_ONESHOT)) |
| 651 | return; | 658 | return; |
| @@ -679,7 +686,7 @@ again: | |||
| 679 | * we would clear the threads_oneshot bit of this thread which | 686 | * we would clear the threads_oneshot bit of this thread which |
| 680 | * was just set. | 687 | * was just set. |
| 681 | */ | 688 | */ |
| 682 | if (!force && test_bit(IRQTF_RUNTHREAD, &action->thread_flags)) | 689 | if (test_bit(IRQTF_RUNTHREAD, &action->thread_flags)) |
| 683 | goto out_unlock; | 690 | goto out_unlock; |
| 684 | 691 | ||
| 685 | desc->threads_oneshot &= ~action->thread_mask; | 692 | desc->threads_oneshot &= ~action->thread_mask; |
| @@ -739,7 +746,7 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action) | |||
| 739 | 746 | ||
| 740 | local_bh_disable(); | 747 | local_bh_disable(); |
| 741 | ret = action->thread_fn(action->irq, action->dev_id); | 748 | ret = action->thread_fn(action->irq, action->dev_id); |
| 742 | irq_finalize_oneshot(desc, action, false); | 749 | irq_finalize_oneshot(desc, action); |
| 743 | local_bh_enable(); | 750 | local_bh_enable(); |
| 744 | return ret; | 751 | return ret; |
| 745 | } | 752 | } |
| @@ -755,7 +762,7 @@ static irqreturn_t irq_thread_fn(struct irq_desc *desc, | |||
| 755 | irqreturn_t ret; | 762 | irqreturn_t ret; |
| 756 | 763 | ||
| 757 | ret = action->thread_fn(action->irq, action->dev_id); | 764 | ret = action->thread_fn(action->irq, action->dev_id); |
| 758 | irq_finalize_oneshot(desc, action, false); | 765 | irq_finalize_oneshot(desc, action); |
| 759 | return ret; | 766 | return ret; |
| 760 | } | 767 | } |
| 761 | 768 | ||
| @@ -844,7 +851,7 @@ void exit_irq_thread(void) | |||
| 844 | wake_threads_waitq(desc); | 851 | wake_threads_waitq(desc); |
| 845 | 852 | ||
| 846 | /* Prevent a stale desc->threads_oneshot */ | 853 | /* Prevent a stale desc->threads_oneshot */ |
| 847 | irq_finalize_oneshot(desc, action, true); | 854 | irq_finalize_oneshot(desc, action); |
| 848 | } | 855 | } |
| 849 | 856 | ||
| 850 | static void irq_setup_forced_threading(struct irqaction *new) | 857 | static void irq_setup_forced_threading(struct irqaction *new) |
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c index 47420908fba0..c3c89751b327 100644 --- a/kernel/irq/migration.c +++ b/kernel/irq/migration.c | |||
| @@ -43,12 +43,16 @@ void irq_move_masked_irq(struct irq_data *idata) | |||
| 43 | * masking the irqs. | 43 | * masking the irqs. |
| 44 | */ | 44 | */ |
| 45 | if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask) | 45 | if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask) |
| 46 | < nr_cpu_ids)) | 46 | < nr_cpu_ids)) { |
| 47 | if (!chip->irq_set_affinity(&desc->irq_data, | 47 | int ret = chip->irq_set_affinity(&desc->irq_data, |
| 48 | desc->pending_mask, false)) { | 48 | desc->pending_mask, false); |
| 49 | switch (ret) { | ||
| 50 | case IRQ_SET_MASK_OK: | ||
| 49 | cpumask_copy(desc->irq_data.affinity, desc->pending_mask); | 51 | cpumask_copy(desc->irq_data.affinity, desc->pending_mask); |
| 52 | case IRQ_SET_MASK_OK_NOCOPY: | ||
| 50 | irq_set_thread_affinity(desc); | 53 | irq_set_thread_affinity(desc); |
| 51 | } | 54 | } |
| 55 | } | ||
| 52 | 56 | ||
| 53 | cpumask_clear(desc->pending_mask); | 57 | cpumask_clear(desc->pending_mask); |
| 54 | } | 58 | } |
diff --git a/kernel/irq_work.c b/kernel/irq_work.c index c3c46c72046e..0c56d44b9fd5 100644 --- a/kernel/irq_work.c +++ b/kernel/irq_work.c | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | * context. The enqueueing is NMI-safe. | 5 | * context. The enqueueing is NMI-safe. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/bug.h> | ||
| 8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 9 | #include <linux/export.h> | 10 | #include <linux/export.h> |
| 10 | #include <linux/irq_work.h> | 11 | #include <linux/irq_work.h> |
diff --git a/kernel/kexec.c b/kernel/kexec.c index a6a675cb9818..4e2e472f6aeb 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | #include <asm/page.h> | 37 | #include <asm/page.h> |
| 38 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
| 39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
| 40 | #include <asm/system.h> | ||
| 41 | #include <asm/sections.h> | 40 | #include <asm/sections.h> |
| 42 | 41 | ||
| 43 | /* Per cpu memory for storing cpu states in case of system crash. */ | 42 | /* Per cpu memory for storing cpu states in case of system crash. */ |
| @@ -1359,6 +1358,10 @@ static int __init parse_crashkernel_simple(char *cmdline, | |||
| 1359 | 1358 | ||
| 1360 | if (*cur == '@') | 1359 | if (*cur == '@') |
| 1361 | *crash_base = memparse(cur+1, &cur); | 1360 | *crash_base = memparse(cur+1, &cur); |
| 1361 | else if (*cur != ' ' && *cur != '\0') { | ||
| 1362 | pr_warning("crashkernel: unrecognized char\n"); | ||
| 1363 | return -EINVAL; | ||
| 1364 | } | ||
| 1362 | 1365 | ||
| 1363 | return 0; | 1366 | return 0; |
| 1364 | } | 1367 | } |
| @@ -1462,7 +1465,9 @@ static int __init crash_save_vmcoreinfo_init(void) | |||
| 1462 | 1465 | ||
| 1463 | VMCOREINFO_SYMBOL(init_uts_ns); | 1466 | VMCOREINFO_SYMBOL(init_uts_ns); |
| 1464 | VMCOREINFO_SYMBOL(node_online_map); | 1467 | VMCOREINFO_SYMBOL(node_online_map); |
| 1468 | #ifdef CONFIG_MMU | ||
| 1465 | VMCOREINFO_SYMBOL(swapper_pg_dir); | 1469 | VMCOREINFO_SYMBOL(swapper_pg_dir); |
| 1470 | #endif | ||
| 1466 | VMCOREINFO_SYMBOL(_stext); | 1471 | VMCOREINFO_SYMBOL(_stext); |
| 1467 | VMCOREINFO_SYMBOL(vmlist); | 1472 | VMCOREINFO_SYMBOL(vmlist); |
| 1468 | 1473 | ||
diff --git a/kernel/kmod.c b/kernel/kmod.c index 957a7aab8ebc..05698a7415fe 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
| @@ -322,7 +322,7 @@ static void __call_usermodehelper(struct work_struct *work) | |||
| 322 | * land has been frozen during a system-wide hibernation or suspend operation). | 322 | * land has been frozen during a system-wide hibernation or suspend operation). |
| 323 | * Should always be manipulated under umhelper_sem acquired for write. | 323 | * Should always be manipulated under umhelper_sem acquired for write. |
| 324 | */ | 324 | */ |
| 325 | static int usermodehelper_disabled = 1; | 325 | static enum umh_disable_depth usermodehelper_disabled = UMH_DISABLED; |
| 326 | 326 | ||
| 327 | /* Number of helpers running */ | 327 | /* Number of helpers running */ |
| 328 | static atomic_t running_helpers = ATOMIC_INIT(0); | 328 | static atomic_t running_helpers = ATOMIC_INIT(0); |
| @@ -334,32 +334,110 @@ static atomic_t running_helpers = ATOMIC_INIT(0); | |||
| 334 | static DECLARE_WAIT_QUEUE_HEAD(running_helpers_waitq); | 334 | static DECLARE_WAIT_QUEUE_HEAD(running_helpers_waitq); |
| 335 | 335 | ||
| 336 | /* | 336 | /* |
| 337 | * Used by usermodehelper_read_lock_wait() to wait for usermodehelper_disabled | ||
| 338 | * to become 'false'. | ||
| 339 | */ | ||
| 340 | static DECLARE_WAIT_QUEUE_HEAD(usermodehelper_disabled_waitq); | ||
| 341 | |||
| 342 | /* | ||
| 337 | * Time to wait for running_helpers to become zero before the setting of | 343 | * Time to wait for running_helpers to become zero before the setting of |
| 338 | * usermodehelper_disabled in usermodehelper_disable() fails | 344 | * usermodehelper_disabled in usermodehelper_disable() fails |
| 339 | */ | 345 | */ |
| 340 | #define RUNNING_HELPERS_TIMEOUT (5 * HZ) | 346 | #define RUNNING_HELPERS_TIMEOUT (5 * HZ) |
| 341 | 347 | ||
| 342 | void read_lock_usermodehelper(void) | 348 | int usermodehelper_read_trylock(void) |
| 343 | { | 349 | { |
| 350 | DEFINE_WAIT(wait); | ||
| 351 | int ret = 0; | ||
| 352 | |||
| 344 | down_read(&umhelper_sem); | 353 | down_read(&umhelper_sem); |
| 354 | for (;;) { | ||
| 355 | prepare_to_wait(&usermodehelper_disabled_waitq, &wait, | ||
| 356 | TASK_INTERRUPTIBLE); | ||
| 357 | if (!usermodehelper_disabled) | ||
| 358 | break; | ||
| 359 | |||
| 360 | if (usermodehelper_disabled == UMH_DISABLED) | ||
| 361 | ret = -EAGAIN; | ||
| 362 | |||
| 363 | up_read(&umhelper_sem); | ||
| 364 | |||
| 365 | if (ret) | ||
| 366 | break; | ||
| 367 | |||
| 368 | schedule(); | ||
| 369 | try_to_freeze(); | ||
| 370 | |||
| 371 | down_read(&umhelper_sem); | ||
| 372 | } | ||
| 373 | finish_wait(&usermodehelper_disabled_waitq, &wait); | ||
| 374 | return ret; | ||
| 375 | } | ||
| 376 | EXPORT_SYMBOL_GPL(usermodehelper_read_trylock); | ||
| 377 | |||
| 378 | long usermodehelper_read_lock_wait(long timeout) | ||
| 379 | { | ||
| 380 | DEFINE_WAIT(wait); | ||
| 381 | |||
| 382 | if (timeout < 0) | ||
| 383 | return -EINVAL; | ||
| 384 | |||
| 385 | down_read(&umhelper_sem); | ||
| 386 | for (;;) { | ||
| 387 | prepare_to_wait(&usermodehelper_disabled_waitq, &wait, | ||
| 388 | TASK_UNINTERRUPTIBLE); | ||
| 389 | if (!usermodehelper_disabled) | ||
| 390 | break; | ||
| 391 | |||
| 392 | up_read(&umhelper_sem); | ||
| 393 | |||
| 394 | timeout = schedule_timeout(timeout); | ||
| 395 | if (!timeout) | ||
| 396 | break; | ||
| 397 | |||
| 398 | down_read(&umhelper_sem); | ||
| 399 | } | ||
| 400 | finish_wait(&usermodehelper_disabled_waitq, &wait); | ||
| 401 | return timeout; | ||
| 345 | } | 402 | } |
| 346 | EXPORT_SYMBOL_GPL(read_lock_usermodehelper); | 403 | EXPORT_SYMBOL_GPL(usermodehelper_read_lock_wait); |
| 347 | 404 | ||
| 348 | void read_unlock_usermodehelper(void) | 405 | void usermodehelper_read_unlock(void) |
| 349 | { | 406 | { |
| 350 | up_read(&umhelper_sem); | 407 | up_read(&umhelper_sem); |
| 351 | } | 408 | } |
| 352 | EXPORT_SYMBOL_GPL(read_unlock_usermodehelper); | 409 | EXPORT_SYMBOL_GPL(usermodehelper_read_unlock); |
| 353 | 410 | ||
| 354 | /** | 411 | /** |
| 355 | * usermodehelper_disable - prevent new helpers from being started | 412 | * __usermodehelper_set_disable_depth - Modify usermodehelper_disabled. |
| 413 | * depth: New value to assign to usermodehelper_disabled. | ||
| 414 | * | ||
| 415 | * Change the value of usermodehelper_disabled (under umhelper_sem locked for | ||
| 416 | * writing) and wakeup tasks waiting for it to change. | ||
| 356 | */ | 417 | */ |
| 357 | int usermodehelper_disable(void) | 418 | void __usermodehelper_set_disable_depth(enum umh_disable_depth depth) |
| 419 | { | ||
| 420 | down_write(&umhelper_sem); | ||
| 421 | usermodehelper_disabled = depth; | ||
| 422 | wake_up(&usermodehelper_disabled_waitq); | ||
| 423 | up_write(&umhelper_sem); | ||
| 424 | } | ||
| 425 | |||
| 426 | /** | ||
| 427 | * __usermodehelper_disable - Prevent new helpers from being started. | ||
| 428 | * @depth: New value to assign to usermodehelper_disabled. | ||
| 429 | * | ||
| 430 | * Set usermodehelper_disabled to @depth and wait for running helpers to exit. | ||
| 431 | */ | ||
| 432 | int __usermodehelper_disable(enum umh_disable_depth depth) | ||
| 358 | { | 433 | { |
| 359 | long retval; | 434 | long retval; |
| 360 | 435 | ||
| 436 | if (!depth) | ||
| 437 | return -EINVAL; | ||
| 438 | |||
| 361 | down_write(&umhelper_sem); | 439 | down_write(&umhelper_sem); |
| 362 | usermodehelper_disabled = 1; | 440 | usermodehelper_disabled = depth; |
| 363 | up_write(&umhelper_sem); | 441 | up_write(&umhelper_sem); |
| 364 | 442 | ||
| 365 | /* | 443 | /* |
| @@ -374,31 +452,10 @@ int usermodehelper_disable(void) | |||
| 374 | if (retval) | 452 | if (retval) |
| 375 | return 0; | 453 | return 0; |
| 376 | 454 | ||
| 377 | down_write(&umhelper_sem); | 455 | __usermodehelper_set_disable_depth(UMH_ENABLED); |
| 378 | usermodehelper_disabled = 0; | ||
| 379 | up_write(&umhelper_sem); | ||
| 380 | return -EAGAIN; | 456 | return -EAGAIN; |
| 381 | } | 457 | } |
| 382 | 458 | ||
| 383 | /** | ||
| 384 | * usermodehelper_enable - allow new helpers to be started again | ||
| 385 | */ | ||
| 386 | void usermodehelper_enable(void) | ||
| 387 | { | ||
| 388 | down_write(&umhelper_sem); | ||
| 389 | usermodehelper_disabled = 0; | ||
| 390 | up_write(&umhelper_sem); | ||
| 391 | } | ||
| 392 | |||
| 393 | /** | ||
| 394 | * usermodehelper_is_disabled - check if new helpers are allowed to be started | ||
| 395 | */ | ||
| 396 | bool usermodehelper_is_disabled(void) | ||
| 397 | { | ||
| 398 | return usermodehelper_disabled; | ||
| 399 | } | ||
| 400 | EXPORT_SYMBOL_GPL(usermodehelper_is_disabled); | ||
| 401 | |||
| 402 | static void helper_lock(void) | 459 | static void helper_lock(void) |
| 403 | { | 460 | { |
| 404 | atomic_inc(&running_helpers); | 461 | atomic_inc(&running_helpers); |
diff --git a/kernel/module.c b/kernel/module.c index 2c932760fd33..78ac6ec1e425 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -105,6 +105,7 @@ struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ | |||
| 105 | 105 | ||
| 106 | /* Block module loading/unloading? */ | 106 | /* Block module loading/unloading? */ |
| 107 | int modules_disabled = 0; | 107 | int modules_disabled = 0; |
| 108 | core_param(nomodule, modules_disabled, bint, 0); | ||
| 108 | 109 | ||
| 109 | /* Waiting for a module to finish initializing? */ | 110 | /* Waiting for a module to finish initializing? */ |
| 110 | static DECLARE_WAIT_QUEUE_HEAD(module_wq); | 111 | static DECLARE_WAIT_QUEUE_HEAD(module_wq); |
| @@ -903,6 +904,36 @@ static ssize_t show_refcnt(struct module_attribute *mattr, | |||
| 903 | static struct module_attribute modinfo_refcnt = | 904 | static struct module_attribute modinfo_refcnt = |
| 904 | __ATTR(refcnt, 0444, show_refcnt, NULL); | 905 | __ATTR(refcnt, 0444, show_refcnt, NULL); |
| 905 | 906 | ||
| 907 | void __module_get(struct module *module) | ||
| 908 | { | ||
| 909 | if (module) { | ||
| 910 | preempt_disable(); | ||
| 911 | __this_cpu_inc(module->refptr->incs); | ||
| 912 | trace_module_get(module, _RET_IP_); | ||
| 913 | preempt_enable(); | ||
| 914 | } | ||
| 915 | } | ||
| 916 | EXPORT_SYMBOL(__module_get); | ||
| 917 | |||
| 918 | bool try_module_get(struct module *module) | ||
| 919 | { | ||
| 920 | bool ret = true; | ||
| 921 | |||
| 922 | if (module) { | ||
| 923 | preempt_disable(); | ||
| 924 | |||
| 925 | if (likely(module_is_live(module))) { | ||
| 926 | __this_cpu_inc(module->refptr->incs); | ||
| 927 | trace_module_get(module, _RET_IP_); | ||
| 928 | } else | ||
| 929 | ret = false; | ||
| 930 | |||
| 931 | preempt_enable(); | ||
| 932 | } | ||
| 933 | return ret; | ||
| 934 | } | ||
| 935 | EXPORT_SYMBOL(try_module_get); | ||
| 936 | |||
| 906 | void module_put(struct module *module) | 937 | void module_put(struct module *module) |
| 907 | { | 938 | { |
| 908 | if (module) { | 939 | if (module) { |
| @@ -2380,8 +2411,7 @@ static int copy_and_check(struct load_info *info, | |||
| 2380 | return -ENOEXEC; | 2411 | return -ENOEXEC; |
| 2381 | 2412 | ||
| 2382 | /* Suck in entire file: we'll want most of it. */ | 2413 | /* Suck in entire file: we'll want most of it. */ |
| 2383 | /* vmalloc barfs on "unusual" numbers. Check here */ | 2414 | if ((hdr = vmalloc(len)) == NULL) |
| 2384 | if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL) | ||
| 2385 | return -ENOMEM; | 2415 | return -ENOMEM; |
| 2386 | 2416 | ||
| 2387 | if (copy_from_user(hdr, umod, len) != 0) { | 2417 | if (copy_from_user(hdr, umod, len) != 0) { |
| @@ -2922,7 +2952,8 @@ static struct module *load_module(void __user *umod, | |||
| 2922 | mutex_unlock(&module_mutex); | 2952 | mutex_unlock(&module_mutex); |
| 2923 | 2953 | ||
| 2924 | /* Module is ready to execute: parsing args may do that. */ | 2954 | /* Module is ready to execute: parsing args may do that. */ |
| 2925 | err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, NULL); | 2955 | err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, |
| 2956 | -32768, 32767, NULL); | ||
| 2926 | if (err < 0) | 2957 | if (err < 0) |
| 2927 | goto unlink; | 2958 | goto unlink; |
| 2928 | 2959 | ||
diff --git a/kernel/padata.c b/kernel/padata.c index 6f10eb285ece..89fe3d1b9efb 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * padata.c - generic interface to process data streams in parallel | 2 | * padata.c - generic interface to process data streams in parallel |
| 3 | * | 3 | * |
| 4 | * See Documentation/padata.txt for an api documentation. | ||
| 5 | * | ||
| 4 | * Copyright (C) 2008, 2009 secunet Security Networks AG | 6 | * Copyright (C) 2008, 2009 secunet Security Networks AG |
| 5 | * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com> | 7 | * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com> |
| 6 | * | 8 | * |
| @@ -354,13 +356,13 @@ static int padata_setup_cpumasks(struct parallel_data *pd, | |||
| 354 | if (!alloc_cpumask_var(&pd->cpumask.pcpu, GFP_KERNEL)) | 356 | if (!alloc_cpumask_var(&pd->cpumask.pcpu, GFP_KERNEL)) |
| 355 | return -ENOMEM; | 357 | return -ENOMEM; |
| 356 | 358 | ||
| 357 | cpumask_and(pd->cpumask.pcpu, pcpumask, cpu_active_mask); | 359 | cpumask_and(pd->cpumask.pcpu, pcpumask, cpu_online_mask); |
| 358 | if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL)) { | 360 | if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL)) { |
| 359 | free_cpumask_var(pd->cpumask.cbcpu); | 361 | free_cpumask_var(pd->cpumask.cbcpu); |
| 360 | return -ENOMEM; | 362 | return -ENOMEM; |
| 361 | } | 363 | } |
| 362 | 364 | ||
| 363 | cpumask_and(pd->cpumask.cbcpu, cbcpumask, cpu_active_mask); | 365 | cpumask_and(pd->cpumask.cbcpu, cbcpumask, cpu_online_mask); |
| 364 | return 0; | 366 | return 0; |
| 365 | } | 367 | } |
| 366 | 368 | ||
| @@ -564,7 +566,7 @@ EXPORT_SYMBOL(padata_unregister_cpumask_notifier); | |||
| 564 | static bool padata_validate_cpumask(struct padata_instance *pinst, | 566 | static bool padata_validate_cpumask(struct padata_instance *pinst, |
| 565 | const struct cpumask *cpumask) | 567 | const struct cpumask *cpumask) |
| 566 | { | 568 | { |
| 567 | if (!cpumask_intersects(cpumask, cpu_active_mask)) { | 569 | if (!cpumask_intersects(cpumask, cpu_online_mask)) { |
| 568 | pinst->flags |= PADATA_INVALID; | 570 | pinst->flags |= PADATA_INVALID; |
| 569 | return false; | 571 | return false; |
| 570 | } | 572 | } |
| @@ -678,7 +680,7 @@ static int __padata_add_cpu(struct padata_instance *pinst, int cpu) | |||
| 678 | { | 680 | { |
| 679 | struct parallel_data *pd; | 681 | struct parallel_data *pd; |
| 680 | 682 | ||
| 681 | if (cpumask_test_cpu(cpu, cpu_active_mask)) { | 683 | if (cpumask_test_cpu(cpu, cpu_online_mask)) { |
| 682 | pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu, | 684 | pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu, |
| 683 | pinst->cpumask.cbcpu); | 685 | pinst->cpumask.cbcpu); |
| 684 | if (!pd) | 686 | if (!pd) |
| @@ -746,6 +748,9 @@ static int __padata_remove_cpu(struct padata_instance *pinst, int cpu) | |||
| 746 | return -ENOMEM; | 748 | return -ENOMEM; |
| 747 | 749 | ||
| 748 | padata_replace(pinst, pd); | 750 | padata_replace(pinst, pd); |
| 751 | |||
| 752 | cpumask_clear_cpu(cpu, pd->cpumask.cbcpu); | ||
| 753 | cpumask_clear_cpu(cpu, pd->cpumask.pcpu); | ||
| 749 | } | 754 | } |
| 750 | 755 | ||
| 751 | return 0; | 756 | return 0; |
diff --git a/kernel/params.c b/kernel/params.c index 47f5bf12434a..f37d82631347 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
| @@ -87,6 +87,8 @@ static int parse_one(char *param, | |||
| 87 | char *val, | 87 | char *val, |
| 88 | const struct kernel_param *params, | 88 | const struct kernel_param *params, |
| 89 | unsigned num_params, | 89 | unsigned num_params, |
| 90 | s16 min_level, | ||
| 91 | s16 max_level, | ||
| 90 | int (*handle_unknown)(char *param, char *val)) | 92 | int (*handle_unknown)(char *param, char *val)) |
| 91 | { | 93 | { |
| 92 | unsigned int i; | 94 | unsigned int i; |
| @@ -95,6 +97,9 @@ static int parse_one(char *param, | |||
| 95 | /* Find parameter */ | 97 | /* Find parameter */ |
| 96 | for (i = 0; i < num_params; i++) { | 98 | for (i = 0; i < num_params; i++) { |
| 97 | if (parameq(param, params[i].name)) { | 99 | if (parameq(param, params[i].name)) { |
| 100 | if (params[i].level < min_level | ||
| 101 | || params[i].level > max_level) | ||
| 102 | return 0; | ||
| 98 | /* No one handled NULL, so do it here. */ | 103 | /* No one handled NULL, so do it here. */ |
| 99 | if (!val && params[i].ops->set != param_set_bool | 104 | if (!val && params[i].ops->set != param_set_bool |
| 100 | && params[i].ops->set != param_set_bint) | 105 | && params[i].ops->set != param_set_bint) |
| @@ -174,6 +179,8 @@ int parse_args(const char *name, | |||
| 174 | char *args, | 179 | char *args, |
| 175 | const struct kernel_param *params, | 180 | const struct kernel_param *params, |
| 176 | unsigned num, | 181 | unsigned num, |
| 182 | s16 min_level, | ||
| 183 | s16 max_level, | ||
| 177 | int (*unknown)(char *param, char *val)) | 184 | int (*unknown)(char *param, char *val)) |
| 178 | { | 185 | { |
| 179 | char *param, *val; | 186 | char *param, *val; |
| @@ -189,7 +196,8 @@ int parse_args(const char *name, | |||
| 189 | 196 | ||
| 190 | args = next_arg(args, ¶m, &val); | 197 | args = next_arg(args, ¶m, &val); |
| 191 | irq_was_disabled = irqs_disabled(); | 198 | irq_was_disabled = irqs_disabled(); |
| 192 | ret = parse_one(param, val, params, num, unknown); | 199 | ret = parse_one(param, val, params, num, |
| 200 | min_level, max_level, unknown); | ||
| 193 | if (irq_was_disabled && !irqs_disabled()) { | 201 | if (irq_was_disabled && !irqs_disabled()) { |
| 194 | printk(KERN_WARNING "parse_args(): option '%s' enabled " | 202 | printk(KERN_WARNING "parse_args(): option '%s' enabled " |
| 195 | "irq's!\n", param); | 203 | "irq's!\n", param); |
| @@ -297,35 +305,18 @@ EXPORT_SYMBOL(param_ops_charp); | |||
| 297 | /* Actually could be a bool or an int, for historical reasons. */ | 305 | /* Actually could be a bool or an int, for historical reasons. */ |
| 298 | int param_set_bool(const char *val, const struct kernel_param *kp) | 306 | int param_set_bool(const char *val, const struct kernel_param *kp) |
| 299 | { | 307 | { |
| 300 | bool v; | ||
| 301 | int ret; | ||
| 302 | |||
| 303 | /* No equals means "set"... */ | 308 | /* No equals means "set"... */ |
| 304 | if (!val) val = "1"; | 309 | if (!val) val = "1"; |
| 305 | 310 | ||
| 306 | /* One of =[yYnN01] */ | 311 | /* One of =[yYnN01] */ |
| 307 | ret = strtobool(val, &v); | 312 | return strtobool(val, kp->arg); |
| 308 | if (ret) | ||
| 309 | return ret; | ||
| 310 | |||
| 311 | if (kp->flags & KPARAM_ISBOOL) | ||
| 312 | *(bool *)kp->arg = v; | ||
| 313 | else | ||
| 314 | *(int *)kp->arg = v; | ||
| 315 | return 0; | ||
| 316 | } | 313 | } |
| 317 | EXPORT_SYMBOL(param_set_bool); | 314 | EXPORT_SYMBOL(param_set_bool); |
| 318 | 315 | ||
| 319 | int param_get_bool(char *buffer, const struct kernel_param *kp) | 316 | int param_get_bool(char *buffer, const struct kernel_param *kp) |
| 320 | { | 317 | { |
| 321 | bool val; | ||
| 322 | if (kp->flags & KPARAM_ISBOOL) | ||
| 323 | val = *(bool *)kp->arg; | ||
| 324 | else | ||
| 325 | val = *(int *)kp->arg; | ||
| 326 | |||
| 327 | /* Y and N chosen as being relatively non-coder friendly */ | 318 | /* Y and N chosen as being relatively non-coder friendly */ |
| 328 | return sprintf(buffer, "%c", val ? 'Y' : 'N'); | 319 | return sprintf(buffer, "%c", *(bool *)kp->arg ? 'Y' : 'N'); |
| 329 | } | 320 | } |
| 330 | EXPORT_SYMBOL(param_get_bool); | 321 | EXPORT_SYMBOL(param_get_bool); |
| 331 | 322 | ||
| @@ -343,7 +334,6 @@ int param_set_invbool(const char *val, const struct kernel_param *kp) | |||
| 343 | struct kernel_param dummy; | 334 | struct kernel_param dummy; |
| 344 | 335 | ||
| 345 | dummy.arg = &boolval; | 336 | dummy.arg = &boolval; |
| 346 | dummy.flags = KPARAM_ISBOOL; | ||
| 347 | ret = param_set_bool(val, &dummy); | 337 | ret = param_set_bool(val, &dummy); |
| 348 | if (ret == 0) | 338 | if (ret == 0) |
| 349 | *(bool *)kp->arg = !boolval; | 339 | *(bool *)kp->arg = !boolval; |
| @@ -372,7 +362,6 @@ int param_set_bint(const char *val, const struct kernel_param *kp) | |||
| 372 | /* Match bool exactly, by re-using it. */ | 362 | /* Match bool exactly, by re-using it. */ |
| 373 | boolkp = *kp; | 363 | boolkp = *kp; |
| 374 | boolkp.arg = &v; | 364 | boolkp.arg = &v; |
| 375 | boolkp.flags |= KPARAM_ISBOOL; | ||
| 376 | 365 | ||
| 377 | ret = param_set_bool(val, &boolkp); | 366 | ret = param_set_bool(val, &boolkp); |
| 378 | if (ret == 0) | 367 | if (ret == 0) |
| @@ -393,7 +382,7 @@ static int param_array(const char *name, | |||
| 393 | unsigned int min, unsigned int max, | 382 | unsigned int min, unsigned int max, |
| 394 | void *elem, int elemsize, | 383 | void *elem, int elemsize, |
| 395 | int (*set)(const char *, const struct kernel_param *kp), | 384 | int (*set)(const char *, const struct kernel_param *kp), |
| 396 | u16 flags, | 385 | s16 level, |
| 397 | unsigned int *num) | 386 | unsigned int *num) |
| 398 | { | 387 | { |
| 399 | int ret; | 388 | int ret; |
| @@ -403,7 +392,7 @@ static int param_array(const char *name, | |||
| 403 | /* Get the name right for errors. */ | 392 | /* Get the name right for errors. */ |
| 404 | kp.name = name; | 393 | kp.name = name; |
| 405 | kp.arg = elem; | 394 | kp.arg = elem; |
| 406 | kp.flags = flags; | 395 | kp.level = level; |
| 407 | 396 | ||
| 408 | *num = 0; | 397 | *num = 0; |
| 409 | /* We expect a comma-separated list of values. */ | 398 | /* We expect a comma-separated list of values. */ |
| @@ -444,7 +433,7 @@ static int param_array_set(const char *val, const struct kernel_param *kp) | |||
| 444 | unsigned int temp_num; | 433 | unsigned int temp_num; |
| 445 | 434 | ||
| 446 | return param_array(kp->name, val, 1, arr->max, arr->elem, | 435 | return param_array(kp->name, val, 1, arr->max, arr->elem, |
| 447 | arr->elemsize, arr->ops->set, kp->flags, | 436 | arr->elemsize, arr->ops->set, kp->level, |
| 448 | arr->num ?: &temp_num); | 437 | arr->num ?: &temp_num); |
| 449 | } | 438 | } |
| 450 | 439 | ||
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 17b232869a04..57bc1fd35b3c 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/acct.h> | 15 | #include <linux/acct.h> |
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
| 18 | #include <linux/reboot.h> | ||
| 18 | 19 | ||
| 19 | #define BITS_PER_PAGE (PAGE_SIZE*8) | 20 | #define BITS_PER_PAGE (PAGE_SIZE*8) |
| 20 | 21 | ||
| @@ -183,6 +184,9 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) | |||
| 183 | rc = sys_wait4(-1, NULL, __WALL, NULL); | 184 | rc = sys_wait4(-1, NULL, __WALL, NULL); |
| 184 | } while (rc != -ECHILD); | 185 | } while (rc != -ECHILD); |
| 185 | 186 | ||
| 187 | if (pid_ns->reboot) | ||
| 188 | current->signal->group_exit_code = pid_ns->reboot; | ||
| 189 | |||
| 186 | acct_exit_ns(pid_ns); | 190 | acct_exit_ns(pid_ns); |
| 187 | return; | 191 | return; |
| 188 | } | 192 | } |
| @@ -217,6 +221,35 @@ static struct ctl_table pid_ns_ctl_table[] = { | |||
| 217 | 221 | ||
| 218 | static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } }; | 222 | static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } }; |
| 219 | 223 | ||
| 224 | int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd) | ||
| 225 | { | ||
| 226 | if (pid_ns == &init_pid_ns) | ||
| 227 | return 0; | ||
| 228 | |||
| 229 | switch (cmd) { | ||
| 230 | case LINUX_REBOOT_CMD_RESTART2: | ||
| 231 | case LINUX_REBOOT_CMD_RESTART: | ||
| 232 | pid_ns->reboot = SIGHUP; | ||
| 233 | break; | ||
| 234 | |||
| 235 | case LINUX_REBOOT_CMD_POWER_OFF: | ||
| 236 | case LINUX_REBOOT_CMD_HALT: | ||
| 237 | pid_ns->reboot = SIGINT; | ||
| 238 | break; | ||
| 239 | default: | ||
| 240 | return -EINVAL; | ||
| 241 | } | ||
| 242 | |||
| 243 | read_lock(&tasklist_lock); | ||
| 244 | force_sig(SIGKILL, pid_ns->child_reaper); | ||
| 245 | read_unlock(&tasklist_lock); | ||
| 246 | |||
| 247 | do_exit(0); | ||
| 248 | |||
| 249 | /* Not reached */ | ||
| 250 | return 0; | ||
| 251 | } | ||
| 252 | |||
| 220 | static __init int pid_namespaces_init(void) | 253 | static __init int pid_namespaces_init(void) |
| 221 | { | 254 | { |
| 222 | pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC); | 255 | pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC); |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 0a186cfde788..e09dfbfeecee 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
| 17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/async.h> | 18 | #include <linux/async.h> |
| 19 | #include <linux/kmod.h> | ||
| 20 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
| 21 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
| 22 | #include <linux/mount.h> | 21 | #include <linux/mount.h> |
| @@ -611,14 +610,10 @@ int hibernate(void) | |||
| 611 | if (error) | 610 | if (error) |
| 612 | goto Exit; | 611 | goto Exit; |
| 613 | 612 | ||
| 614 | error = usermodehelper_disable(); | ||
| 615 | if (error) | ||
| 616 | goto Exit; | ||
| 617 | |||
| 618 | /* Allocate memory management structures */ | 613 | /* Allocate memory management structures */ |
| 619 | error = create_basic_memory_bitmaps(); | 614 | error = create_basic_memory_bitmaps(); |
| 620 | if (error) | 615 | if (error) |
| 621 | goto Enable_umh; | 616 | goto Exit; |
| 622 | 617 | ||
| 623 | printk(KERN_INFO "PM: Syncing filesystems ... "); | 618 | printk(KERN_INFO "PM: Syncing filesystems ... "); |
| 624 | sys_sync(); | 619 | sys_sync(); |
| @@ -661,8 +656,6 @@ int hibernate(void) | |||
| 661 | 656 | ||
| 662 | Free_bitmaps: | 657 | Free_bitmaps: |
| 663 | free_basic_memory_bitmaps(); | 658 | free_basic_memory_bitmaps(); |
| 664 | Enable_umh: | ||
| 665 | usermodehelper_enable(); | ||
| 666 | Exit: | 659 | Exit: |
| 667 | pm_notifier_call_chain(PM_POST_HIBERNATION); | 660 | pm_notifier_call_chain(PM_POST_HIBERNATION); |
| 668 | pm_restore_console(); | 661 | pm_restore_console(); |
| @@ -777,15 +770,9 @@ static int software_resume(void) | |||
| 777 | if (error) | 770 | if (error) |
| 778 | goto close_finish; | 771 | goto close_finish; |
| 779 | 772 | ||
| 780 | error = usermodehelper_disable(); | ||
| 781 | if (error) | ||
| 782 | goto close_finish; | ||
| 783 | |||
| 784 | error = create_basic_memory_bitmaps(); | 773 | error = create_basic_memory_bitmaps(); |
| 785 | if (error) { | 774 | if (error) |
| 786 | usermodehelper_enable(); | ||
| 787 | goto close_finish; | 775 | goto close_finish; |
| 788 | } | ||
| 789 | 776 | ||
| 790 | pr_debug("PM: Preparing processes for restore.\n"); | 777 | pr_debug("PM: Preparing processes for restore.\n"); |
| 791 | error = freeze_processes(); | 778 | error = freeze_processes(); |
| @@ -806,7 +793,6 @@ static int software_resume(void) | |||
| 806 | thaw_processes(); | 793 | thaw_processes(); |
| 807 | Done: | 794 | Done: |
| 808 | free_basic_memory_bitmaps(); | 795 | free_basic_memory_bitmaps(); |
| 809 | usermodehelper_enable(); | ||
| 810 | Finish: | 796 | Finish: |
| 811 | pm_notifier_call_chain(PM_POST_RESTORE); | 797 | pm_notifier_call_chain(PM_POST_RESTORE); |
| 812 | pm_restore_console(); | 798 | pm_restore_console(); |
diff --git a/kernel/power/process.c b/kernel/power/process.c index 0d2aeb226108..19db29f67558 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/freezer.h> | 16 | #include <linux/freezer.h> |
| 17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
| 18 | #include <linux/workqueue.h> | 18 | #include <linux/workqueue.h> |
| 19 | #include <linux/kmod.h> | ||
| 19 | 20 | ||
| 20 | /* | 21 | /* |
| 21 | * Timeout for stopping processes | 22 | * Timeout for stopping processes |
| @@ -122,6 +123,10 @@ int freeze_processes(void) | |||
| 122 | { | 123 | { |
| 123 | int error; | 124 | int error; |
| 124 | 125 | ||
| 126 | error = __usermodehelper_disable(UMH_FREEZING); | ||
| 127 | if (error) | ||
| 128 | return error; | ||
| 129 | |||
| 125 | if (!pm_freezing) | 130 | if (!pm_freezing) |
| 126 | atomic_inc(&system_freezing_cnt); | 131 | atomic_inc(&system_freezing_cnt); |
| 127 | 132 | ||
| @@ -130,6 +135,7 @@ int freeze_processes(void) | |||
| 130 | error = try_to_freeze_tasks(true); | 135 | error = try_to_freeze_tasks(true); |
| 131 | if (!error) { | 136 | if (!error) { |
| 132 | printk("done."); | 137 | printk("done."); |
| 138 | __usermodehelper_set_disable_depth(UMH_DISABLED); | ||
| 133 | oom_killer_disable(); | 139 | oom_killer_disable(); |
| 134 | } | 140 | } |
| 135 | printk("\n"); | 141 | printk("\n"); |
| @@ -187,6 +193,8 @@ void thaw_processes(void) | |||
| 187 | } while_each_thread(g, p); | 193 | } while_each_thread(g, p); |
| 188 | read_unlock(&tasklist_lock); | 194 | read_unlock(&tasklist_lock); |
| 189 | 195 | ||
| 196 | usermodehelper_enable(); | ||
| 197 | |||
| 190 | schedule(); | 198 | schedule(); |
| 191 | printk("done.\n"); | 199 | printk("done.\n"); |
| 192 | } | 200 | } |
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index d6d6dbd1ecc0..6a031e684026 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
| @@ -230,6 +230,21 @@ int pm_qos_request_active(struct pm_qos_request *req) | |||
| 230 | EXPORT_SYMBOL_GPL(pm_qos_request_active); | 230 | EXPORT_SYMBOL_GPL(pm_qos_request_active); |
| 231 | 231 | ||
| 232 | /** | 232 | /** |
| 233 | * pm_qos_work_fn - the timeout handler of pm_qos_update_request_timeout | ||
| 234 | * @work: work struct for the delayed work (timeout) | ||
| 235 | * | ||
| 236 | * This cancels the timeout request by falling back to the default at timeout. | ||
| 237 | */ | ||
| 238 | static void pm_qos_work_fn(struct work_struct *work) | ||
| 239 | { | ||
| 240 | struct pm_qos_request *req = container_of(to_delayed_work(work), | ||
| 241 | struct pm_qos_request, | ||
| 242 | work); | ||
| 243 | |||
| 244 | pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE); | ||
| 245 | } | ||
| 246 | |||
| 247 | /** | ||
| 233 | * pm_qos_add_request - inserts new qos request into the list | 248 | * pm_qos_add_request - inserts new qos request into the list |
| 234 | * @req: pointer to a preallocated handle | 249 | * @req: pointer to a preallocated handle |
| 235 | * @pm_qos_class: identifies which list of qos request to use | 250 | * @pm_qos_class: identifies which list of qos request to use |
| @@ -253,6 +268,7 @@ void pm_qos_add_request(struct pm_qos_request *req, | |||
| 253 | return; | 268 | return; |
| 254 | } | 269 | } |
| 255 | req->pm_qos_class = pm_qos_class; | 270 | req->pm_qos_class = pm_qos_class; |
| 271 | INIT_DELAYED_WORK(&req->work, pm_qos_work_fn); | ||
| 256 | pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints, | 272 | pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints, |
| 257 | &req->node, PM_QOS_ADD_REQ, value); | 273 | &req->node, PM_QOS_ADD_REQ, value); |
| 258 | } | 274 | } |
| @@ -279,6 +295,9 @@ void pm_qos_update_request(struct pm_qos_request *req, | |||
| 279 | return; | 295 | return; |
| 280 | } | 296 | } |
| 281 | 297 | ||
| 298 | if (delayed_work_pending(&req->work)) | ||
| 299 | cancel_delayed_work_sync(&req->work); | ||
| 300 | |||
| 282 | if (new_value != req->node.prio) | 301 | if (new_value != req->node.prio) |
| 283 | pm_qos_update_target( | 302 | pm_qos_update_target( |
| 284 | pm_qos_array[req->pm_qos_class]->constraints, | 303 | pm_qos_array[req->pm_qos_class]->constraints, |
| @@ -287,6 +306,34 @@ void pm_qos_update_request(struct pm_qos_request *req, | |||
| 287 | EXPORT_SYMBOL_GPL(pm_qos_update_request); | 306 | EXPORT_SYMBOL_GPL(pm_qos_update_request); |
| 288 | 307 | ||
| 289 | /** | 308 | /** |
| 309 | * pm_qos_update_request_timeout - modifies an existing qos request temporarily. | ||
| 310 | * @req : handle to list element holding a pm_qos request to use | ||
| 311 | * @new_value: defines the temporal qos request | ||
| 312 | * @timeout_us: the effective duration of this qos request in usecs. | ||
| 313 | * | ||
| 314 | * After timeout_us, this qos request is cancelled automatically. | ||
| 315 | */ | ||
| 316 | void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value, | ||
| 317 | unsigned long timeout_us) | ||
| 318 | { | ||
| 319 | if (!req) | ||
| 320 | return; | ||
| 321 | if (WARN(!pm_qos_request_active(req), | ||
| 322 | "%s called for unknown object.", __func__)) | ||
| 323 | return; | ||
| 324 | |||
| 325 | if (delayed_work_pending(&req->work)) | ||
| 326 | cancel_delayed_work_sync(&req->work); | ||
| 327 | |||
| 328 | if (new_value != req->node.prio) | ||
| 329 | pm_qos_update_target( | ||
| 330 | pm_qos_array[req->pm_qos_class]->constraints, | ||
| 331 | &req->node, PM_QOS_UPDATE_REQ, new_value); | ||
| 332 | |||
| 333 | schedule_delayed_work(&req->work, usecs_to_jiffies(timeout_us)); | ||
| 334 | } | ||
| 335 | |||
| 336 | /** | ||
| 290 | * pm_qos_remove_request - modifies an existing qos request | 337 | * pm_qos_remove_request - modifies an existing qos request |
| 291 | * @req: handle to request list element | 338 | * @req: handle to request list element |
| 292 | * | 339 | * |
| @@ -305,6 +352,9 @@ void pm_qos_remove_request(struct pm_qos_request *req) | |||
| 305 | return; | 352 | return; |
| 306 | } | 353 | } |
| 307 | 354 | ||
| 355 | if (delayed_work_pending(&req->work)) | ||
| 356 | cancel_delayed_work_sync(&req->work); | ||
| 357 | |||
| 308 | pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints, | 358 | pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints, |
| 309 | &req->node, PM_QOS_REMOVE_REQ, | 359 | &req->node, PM_QOS_REMOVE_REQ, |
| 310 | PM_QOS_DEFAULT_VALUE); | 360 | PM_QOS_DEFAULT_VALUE); |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 88e5c967370d..396d262b8fd0 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
| 13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/kmod.h> | ||
| 16 | #include <linux/console.h> | 15 | #include <linux/console.h> |
| 17 | #include <linux/cpu.h> | 16 | #include <linux/cpu.h> |
| 18 | #include <linux/syscalls.h> | 17 | #include <linux/syscalls.h> |
| @@ -102,17 +101,12 @@ static int suspend_prepare(void) | |||
| 102 | if (error) | 101 | if (error) |
| 103 | goto Finish; | 102 | goto Finish; |
| 104 | 103 | ||
| 105 | error = usermodehelper_disable(); | ||
| 106 | if (error) | ||
| 107 | goto Finish; | ||
| 108 | |||
| 109 | error = suspend_freeze_processes(); | 104 | error = suspend_freeze_processes(); |
| 110 | if (!error) | 105 | if (!error) |
| 111 | return 0; | 106 | return 0; |
| 112 | 107 | ||
| 113 | suspend_stats.failed_freeze++; | 108 | suspend_stats.failed_freeze++; |
| 114 | dpm_save_failed_step(SUSPEND_FREEZE); | 109 | dpm_save_failed_step(SUSPEND_FREEZE); |
| 115 | usermodehelper_enable(); | ||
| 116 | Finish: | 110 | Finish: |
| 117 | pm_notifier_call_chain(PM_POST_SUSPEND); | 111 | pm_notifier_call_chain(PM_POST_SUSPEND); |
| 118 | pm_restore_console(); | 112 | pm_restore_console(); |
| @@ -259,7 +253,6 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
| 259 | static void suspend_finish(void) | 253 | static void suspend_finish(void) |
| 260 | { | 254 | { |
| 261 | suspend_thaw_processes(); | 255 | suspend_thaw_processes(); |
| 262 | usermodehelper_enable(); | ||
| 263 | pm_notifier_call_chain(PM_POST_SUSPEND); | 256 | pm_notifier_call_chain(PM_POST_SUSPEND); |
| 264 | pm_restore_console(); | 257 | pm_restore_console(); |
| 265 | } | 258 | } |
diff --git a/kernel/power/user.c b/kernel/power/user.c index 33c4329205af..91b0fd021a95 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <linux/suspend.h> | 12 | #include <linux/suspend.h> |
| 13 | #include <linux/syscalls.h> | 13 | #include <linux/syscalls.h> |
| 14 | #include <linux/reboot.h> | 14 | #include <linux/reboot.h> |
| 15 | #include <linux/kmod.h> | ||
| 16 | #include <linux/string.h> | 15 | #include <linux/string.h> |
| 17 | #include <linux/device.h> | 16 | #include <linux/device.h> |
| 18 | #include <linux/miscdevice.h> | 17 | #include <linux/miscdevice.h> |
| @@ -222,14 +221,8 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
| 222 | sys_sync(); | 221 | sys_sync(); |
| 223 | printk("done.\n"); | 222 | printk("done.\n"); |
| 224 | 223 | ||
| 225 | error = usermodehelper_disable(); | ||
| 226 | if (error) | ||
| 227 | break; | ||
| 228 | |||
| 229 | error = freeze_processes(); | 224 | error = freeze_processes(); |
| 230 | if (error) | 225 | if (!error) |
| 231 | usermodehelper_enable(); | ||
| 232 | else | ||
| 233 | data->frozen = 1; | 226 | data->frozen = 1; |
| 234 | break; | 227 | break; |
| 235 | 228 | ||
| @@ -238,7 +231,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
| 238 | break; | 231 | break; |
| 239 | pm_restore_gfp_mask(); | 232 | pm_restore_gfp_mask(); |
| 240 | thaw_processes(); | 233 | thaw_processes(); |
| 241 | usermodehelper_enable(); | ||
| 242 | data->frozen = 0; | 234 | data->frozen = 0; |
| 243 | break; | 235 | break; |
| 244 | 236 | ||
diff --git a/kernel/rwsem.c b/kernel/rwsem.c index b152f74f02de..6850f53e02d8 100644 --- a/kernel/rwsem.c +++ b/kernel/rwsem.c | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | #include <linux/export.h> | 10 | #include <linux/export.h> |
| 11 | #include <linux/rwsem.h> | 11 | #include <linux/rwsem.h> |
| 12 | 12 | ||
| 13 | #include <asm/system.h> | ||
| 14 | #include <linux/atomic.h> | 13 | #include <linux/atomic.h> |
| 15 | 14 | ||
| 16 | /* | 15 | /* |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 503d6426126d..4603b9d8f30a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | #include <linux/init_task.h> | 73 | #include <linux/init_task.h> |
| 74 | #include <linux/binfmts.h> | 74 | #include <linux/binfmts.h> |
| 75 | 75 | ||
| 76 | #include <asm/switch_to.h> | ||
| 76 | #include <asm/tlb.h> | 77 | #include <asm/tlb.h> |
| 77 | #include <asm/irq_regs.h> | 78 | #include <asm/irq_regs.h> |
| 78 | #include <asm/mutex.h> | 79 | #include <asm/mutex.h> |
| @@ -1264,29 +1265,59 @@ EXPORT_SYMBOL_GPL(kick_process); | |||
| 1264 | */ | 1265 | */ |
| 1265 | static int select_fallback_rq(int cpu, struct task_struct *p) | 1266 | static int select_fallback_rq(int cpu, struct task_struct *p) |
| 1266 | { | 1267 | { |
| 1267 | int dest_cpu; | ||
| 1268 | const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu)); | 1268 | const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu)); |
| 1269 | enum { cpuset, possible, fail } state = cpuset; | ||
| 1270 | int dest_cpu; | ||
| 1269 | 1271 | ||
| 1270 | /* Look for allowed, online CPU in same node. */ | 1272 | /* Look for allowed, online CPU in same node. */ |
| 1271 | for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask) | 1273 | for_each_cpu(dest_cpu, nodemask) { |
| 1274 | if (!cpu_online(dest_cpu)) | ||
| 1275 | continue; | ||
| 1276 | if (!cpu_active(dest_cpu)) | ||
| 1277 | continue; | ||
| 1272 | if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p))) | 1278 | if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p))) |
| 1273 | return dest_cpu; | 1279 | return dest_cpu; |
| 1280 | } | ||
| 1281 | |||
| 1282 | for (;;) { | ||
| 1283 | /* Any allowed, online CPU? */ | ||
| 1284 | for_each_cpu(dest_cpu, tsk_cpus_allowed(p)) { | ||
| 1285 | if (!cpu_online(dest_cpu)) | ||
| 1286 | continue; | ||
| 1287 | if (!cpu_active(dest_cpu)) | ||
| 1288 | continue; | ||
| 1289 | goto out; | ||
| 1290 | } | ||
| 1274 | 1291 | ||
| 1275 | /* Any allowed, online CPU? */ | 1292 | switch (state) { |
| 1276 | dest_cpu = cpumask_any_and(tsk_cpus_allowed(p), cpu_active_mask); | 1293 | case cpuset: |
| 1277 | if (dest_cpu < nr_cpu_ids) | 1294 | /* No more Mr. Nice Guy. */ |
| 1278 | return dest_cpu; | 1295 | cpuset_cpus_allowed_fallback(p); |
| 1296 | state = possible; | ||
| 1297 | break; | ||
| 1279 | 1298 | ||
| 1280 | /* No more Mr. Nice Guy. */ | 1299 | case possible: |
| 1281 | dest_cpu = cpuset_cpus_allowed_fallback(p); | 1300 | do_set_cpus_allowed(p, cpu_possible_mask); |
| 1282 | /* | 1301 | state = fail; |
| 1283 | * Don't tell them about moving exiting tasks or | 1302 | break; |
| 1284 | * kernel threads (both mm NULL), since they never | 1303 | |
| 1285 | * leave kernel. | 1304 | case fail: |
| 1286 | */ | 1305 | BUG(); |
| 1287 | if (p->mm && printk_ratelimit()) { | 1306 | break; |
| 1288 | printk_sched("process %d (%s) no longer affine to cpu%d\n", | 1307 | } |
| 1289 | task_pid_nr(p), p->comm, cpu); | 1308 | } |
| 1309 | |||
| 1310 | out: | ||
| 1311 | if (state != cpuset) { | ||
| 1312 | /* | ||
| 1313 | * Don't tell them about moving exiting tasks or | ||
| 1314 | * kernel threads (both mm NULL), since they never | ||
| 1315 | * leave kernel. | ||
| 1316 | */ | ||
| 1317 | if (p->mm && printk_ratelimit()) { | ||
| 1318 | printk_sched("process %d (%s) no longer affine to cpu%d\n", | ||
| 1319 | task_pid_nr(p), p->comm, cpu); | ||
| 1320 | } | ||
| 1290 | } | 1321 | } |
| 1291 | 1322 | ||
| 1292 | return dest_cpu; | 1323 | return dest_cpu; |
| @@ -1933,6 +1964,7 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev) | |||
| 1933 | local_irq_enable(); | 1964 | local_irq_enable(); |
| 1934 | #endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */ | 1965 | #endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */ |
| 1935 | finish_lock_switch(rq, prev); | 1966 | finish_lock_switch(rq, prev); |
| 1967 | finish_arch_post_lock_switch(); | ||
| 1936 | 1968 | ||
| 1937 | fire_sched_in_preempt_notifiers(current); | 1969 | fire_sched_in_preempt_notifiers(current); |
| 1938 | if (mm) | 1970 | if (mm) |
| @@ -3070,8 +3102,6 @@ EXPORT_SYMBOL(sub_preempt_count); | |||
| 3070 | */ | 3102 | */ |
| 3071 | static noinline void __schedule_bug(struct task_struct *prev) | 3103 | static noinline void __schedule_bug(struct task_struct *prev) |
| 3072 | { | 3104 | { |
| 3073 | struct pt_regs *regs = get_irq_regs(); | ||
| 3074 | |||
| 3075 | if (oops_in_progress) | 3105 | if (oops_in_progress) |
| 3076 | return; | 3106 | return; |
| 3077 | 3107 | ||
| @@ -3082,11 +3112,7 @@ static noinline void __schedule_bug(struct task_struct *prev) | |||
| 3082 | print_modules(); | 3112 | print_modules(); |
| 3083 | if (irqs_disabled()) | 3113 | if (irqs_disabled()) |
| 3084 | print_irqtrace_events(prev); | 3114 | print_irqtrace_events(prev); |
| 3085 | 3115 | dump_stack(); | |
| 3086 | if (regs) | ||
| 3087 | show_regs(regs); | ||
| 3088 | else | ||
| 3089 | dump_stack(); | ||
| 3090 | } | 3116 | } |
| 3091 | 3117 | ||
| 3092 | /* | 3118 | /* |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 94340c7544a9..0d97ebdc58f0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -416,8 +416,8 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse) | |||
| 416 | 416 | ||
| 417 | #endif /* CONFIG_FAIR_GROUP_SCHED */ | 417 | #endif /* CONFIG_FAIR_GROUP_SCHED */ |
| 418 | 418 | ||
| 419 | static void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, | 419 | static __always_inline |
| 420 | unsigned long delta_exec); | 420 | void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, unsigned long delta_exec); |
| 421 | 421 | ||
| 422 | /************************************************************** | 422 | /************************************************************** |
| 423 | * Scheduling class tree data structure manipulation methods: | 423 | * Scheduling class tree data structure manipulation methods: |
| @@ -1162,7 +1162,7 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) | |||
| 1162 | __clear_buddies_skip(se); | 1162 | __clear_buddies_skip(se); |
| 1163 | } | 1163 | } |
| 1164 | 1164 | ||
| 1165 | static void return_cfs_rq_runtime(struct cfs_rq *cfs_rq); | 1165 | static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq); |
| 1166 | 1166 | ||
| 1167 | static void | 1167 | static void |
| 1168 | dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) | 1168 | dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) |
| @@ -1546,8 +1546,8 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, | |||
| 1546 | resched_task(rq_of(cfs_rq)->curr); | 1546 | resched_task(rq_of(cfs_rq)->curr); |
| 1547 | } | 1547 | } |
| 1548 | 1548 | ||
| 1549 | static __always_inline void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, | 1549 | static __always_inline |
| 1550 | unsigned long delta_exec) | 1550 | void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, unsigned long delta_exec) |
| 1551 | { | 1551 | { |
| 1552 | if (!cfs_bandwidth_used() || !cfs_rq->runtime_enabled) | 1552 | if (!cfs_bandwidth_used() || !cfs_rq->runtime_enabled) |
| 1553 | return; | 1553 | return; |
| @@ -2073,11 +2073,11 @@ void unthrottle_offline_cfs_rqs(struct rq *rq) | |||
| 2073 | } | 2073 | } |
| 2074 | 2074 | ||
| 2075 | #else /* CONFIG_CFS_BANDWIDTH */ | 2075 | #else /* CONFIG_CFS_BANDWIDTH */ |
| 2076 | static void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, | 2076 | static __always_inline |
| 2077 | unsigned long delta_exec) {} | 2077 | void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, unsigned long delta_exec) {} |
| 2078 | static void check_cfs_rq_runtime(struct cfs_rq *cfs_rq) {} | 2078 | static void check_cfs_rq_runtime(struct cfs_rq *cfs_rq) {} |
| 2079 | static void check_enqueue_throttle(struct cfs_rq *cfs_rq) {} | 2079 | static void check_enqueue_throttle(struct cfs_rq *cfs_rq) {} |
| 2080 | static void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) {} | 2080 | static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) {} |
| 2081 | 2081 | ||
| 2082 | static inline int cfs_rq_throttled(struct cfs_rq *cfs_rq) | 2082 | static inline int cfs_rq_throttled(struct cfs_rq *cfs_rq) |
| 2083 | { | 2083 | { |
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index b60dad720173..44af55e6d5d0 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
| @@ -1428,7 +1428,7 @@ static struct task_struct *pick_next_highest_task_rt(struct rq *rq, int cpu) | |||
| 1428 | next_idx: | 1428 | next_idx: |
| 1429 | if (idx >= MAX_RT_PRIO) | 1429 | if (idx >= MAX_RT_PRIO) |
| 1430 | continue; | 1430 | continue; |
| 1431 | if (next && next->prio < idx) | 1431 | if (next && next->prio <= idx) |
| 1432 | continue; | 1432 | continue; |
| 1433 | list_for_each_entry(rt_se, array->queue + idx, run_list) { | 1433 | list_for_each_entry(rt_se, array->queue + idx, run_list) { |
| 1434 | struct task_struct *p; | 1434 | struct task_struct *p; |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 42b1f304b044..fb3acba4d52e 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
| @@ -681,6 +681,9 @@ static inline int task_running(struct rq *rq, struct task_struct *p) | |||
| 681 | #ifndef finish_arch_switch | 681 | #ifndef finish_arch_switch |
| 682 | # define finish_arch_switch(prev) do { } while (0) | 682 | # define finish_arch_switch(prev) do { } while (0) |
| 683 | #endif | 683 | #endif |
| 684 | #ifndef finish_arch_post_lock_switch | ||
| 685 | # define finish_arch_post_lock_switch() do { } while (0) | ||
| 686 | #endif | ||
| 684 | 687 | ||
| 685 | #ifndef __ARCH_WANT_UNLOCKED_CTXSW | 688 | #ifndef __ARCH_WANT_UNLOCKED_CTXSW |
| 686 | static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next) | 689 | static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next) |
diff --git a/kernel/signal.c b/kernel/signal.c index d523da02dd14..17afcaf582d0 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
| 37 | #include <asm/unistd.h> | 37 | #include <asm/unistd.h> |
| 38 | #include <asm/siginfo.h> | 38 | #include <asm/siginfo.h> |
| 39 | #include <asm/cacheflush.h> | ||
| 39 | #include "audit.h" /* audit_signal_info() */ | 40 | #include "audit.h" /* audit_signal_info() */ |
| 40 | 41 | ||
| 41 | /* | 42 | /* |
diff --git a/kernel/smp.c b/kernel/smp.c index db197d60489b..2f8b10ecf759 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
| @@ -701,3 +701,93 @@ int on_each_cpu(void (*func) (void *info), void *info, int wait) | |||
| 701 | return ret; | 701 | return ret; |
| 702 | } | 702 | } |
| 703 | EXPORT_SYMBOL(on_each_cpu); | 703 | EXPORT_SYMBOL(on_each_cpu); |
| 704 | |||
| 705 | /** | ||
| 706 | * on_each_cpu_mask(): Run a function on processors specified by | ||
| 707 | * cpumask, which may include the local processor. | ||
| 708 | * @mask: The set of cpus to run on (only runs on online subset). | ||
| 709 | * @func: The function to run. This must be fast and non-blocking. | ||
| 710 | * @info: An arbitrary pointer to pass to the function. | ||
| 711 | * @wait: If true, wait (atomically) until function has completed | ||
| 712 | * on other CPUs. | ||
| 713 | * | ||
| 714 | * If @wait is true, then returns once @func has returned. | ||
| 715 | * | ||
| 716 | * You must not call this function with disabled interrupts or | ||
| 717 | * from a hardware interrupt handler or from a bottom half handler. | ||
| 718 | */ | ||
| 719 | void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func, | ||
| 720 | void *info, bool wait) | ||
| 721 | { | ||
| 722 | int cpu = get_cpu(); | ||
| 723 | |||
| 724 | smp_call_function_many(mask, func, info, wait); | ||
| 725 | if (cpumask_test_cpu(cpu, mask)) { | ||
| 726 | local_irq_disable(); | ||
| 727 | func(info); | ||
| 728 | local_irq_enable(); | ||
| 729 | } | ||
| 730 | put_cpu(); | ||
| 731 | } | ||
| 732 | EXPORT_SYMBOL(on_each_cpu_mask); | ||
| 733 | |||
| 734 | /* | ||
| 735 | * on_each_cpu_cond(): Call a function on each processor for which | ||
| 736 | * the supplied function cond_func returns true, optionally waiting | ||
| 737 | * for all the required CPUs to finish. This may include the local | ||
| 738 | * processor. | ||
| 739 | * @cond_func: A callback function that is passed a cpu id and | ||
| 740 | * the the info parameter. The function is called | ||
| 741 | * with preemption disabled. The function should | ||
| 742 | * return a blooean value indicating whether to IPI | ||
| 743 | * the specified CPU. | ||
| 744 | * @func: The function to run on all applicable CPUs. | ||
| 745 | * This must be fast and non-blocking. | ||
| 746 | * @info: An arbitrary pointer to pass to both functions. | ||
| 747 | * @wait: If true, wait (atomically) until function has | ||
| 748 | * completed on other CPUs. | ||
| 749 | * @gfp_flags: GFP flags to use when allocating the cpumask | ||
| 750 | * used internally by the function. | ||
| 751 | * | ||
| 752 | * The function might sleep if the GFP flags indicates a non | ||
| 753 | * atomic allocation is allowed. | ||
| 754 | * | ||
| 755 | * Preemption is disabled to protect against CPUs going offline but not online. | ||
| 756 | * CPUs going online during the call will not be seen or sent an IPI. | ||
| 757 | * | ||
| 758 | * You must not call this function with disabled interrupts or | ||
| 759 | * from a hardware interrupt handler or from a bottom half handler. | ||
| 760 | */ | ||
| 761 | void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), | ||
| 762 | smp_call_func_t func, void *info, bool wait, | ||
| 763 | gfp_t gfp_flags) | ||
| 764 | { | ||
| 765 | cpumask_var_t cpus; | ||
| 766 | int cpu, ret; | ||
| 767 | |||
| 768 | might_sleep_if(gfp_flags & __GFP_WAIT); | ||
| 769 | |||
| 770 | if (likely(zalloc_cpumask_var(&cpus, (gfp_flags|__GFP_NOWARN)))) { | ||
| 771 | preempt_disable(); | ||
| 772 | for_each_online_cpu(cpu) | ||
| 773 | if (cond_func(cpu, info)) | ||
| 774 | cpumask_set_cpu(cpu, cpus); | ||
| 775 | on_each_cpu_mask(cpus, func, info, wait); | ||
| 776 | preempt_enable(); | ||
| 777 | free_cpumask_var(cpus); | ||
| 778 | } else { | ||
| 779 | /* | ||
| 780 | * No free cpumask, bother. No matter, we'll | ||
| 781 | * just have to IPI them one by one. | ||
| 782 | */ | ||
| 783 | preempt_disable(); | ||
| 784 | for_each_online_cpu(cpu) | ||
| 785 | if (cond_func(cpu, info)) { | ||
| 786 | ret = smp_call_function_single(cpu, func, | ||
| 787 | info, wait); | ||
| 788 | WARN_ON_ONCE(!ret); | ||
| 789 | } | ||
| 790 | preempt_enable(); | ||
| 791 | } | ||
| 792 | } | ||
| 793 | EXPORT_SYMBOL(on_each_cpu_cond); | ||
diff --git a/kernel/spinlock.c b/kernel/spinlock.c index 84c7d96918bf..5cdd8065a3ce 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c | |||
| @@ -163,7 +163,7 @@ void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock) | |||
| 163 | EXPORT_SYMBOL(_raw_spin_lock_bh); | 163 | EXPORT_SYMBOL(_raw_spin_lock_bh); |
| 164 | #endif | 164 | #endif |
| 165 | 165 | ||
| 166 | #ifndef CONFIG_INLINE_SPIN_UNLOCK | 166 | #ifdef CONFIG_UNINLINE_SPIN_UNLOCK |
| 167 | void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) | 167 | void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) |
| 168 | { | 168 | { |
| 169 | __raw_spin_unlock(lock); | 169 | __raw_spin_unlock(lock); |
diff --git a/kernel/sys.c b/kernel/sys.c index 9eb7fcab8df6..e7006eb6c1e4 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -444,6 +444,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, | |||
| 444 | magic2 != LINUX_REBOOT_MAGIC2C)) | 444 | magic2 != LINUX_REBOOT_MAGIC2C)) |
| 445 | return -EINVAL; | 445 | return -EINVAL; |
| 446 | 446 | ||
| 447 | /* | ||
| 448 | * If pid namespaces are enabled and the current task is in a child | ||
| 449 | * pid_namespace, the command is handled by reboot_pid_ns() which will | ||
| 450 | * call do_exit(). | ||
| 451 | */ | ||
| 452 | ret = reboot_pid_ns(task_active_pid_ns(current), cmd); | ||
| 453 | if (ret) | ||
| 454 | return ret; | ||
| 455 | |||
| 447 | /* Instead of trying to make the power_off code look like | 456 | /* Instead of trying to make the power_off code look like |
| 448 | * halt when pm_power_off is not set do it the easy way. | 457 | * halt when pm_power_off is not set do it the easy way. |
| 449 | */ | 458 | */ |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index d48ff4fd44c3..4ab11879aeb4 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/swap.h> | 23 | #include <linux/swap.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/sysctl.h> | 25 | #include <linux/sysctl.h> |
| 26 | #include <linux/bitmap.h> | ||
| 26 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
| 27 | #include <linux/printk.h> | 28 | #include <linux/printk.h> |
| 28 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
| @@ -68,6 +69,9 @@ | |||
| 68 | #include <asm/stacktrace.h> | 69 | #include <asm/stacktrace.h> |
| 69 | #include <asm/io.h> | 70 | #include <asm/io.h> |
| 70 | #endif | 71 | #endif |
| 72 | #ifdef CONFIG_SPARC | ||
| 73 | #include <asm/setup.h> | ||
| 74 | #endif | ||
| 71 | #ifdef CONFIG_BSD_PROCESS_ACCT | 75 | #ifdef CONFIG_BSD_PROCESS_ACCT |
| 72 | #include <linux/acct.h> | 76 | #include <linux/acct.h> |
| 73 | #endif | 77 | #endif |
| @@ -142,7 +146,6 @@ static const int cap_last_cap = CAP_LAST_CAP; | |||
| 142 | #include <linux/inotify.h> | 146 | #include <linux/inotify.h> |
| 143 | #endif | 147 | #endif |
| 144 | #ifdef CONFIG_SPARC | 148 | #ifdef CONFIG_SPARC |
| 145 | #include <asm/system.h> | ||
| 146 | #endif | 149 | #endif |
| 147 | 150 | ||
| 148 | #ifdef CONFIG_SPARC64 | 151 | #ifdef CONFIG_SPARC64 |
| @@ -167,7 +170,7 @@ static int proc_taint(struct ctl_table *table, int write, | |||
| 167 | #endif | 170 | #endif |
| 168 | 171 | ||
| 169 | #ifdef CONFIG_PRINTK | 172 | #ifdef CONFIG_PRINTK |
| 170 | static int proc_dmesg_restrict(struct ctl_table *table, int write, | 173 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
| 171 | void __user *buffer, size_t *lenp, loff_t *ppos); | 174 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 172 | #endif | 175 | #endif |
| 173 | 176 | ||
| @@ -700,7 +703,7 @@ static struct ctl_table kern_table[] = { | |||
| 700 | .data = &dmesg_restrict, | 703 | .data = &dmesg_restrict, |
| 701 | .maxlen = sizeof(int), | 704 | .maxlen = sizeof(int), |
| 702 | .mode = 0644, | 705 | .mode = 0644, |
| 703 | .proc_handler = proc_dointvec_minmax, | 706 | .proc_handler = proc_dointvec_minmax_sysadmin, |
| 704 | .extra1 = &zero, | 707 | .extra1 = &zero, |
| 705 | .extra2 = &one, | 708 | .extra2 = &one, |
| 706 | }, | 709 | }, |
| @@ -709,7 +712,7 @@ static struct ctl_table kern_table[] = { | |||
| 709 | .data = &kptr_restrict, | 712 | .data = &kptr_restrict, |
| 710 | .maxlen = sizeof(int), | 713 | .maxlen = sizeof(int), |
| 711 | .mode = 0644, | 714 | .mode = 0644, |
| 712 | .proc_handler = proc_dmesg_restrict, | 715 | .proc_handler = proc_dointvec_minmax_sysadmin, |
| 713 | .extra1 = &zero, | 716 | .extra1 = &zero, |
| 714 | .extra2 = &two, | 717 | .extra2 = &two, |
| 715 | }, | 718 | }, |
| @@ -1940,7 +1943,7 @@ static int proc_taint(struct ctl_table *table, int write, | |||
| 1940 | } | 1943 | } |
| 1941 | 1944 | ||
| 1942 | #ifdef CONFIG_PRINTK | 1945 | #ifdef CONFIG_PRINTK |
| 1943 | static int proc_dmesg_restrict(struct ctl_table *table, int write, | 1946 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
| 1944 | void __user *buffer, size_t *lenp, loff_t *ppos) | 1947 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 1945 | { | 1948 | { |
| 1946 | if (write && !capable(CAP_SYS_ADMIN)) | 1949 | if (write && !capable(CAP_SYS_ADMIN)) |
| @@ -2393,9 +2396,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, | |||
| 2393 | } | 2396 | } |
| 2394 | } | 2397 | } |
| 2395 | 2398 | ||
| 2396 | while (val_a <= val_b) | 2399 | bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1); |
| 2397 | set_bit(val_a++, tmp_bitmap); | ||
| 2398 | |||
| 2399 | first = 0; | 2400 | first = 0; |
| 2400 | proc_skip_char(&kbuf, &left, '\n'); | 2401 | proc_skip_char(&kbuf, &left, '\n'); |
| 2401 | } | 2402 | } |
| @@ -2438,8 +2439,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, | |||
| 2438 | if (*ppos) | 2439 | if (*ppos) |
| 2439 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); | 2440 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); |
| 2440 | else | 2441 | else |
| 2441 | memcpy(bitmap, tmp_bitmap, | 2442 | bitmap_copy(bitmap, tmp_bitmap, bitmap_len); |
| 2442 | BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long)); | ||
| 2443 | } | 2443 | } |
| 2444 | kfree(tmp_bitmap); | 2444 | kfree(tmp_bitmap); |
| 2445 | *lenp -= left; | 2445 | *lenp -= left; |
diff --git a/kernel/time.c b/kernel/time.c index 73e416db0a1e..ba744cf80696 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
| @@ -163,7 +163,6 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz) | |||
| 163 | return error; | 163 | return error; |
| 164 | 164 | ||
| 165 | if (tz) { | 165 | if (tz) { |
| 166 | /* SMP safe, global irq locking makes it work. */ | ||
| 167 | sys_tz = *tz; | 166 | sys_tz = *tz; |
| 168 | update_vsyscall_tz(); | 167 | update_vsyscall_tz(); |
| 169 | if (firsttime) { | 168 | if (firsttime) { |
| @@ -173,12 +172,7 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz) | |||
| 173 | } | 172 | } |
| 174 | } | 173 | } |
| 175 | if (tv) | 174 | if (tv) |
| 176 | { | ||
| 177 | /* SMP safe, again the code in arch/foo/time.c should | ||
| 178 | * globally block out interrupts when it runs. | ||
| 179 | */ | ||
| 180 | return do_settimeofday(tv); | 175 | return do_settimeofday(tv); |
| 181 | } | ||
| 182 | return 0; | 176 | return 0; |
| 183 | } | 177 | } |
| 184 | 178 | ||
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 8a46f5d64504..8a538c55fc7b 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
| @@ -96,6 +96,11 @@ static int alarmtimer_rtc_add_device(struct device *dev, | |||
| 96 | return 0; | 96 | return 0; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static inline void alarmtimer_rtc_timer_init(void) | ||
| 100 | { | ||
| 101 | rtc_timer_init(&rtctimer, NULL, NULL); | ||
| 102 | } | ||
| 103 | |||
| 99 | static struct class_interface alarmtimer_rtc_interface = { | 104 | static struct class_interface alarmtimer_rtc_interface = { |
| 100 | .add_dev = &alarmtimer_rtc_add_device, | 105 | .add_dev = &alarmtimer_rtc_add_device, |
| 101 | }; | 106 | }; |
| @@ -117,6 +122,7 @@ static inline struct rtc_device *alarmtimer_get_rtcdev(void) | |||
| 117 | #define rtcdev (NULL) | 122 | #define rtcdev (NULL) |
| 118 | static inline int alarmtimer_rtc_interface_setup(void) { return 0; } | 123 | static inline int alarmtimer_rtc_interface_setup(void) { return 0; } |
| 119 | static inline void alarmtimer_rtc_interface_remove(void) { } | 124 | static inline void alarmtimer_rtc_interface_remove(void) { } |
| 125 | static inline void alarmtimer_rtc_timer_init(void) { } | ||
| 120 | #endif | 126 | #endif |
| 121 | 127 | ||
| 122 | /** | 128 | /** |
| @@ -783,6 +789,8 @@ static int __init alarmtimer_init(void) | |||
| 783 | .nsleep = alarm_timer_nsleep, | 789 | .nsleep = alarm_timer_nsleep, |
| 784 | }; | 790 | }; |
| 785 | 791 | ||
| 792 | alarmtimer_rtc_timer_init(); | ||
| 793 | |||
| 786 | posix_timers_register_clock(CLOCK_REALTIME_ALARM, &alarm_clock); | 794 | posix_timers_register_clock(CLOCK_REALTIME_ALARM, &alarm_clock); |
| 787 | posix_timers_register_clock(CLOCK_BOOTTIME_ALARM, &alarm_clock); | 795 | posix_timers_register_clock(CLOCK_BOOTTIME_ALARM, &alarm_clock); |
| 788 | 796 | ||
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index a45ca167ab24..c9583382141a 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
| @@ -500,7 +500,7 @@ static u32 clocksource_max_adjustment(struct clocksource *cs) | |||
| 500 | { | 500 | { |
| 501 | u64 ret; | 501 | u64 ret; |
| 502 | /* | 502 | /* |
| 503 | * We won't try to correct for more then 11% adjustments (110,000 ppm), | 503 | * We won't try to correct for more than 11% adjustments (110,000 ppm), |
| 504 | */ | 504 | */ |
| 505 | ret = (u64)cs->mult * 11; | 505 | ret = (u64)cs->mult * 11; |
| 506 | do_div(ret,100); | 506 | do_div(ret,100); |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 6e039b144daf..f03fd83b170b 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
| @@ -34,8 +34,6 @@ unsigned long tick_nsec; | |||
| 34 | static u64 tick_length; | 34 | static u64 tick_length; |
| 35 | static u64 tick_length_base; | 35 | static u64 tick_length_base; |
| 36 | 36 | ||
| 37 | static struct hrtimer leap_timer; | ||
| 38 | |||
| 39 | #define MAX_TICKADJ 500LL /* usecs */ | 37 | #define MAX_TICKADJ 500LL /* usecs */ |
| 40 | #define MAX_TICKADJ_SCALED \ | 38 | #define MAX_TICKADJ_SCALED \ |
| 41 | (((MAX_TICKADJ * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) | 39 | (((MAX_TICKADJ * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) |
| @@ -381,70 +379,63 @@ u64 ntp_tick_length(void) | |||
| 381 | 379 | ||
| 382 | 380 | ||
| 383 | /* | 381 | /* |
| 384 | * Leap second processing. If in leap-insert state at the end of the | 382 | * this routine handles the overflow of the microsecond field |
| 385 | * day, the system clock is set back one second; if in leap-delete | 383 | * |
| 386 | * state, the system clock is set ahead one second. | 384 | * The tricky bits of code to handle the accurate clock support |
| 385 | * were provided by Dave Mills (Mills@UDEL.EDU) of NTP fame. | ||
| 386 | * They were originally developed for SUN and DEC kernels. | ||
| 387 | * All the kudos should go to Dave for this stuff. | ||
| 388 | * | ||
| 389 | * Also handles leap second processing, and returns leap offset | ||
| 387 | */ | 390 | */ |
| 388 | static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) | 391 | int second_overflow(unsigned long secs) |
| 389 | { | 392 | { |
| 390 | enum hrtimer_restart res = HRTIMER_NORESTART; | 393 | s64 delta; |
| 391 | unsigned long flags; | ||
| 392 | int leap = 0; | 394 | int leap = 0; |
| 395 | unsigned long flags; | ||
| 393 | 396 | ||
| 394 | spin_lock_irqsave(&ntp_lock, flags); | 397 | spin_lock_irqsave(&ntp_lock, flags); |
| 398 | |||
| 399 | /* | ||
| 400 | * Leap second processing. If in leap-insert state at the end of the | ||
| 401 | * day, the system clock is set back one second; if in leap-delete | ||
| 402 | * state, the system clock is set ahead one second. | ||
| 403 | */ | ||
| 395 | switch (time_state) { | 404 | switch (time_state) { |
| 396 | case TIME_OK: | 405 | case TIME_OK: |
| 406 | if (time_status & STA_INS) | ||
| 407 | time_state = TIME_INS; | ||
| 408 | else if (time_status & STA_DEL) | ||
| 409 | time_state = TIME_DEL; | ||
| 397 | break; | 410 | break; |
| 398 | case TIME_INS: | 411 | case TIME_INS: |
| 399 | leap = -1; | 412 | if (secs % 86400 == 0) { |
| 400 | time_state = TIME_OOP; | 413 | leap = -1; |
| 401 | printk(KERN_NOTICE | 414 | time_state = TIME_OOP; |
| 402 | "Clock: inserting leap second 23:59:60 UTC\n"); | 415 | printk(KERN_NOTICE |
| 403 | hrtimer_add_expires_ns(&leap_timer, NSEC_PER_SEC); | 416 | "Clock: inserting leap second 23:59:60 UTC\n"); |
| 404 | res = HRTIMER_RESTART; | 417 | } |
| 405 | break; | 418 | break; |
| 406 | case TIME_DEL: | 419 | case TIME_DEL: |
| 407 | leap = 1; | 420 | if ((secs + 1) % 86400 == 0) { |
| 408 | time_tai--; | 421 | leap = 1; |
| 409 | time_state = TIME_WAIT; | 422 | time_tai--; |
| 410 | printk(KERN_NOTICE | 423 | time_state = TIME_WAIT; |
| 411 | "Clock: deleting leap second 23:59:59 UTC\n"); | 424 | printk(KERN_NOTICE |
| 425 | "Clock: deleting leap second 23:59:59 UTC\n"); | ||
| 426 | } | ||
| 412 | break; | 427 | break; |
| 413 | case TIME_OOP: | 428 | case TIME_OOP: |
| 414 | time_tai++; | 429 | time_tai++; |
| 415 | time_state = TIME_WAIT; | 430 | time_state = TIME_WAIT; |
| 416 | /* fall through */ | 431 | break; |
| 432 | |||
| 417 | case TIME_WAIT: | 433 | case TIME_WAIT: |
| 418 | if (!(time_status & (STA_INS | STA_DEL))) | 434 | if (!(time_status & (STA_INS | STA_DEL))) |
| 419 | time_state = TIME_OK; | 435 | time_state = TIME_OK; |
| 420 | break; | 436 | break; |
| 421 | } | 437 | } |
| 422 | spin_unlock_irqrestore(&ntp_lock, flags); | ||
| 423 | 438 | ||
| 424 | /* | ||
| 425 | * We have to call this outside of the ntp_lock to keep | ||
| 426 | * the proper locking hierarchy | ||
| 427 | */ | ||
| 428 | if (leap) | ||
| 429 | timekeeping_leap_insert(leap); | ||
| 430 | |||
| 431 | return res; | ||
| 432 | } | ||
| 433 | |||
| 434 | /* | ||
| 435 | * this routine handles the overflow of the microsecond field | ||
| 436 | * | ||
| 437 | * The tricky bits of code to handle the accurate clock support | ||
| 438 | * were provided by Dave Mills (Mills@UDEL.EDU) of NTP fame. | ||
| 439 | * They were originally developed for SUN and DEC kernels. | ||
| 440 | * All the kudos should go to Dave for this stuff. | ||
| 441 | */ | ||
| 442 | void second_overflow(void) | ||
| 443 | { | ||
| 444 | s64 delta; | ||
| 445 | unsigned long flags; | ||
| 446 | |||
| 447 | spin_lock_irqsave(&ntp_lock, flags); | ||
| 448 | 439 | ||
| 449 | /* Bump the maxerror field */ | 440 | /* Bump the maxerror field */ |
| 450 | time_maxerror += MAXFREQ / NSEC_PER_USEC; | 441 | time_maxerror += MAXFREQ / NSEC_PER_USEC; |
| @@ -481,15 +472,17 @@ void second_overflow(void) | |||
| 481 | tick_length += (s64)(time_adjust * NSEC_PER_USEC / NTP_INTERVAL_FREQ) | 472 | tick_length += (s64)(time_adjust * NSEC_PER_USEC / NTP_INTERVAL_FREQ) |
| 482 | << NTP_SCALE_SHIFT; | 473 | << NTP_SCALE_SHIFT; |
| 483 | time_adjust = 0; | 474 | time_adjust = 0; |
| 475 | |||
| 476 | |||
| 477 | |||
| 484 | out: | 478 | out: |
| 485 | spin_unlock_irqrestore(&ntp_lock, flags); | 479 | spin_unlock_irqrestore(&ntp_lock, flags); |
| 480 | |||
| 481 | return leap; | ||
| 486 | } | 482 | } |
| 487 | 483 | ||
| 488 | #ifdef CONFIG_GENERIC_CMOS_UPDATE | 484 | #ifdef CONFIG_GENERIC_CMOS_UPDATE |
| 489 | 485 | ||
| 490 | /* Disable the cmos update - used by virtualization and embedded */ | ||
| 491 | int no_sync_cmos_clock __read_mostly; | ||
| 492 | |||
| 493 | static void sync_cmos_clock(struct work_struct *work); | 486 | static void sync_cmos_clock(struct work_struct *work); |
| 494 | 487 | ||
| 495 | static DECLARE_DELAYED_WORK(sync_cmos_work, sync_cmos_clock); | 488 | static DECLARE_DELAYED_WORK(sync_cmos_work, sync_cmos_clock); |
| @@ -536,35 +529,13 @@ static void sync_cmos_clock(struct work_struct *work) | |||
| 536 | 529 | ||
| 537 | static void notify_cmos_timer(void) | 530 | static void notify_cmos_timer(void) |
| 538 | { | 531 | { |
| 539 | if (!no_sync_cmos_clock) | 532 | schedule_delayed_work(&sync_cmos_work, 0); |
| 540 | schedule_delayed_work(&sync_cmos_work, 0); | ||
| 541 | } | 533 | } |
| 542 | 534 | ||
| 543 | #else | 535 | #else |
| 544 | static inline void notify_cmos_timer(void) { } | 536 | static inline void notify_cmos_timer(void) { } |
| 545 | #endif | 537 | #endif |
| 546 | 538 | ||
| 547 | /* | ||
| 548 | * Start the leap seconds timer: | ||
| 549 | */ | ||
| 550 | static inline void ntp_start_leap_timer(struct timespec *ts) | ||
| 551 | { | ||
| 552 | long now = ts->tv_sec; | ||
| 553 | |||
| 554 | if (time_status & STA_INS) { | ||
| 555 | time_state = TIME_INS; | ||
| 556 | now += 86400 - now % 86400; | ||
| 557 | hrtimer_start(&leap_timer, ktime_set(now, 0), HRTIMER_MODE_ABS); | ||
| 558 | |||
| 559 | return; | ||
| 560 | } | ||
| 561 | |||
| 562 | if (time_status & STA_DEL) { | ||
| 563 | time_state = TIME_DEL; | ||
| 564 | now += 86400 - (now + 1) % 86400; | ||
| 565 | hrtimer_start(&leap_timer, ktime_set(now, 0), HRTIMER_MODE_ABS); | ||
| 566 | } | ||
| 567 | } | ||
| 568 | 539 | ||
| 569 | /* | 540 | /* |
| 570 | * Propagate a new txc->status value into the NTP state: | 541 | * Propagate a new txc->status value into the NTP state: |
| @@ -589,22 +560,6 @@ static inline void process_adj_status(struct timex *txc, struct timespec *ts) | |||
| 589 | time_status &= STA_RONLY; | 560 | time_status &= STA_RONLY; |
| 590 | time_status |= txc->status & ~STA_RONLY; | 561 | time_status |= txc->status & ~STA_RONLY; |
| 591 | 562 | ||
| 592 | switch (time_state) { | ||
| 593 | case TIME_OK: | ||
| 594 | ntp_start_leap_timer(ts); | ||
| 595 | break; | ||
| 596 | case TIME_INS: | ||
| 597 | case TIME_DEL: | ||
| 598 | time_state = TIME_OK; | ||
| 599 | ntp_start_leap_timer(ts); | ||
| 600 | case TIME_WAIT: | ||
| 601 | if (!(time_status & (STA_INS | STA_DEL))) | ||
| 602 | time_state = TIME_OK; | ||
| 603 | break; | ||
| 604 | case TIME_OOP: | ||
| 605 | hrtimer_restart(&leap_timer); | ||
| 606 | break; | ||
| 607 | } | ||
| 608 | } | 563 | } |
| 609 | /* | 564 | /* |
| 610 | * Called with the xtime lock held, so we can access and modify | 565 | * Called with the xtime lock held, so we can access and modify |
| @@ -686,9 +641,6 @@ int do_adjtimex(struct timex *txc) | |||
| 686 | (txc->tick < 900000/USER_HZ || | 641 | (txc->tick < 900000/USER_HZ || |
| 687 | txc->tick > 1100000/USER_HZ)) | 642 | txc->tick > 1100000/USER_HZ)) |
| 688 | return -EINVAL; | 643 | return -EINVAL; |
| 689 | |||
| 690 | if (txc->modes & ADJ_STATUS && time_state != TIME_OK) | ||
| 691 | hrtimer_cancel(&leap_timer); | ||
| 692 | } | 644 | } |
| 693 | 645 | ||
| 694 | if (txc->modes & ADJ_SETOFFSET) { | 646 | if (txc->modes & ADJ_SETOFFSET) { |
| @@ -1010,6 +962,4 @@ __setup("ntp_tick_adj=", ntp_tick_adj_setup); | |||
| 1010 | void __init ntp_init(void) | 962 | void __init ntp_init(void) |
| 1011 | { | 963 | { |
| 1012 | ntp_clear(); | 964 | ntp_clear(); |
| 1013 | hrtimer_init(&leap_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); | ||
| 1014 | leap_timer.function = ntp_leap_second; | ||
| 1015 | } | 965 | } |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 15be32e19c6e..d66b21308f7c 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -184,18 +184,6 @@ static void timekeeping_update(bool clearntp) | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | 186 | ||
| 187 | void timekeeping_leap_insert(int leapsecond) | ||
| 188 | { | ||
| 189 | unsigned long flags; | ||
| 190 | |||
| 191 | write_seqlock_irqsave(&timekeeper.lock, flags); | ||
| 192 | timekeeper.xtime.tv_sec += leapsecond; | ||
| 193 | timekeeper.wall_to_monotonic.tv_sec -= leapsecond; | ||
| 194 | timekeeping_update(false); | ||
| 195 | write_sequnlock_irqrestore(&timekeeper.lock, flags); | ||
| 196 | |||
| 197 | } | ||
| 198 | |||
| 199 | /** | 187 | /** |
| 200 | * timekeeping_forward_now - update clock to the current time | 188 | * timekeeping_forward_now - update clock to the current time |
| 201 | * | 189 | * |
| @@ -448,9 +436,12 @@ EXPORT_SYMBOL(timekeeping_inject_offset); | |||
| 448 | static int change_clocksource(void *data) | 436 | static int change_clocksource(void *data) |
| 449 | { | 437 | { |
| 450 | struct clocksource *new, *old; | 438 | struct clocksource *new, *old; |
| 439 | unsigned long flags; | ||
| 451 | 440 | ||
| 452 | new = (struct clocksource *) data; | 441 | new = (struct clocksource *) data; |
| 453 | 442 | ||
| 443 | write_seqlock_irqsave(&timekeeper.lock, flags); | ||
| 444 | |||
| 454 | timekeeping_forward_now(); | 445 | timekeeping_forward_now(); |
| 455 | if (!new->enable || new->enable(new) == 0) { | 446 | if (!new->enable || new->enable(new) == 0) { |
| 456 | old = timekeeper.clock; | 447 | old = timekeeper.clock; |
| @@ -458,6 +449,10 @@ static int change_clocksource(void *data) | |||
| 458 | if (old->disable) | 449 | if (old->disable) |
| 459 | old->disable(old); | 450 | old->disable(old); |
| 460 | } | 451 | } |
| 452 | timekeeping_update(true); | ||
| 453 | |||
| 454 | write_sequnlock_irqrestore(&timekeeper.lock, flags); | ||
| 455 | |||
| 461 | return 0; | 456 | return 0; |
| 462 | } | 457 | } |
| 463 | 458 | ||
| @@ -827,7 +822,7 @@ static void timekeeping_adjust(s64 offset) | |||
| 827 | int adj; | 822 | int adj; |
| 828 | 823 | ||
| 829 | /* | 824 | /* |
| 830 | * The point of this is to check if the error is greater then half | 825 | * The point of this is to check if the error is greater than half |
| 831 | * an interval. | 826 | * an interval. |
| 832 | * | 827 | * |
| 833 | * First we shift it down from NTP_SHIFT to clocksource->shifted nsecs. | 828 | * First we shift it down from NTP_SHIFT to clocksource->shifted nsecs. |
| @@ -835,7 +830,7 @@ static void timekeeping_adjust(s64 offset) | |||
| 835 | * Note we subtract one in the shift, so that error is really error*2. | 830 | * Note we subtract one in the shift, so that error is really error*2. |
| 836 | * This "saves" dividing(shifting) interval twice, but keeps the | 831 | * This "saves" dividing(shifting) interval twice, but keeps the |
| 837 | * (error > interval) comparison as still measuring if error is | 832 | * (error > interval) comparison as still measuring if error is |
| 838 | * larger then half an interval. | 833 | * larger than half an interval. |
| 839 | * | 834 | * |
| 840 | * Note: It does not "save" on aggravation when reading the code. | 835 | * Note: It does not "save" on aggravation when reading the code. |
| 841 | */ | 836 | */ |
| @@ -843,7 +838,7 @@ static void timekeeping_adjust(s64 offset) | |||
| 843 | if (error > interval) { | 838 | if (error > interval) { |
| 844 | /* | 839 | /* |
| 845 | * We now divide error by 4(via shift), which checks if | 840 | * We now divide error by 4(via shift), which checks if |
| 846 | * the error is greater then twice the interval. | 841 | * the error is greater than twice the interval. |
| 847 | * If it is greater, we need a bigadjust, if its smaller, | 842 | * If it is greater, we need a bigadjust, if its smaller, |
| 848 | * we can adjust by 1. | 843 | * we can adjust by 1. |
| 849 | */ | 844 | */ |
| @@ -874,13 +869,15 @@ static void timekeeping_adjust(s64 offset) | |||
| 874 | } else /* No adjustment needed */ | 869 | } else /* No adjustment needed */ |
| 875 | return; | 870 | return; |
| 876 | 871 | ||
| 877 | WARN_ONCE(timekeeper.clock->maxadj && | 872 | if (unlikely(timekeeper.clock->maxadj && |
| 878 | (timekeeper.mult + adj > timekeeper.clock->mult + | 873 | (timekeeper.mult + adj > |
| 879 | timekeeper.clock->maxadj), | 874 | timekeeper.clock->mult + timekeeper.clock->maxadj))) { |
| 880 | "Adjusting %s more then 11%% (%ld vs %ld)\n", | 875 | printk_once(KERN_WARNING |
| 876 | "Adjusting %s more than 11%% (%ld vs %ld)\n", | ||
| 881 | timekeeper.clock->name, (long)timekeeper.mult + adj, | 877 | timekeeper.clock->name, (long)timekeeper.mult + adj, |
| 882 | (long)timekeeper.clock->mult + | 878 | (long)timekeeper.clock->mult + |
| 883 | timekeeper.clock->maxadj); | 879 | timekeeper.clock->maxadj); |
| 880 | } | ||
| 884 | /* | 881 | /* |
| 885 | * So the following can be confusing. | 882 | * So the following can be confusing. |
| 886 | * | 883 | * |
| @@ -952,7 +949,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) | |||
| 952 | u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift; | 949 | u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift; |
| 953 | u64 raw_nsecs; | 950 | u64 raw_nsecs; |
| 954 | 951 | ||
| 955 | /* If the offset is smaller then a shifted interval, do nothing */ | 952 | /* If the offset is smaller than a shifted interval, do nothing */ |
| 956 | if (offset < timekeeper.cycle_interval<<shift) | 953 | if (offset < timekeeper.cycle_interval<<shift) |
| 957 | return offset; | 954 | return offset; |
| 958 | 955 | ||
| @@ -962,9 +959,11 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) | |||
| 962 | 959 | ||
| 963 | timekeeper.xtime_nsec += timekeeper.xtime_interval << shift; | 960 | timekeeper.xtime_nsec += timekeeper.xtime_interval << shift; |
| 964 | while (timekeeper.xtime_nsec >= nsecps) { | 961 | while (timekeeper.xtime_nsec >= nsecps) { |
| 962 | int leap; | ||
| 965 | timekeeper.xtime_nsec -= nsecps; | 963 | timekeeper.xtime_nsec -= nsecps; |
| 966 | timekeeper.xtime.tv_sec++; | 964 | timekeeper.xtime.tv_sec++; |
| 967 | second_overflow(); | 965 | leap = second_overflow(timekeeper.xtime.tv_sec); |
| 966 | timekeeper.xtime.tv_sec += leap; | ||
| 968 | } | 967 | } |
| 969 | 968 | ||
| 970 | /* Accumulate raw time */ | 969 | /* Accumulate raw time */ |
| @@ -1018,13 +1017,13 @@ static void update_wall_time(void) | |||
| 1018 | * With NO_HZ we may have to accumulate many cycle_intervals | 1017 | * With NO_HZ we may have to accumulate many cycle_intervals |
| 1019 | * (think "ticks") worth of time at once. To do this efficiently, | 1018 | * (think "ticks") worth of time at once. To do this efficiently, |
| 1020 | * we calculate the largest doubling multiple of cycle_intervals | 1019 | * we calculate the largest doubling multiple of cycle_intervals |
| 1021 | * that is smaller then the offset. We then accumulate that | 1020 | * that is smaller than the offset. We then accumulate that |
| 1022 | * chunk in one go, and then try to consume the next smaller | 1021 | * chunk in one go, and then try to consume the next smaller |
| 1023 | * doubled multiple. | 1022 | * doubled multiple. |
| 1024 | */ | 1023 | */ |
| 1025 | shift = ilog2(offset) - ilog2(timekeeper.cycle_interval); | 1024 | shift = ilog2(offset) - ilog2(timekeeper.cycle_interval); |
| 1026 | shift = max(0, shift); | 1025 | shift = max(0, shift); |
| 1027 | /* Bound shift to one less then what overflows tick_length */ | 1026 | /* Bound shift to one less than what overflows tick_length */ |
| 1028 | maxshift = (64 - (ilog2(ntp_tick_length())+1)) - 1; | 1027 | maxshift = (64 - (ilog2(ntp_tick_length())+1)) - 1; |
| 1029 | shift = min(shift, maxshift); | 1028 | shift = min(shift, maxshift); |
| 1030 | while (offset >= timekeeper.cycle_interval) { | 1029 | while (offset >= timekeeper.cycle_interval) { |
| @@ -1072,12 +1071,14 @@ static void update_wall_time(void) | |||
| 1072 | 1071 | ||
| 1073 | /* | 1072 | /* |
| 1074 | * Finally, make sure that after the rounding | 1073 | * Finally, make sure that after the rounding |
| 1075 | * xtime.tv_nsec isn't larger then NSEC_PER_SEC | 1074 | * xtime.tv_nsec isn't larger than NSEC_PER_SEC |
| 1076 | */ | 1075 | */ |
| 1077 | if (unlikely(timekeeper.xtime.tv_nsec >= NSEC_PER_SEC)) { | 1076 | if (unlikely(timekeeper.xtime.tv_nsec >= NSEC_PER_SEC)) { |
| 1077 | int leap; | ||
| 1078 | timekeeper.xtime.tv_nsec -= NSEC_PER_SEC; | 1078 | timekeeper.xtime.tv_nsec -= NSEC_PER_SEC; |
| 1079 | timekeeper.xtime.tv_sec++; | 1079 | timekeeper.xtime.tv_sec++; |
| 1080 | second_overflow(); | 1080 | leap = second_overflow(timekeeper.xtime.tv_sec); |
| 1081 | timekeeper.xtime.tv_sec += leap; | ||
| 1081 | } | 1082 | } |
| 1082 | 1083 | ||
| 1083 | timekeeping_update(false); | 1084 | timekeeping_update(false); |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index cdea7b56b0c9..c0bd0308741c 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
| @@ -311,13 +311,6 @@ int blk_trace_remove(struct request_queue *q) | |||
| 311 | } | 311 | } |
| 312 | EXPORT_SYMBOL_GPL(blk_trace_remove); | 312 | EXPORT_SYMBOL_GPL(blk_trace_remove); |
| 313 | 313 | ||
| 314 | static int blk_dropped_open(struct inode *inode, struct file *filp) | ||
| 315 | { | ||
| 316 | filp->private_data = inode->i_private; | ||
| 317 | |||
| 318 | return 0; | ||
| 319 | } | ||
| 320 | |||
| 321 | static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, | 314 | static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, |
| 322 | size_t count, loff_t *ppos) | 315 | size_t count, loff_t *ppos) |
| 323 | { | 316 | { |
| @@ -331,18 +324,11 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, | |||
| 331 | 324 | ||
| 332 | static const struct file_operations blk_dropped_fops = { | 325 | static const struct file_operations blk_dropped_fops = { |
| 333 | .owner = THIS_MODULE, | 326 | .owner = THIS_MODULE, |
| 334 | .open = blk_dropped_open, | 327 | .open = simple_open, |
| 335 | .read = blk_dropped_read, | 328 | .read = blk_dropped_read, |
| 336 | .llseek = default_llseek, | 329 | .llseek = default_llseek, |
| 337 | }; | 330 | }; |
| 338 | 331 | ||
| 339 | static int blk_msg_open(struct inode *inode, struct file *filp) | ||
| 340 | { | ||
| 341 | filp->private_data = inode->i_private; | ||
| 342 | |||
| 343 | return 0; | ||
| 344 | } | ||
| 345 | |||
| 346 | static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, | 332 | static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, |
| 347 | size_t count, loff_t *ppos) | 333 | size_t count, loff_t *ppos) |
| 348 | { | 334 | { |
| @@ -371,7 +357,7 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, | |||
| 371 | 357 | ||
| 372 | static const struct file_operations blk_msg_fops = { | 358 | static const struct file_operations blk_msg_fops = { |
| 373 | .owner = THIS_MODULE, | 359 | .owner = THIS_MODULE, |
| 374 | .open = blk_msg_open, | 360 | .open = simple_open, |
| 375 | .write = blk_msg_write, | 361 | .write = blk_msg_write, |
| 376 | .llseek = noop_llseek, | 362 | .llseek = noop_llseek, |
| 377 | }; | 363 | }; |
