diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/acct.c | 6 | ||||
-rw-r--r-- | kernel/auditsc.c | 5 | ||||
-rw-r--r-- | kernel/capability.c | 2 | ||||
-rw-r--r-- | kernel/compat.c | 35 | ||||
-rw-r--r-- | kernel/cpuset.c | 106 | ||||
-rw-r--r-- | kernel/exit.c | 40 | ||||
-rw-r--r-- | kernel/fork.c | 15 | ||||
-rw-r--r-- | kernel/futex.c | 10 | ||||
-rw-r--r-- | kernel/hrtimer.c | 20 | ||||
-rw-r--r-- | kernel/irq/chip.c | 6 | ||||
-rw-r--r-- | kernel/kexec.c | 8 | ||||
-rw-r--r-- | kernel/kfifo.c | 28 | ||||
-rw-r--r-- | kernel/kmod.c | 12 | ||||
-rw-r--r-- | kernel/lockdep.c | 17 | ||||
-rw-r--r-- | kernel/module.c | 26 | ||||
-rw-r--r-- | kernel/panic.c | 1 | ||||
-rw-r--r-- | kernel/params.c | 15 | ||||
-rw-r--r-- | kernel/posix-cpu-timers.c | 101 | ||||
-rw-r--r-- | kernel/posix-timers.c | 21 | ||||
-rw-r--r-- | kernel/ptrace.c | 1 | ||||
-rw-r--r-- | kernel/rcutorture.c | 8 | ||||
-rw-r--r-- | kernel/relay.c | 36 | ||||
-rw-r--r-- | kernel/rtmutex.c | 51 | ||||
-rw-r--r-- | kernel/sched.c | 74 | ||||
-rw-r--r-- | kernel/signal.c | 6 | ||||
-rw-r--r-- | kernel/softirq.c | 4 | ||||
-rw-r--r-- | kernel/softlockup.c | 3 | ||||
-rw-r--r-- | kernel/spinlock.c | 11 | ||||
-rw-r--r-- | kernel/stop_machine.c | 3 | ||||
-rw-r--r-- | kernel/sys.c | 9 | ||||
-rw-r--r-- | kernel/sys_ni.c | 5 | ||||
-rw-r--r-- | kernel/sysctl.c | 13 | ||||
-rw-r--r-- | kernel/timer.c | 53 | ||||
-rw-r--r-- | kernel/unwind.c | 4 |
34 files changed, 511 insertions, 244 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index 2a7c933651c7..f4330acead46 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -483,10 +483,14 @@ static void do_acct_process(struct file *file) | |||
483 | ac.ac_ppid = current->parent->tgid; | 483 | ac.ac_ppid = current->parent->tgid; |
484 | #endif | 484 | #endif |
485 | 485 | ||
486 | read_lock(&tasklist_lock); /* pin current->signal */ | 486 | mutex_lock(&tty_mutex); |
487 | /* FIXME: Whoever is responsible for current->signal locking needs | ||
488 | to use the same locking all over the kernel and document it */ | ||
489 | read_lock(&tasklist_lock); | ||
487 | ac.ac_tty = current->signal->tty ? | 490 | ac.ac_tty = current->signal->tty ? |
488 | old_encode_dev(tty_devnum(current->signal->tty)) : 0; | 491 | old_encode_dev(tty_devnum(current->signal->tty)) : 0; |
489 | read_unlock(&tasklist_lock); | 492 | read_unlock(&tasklist_lock); |
493 | mutex_unlock(&tty_mutex); | ||
490 | 494 | ||
491 | spin_lock_irq(¤t->sighand->siglock); | 495 | spin_lock_irq(¤t->sighand->siglock); |
492 | ac.ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime))); | 496 | ac.ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime))); |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index fb83c5cb8c32..105147631753 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -817,6 +817,8 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
817 | audit_log_format(ab, " success=%s exit=%ld", | 817 | audit_log_format(ab, " success=%s exit=%ld", |
818 | (context->return_valid==AUDITSC_SUCCESS)?"yes":"no", | 818 | (context->return_valid==AUDITSC_SUCCESS)?"yes":"no", |
819 | context->return_code); | 819 | context->return_code); |
820 | |||
821 | mutex_lock(&tty_mutex); | ||
820 | if (tsk->signal && tsk->signal->tty && tsk->signal->tty->name) | 822 | if (tsk->signal && tsk->signal->tty && tsk->signal->tty->name) |
821 | tty = tsk->signal->tty->name; | 823 | tty = tsk->signal->tty->name; |
822 | else | 824 | else |
@@ -838,6 +840,9 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
838 | context->gid, | 840 | context->gid, |
839 | context->euid, context->suid, context->fsuid, | 841 | context->euid, context->suid, context->fsuid, |
840 | context->egid, context->sgid, context->fsgid, tty); | 842 | context->egid, context->sgid, context->fsgid, tty); |
843 | |||
844 | mutex_unlock(&tty_mutex); | ||
845 | |||
841 | audit_log_task_info(ab, tsk); | 846 | audit_log_task_info(ab, tsk); |
842 | if (context->filterkey) { | 847 | if (context->filterkey) { |
843 | audit_log_format(ab, " key="); | 848 | audit_log_format(ab, " key="); |
diff --git a/kernel/capability.c b/kernel/capability.c index c7685ad00a97..edb845a6e84a 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
@@ -133,7 +133,7 @@ static inline int cap_set_all(kernel_cap_t *effective, | |||
133 | int found = 0; | 133 | int found = 0; |
134 | 134 | ||
135 | do_each_thread(g, target) { | 135 | do_each_thread(g, target) { |
136 | if (target == current || target->pid == 1) | 136 | if (target == current || is_init(target)) |
137 | continue; | 137 | continue; |
138 | found = 1; | 138 | found = 1; |
139 | if (security_capset_check(target, effective, inheritable, | 139 | if (security_capset_check(target, effective, inheritable, |
diff --git a/kernel/compat.c b/kernel/compat.c index 126dee9530aa..b4fbd838cd77 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -22,9 +22,12 @@ | |||
22 | #include <linux/security.h> | 22 | #include <linux/security.h> |
23 | #include <linux/timex.h> | 23 | #include <linux/timex.h> |
24 | #include <linux/migrate.h> | 24 | #include <linux/migrate.h> |
25 | #include <linux/posix-timers.h> | ||
25 | 26 | ||
26 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
27 | 28 | ||
29 | extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); | ||
30 | |||
28 | int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) | 31 | int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) |
29 | { | 32 | { |
30 | return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || | 33 | return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || |
@@ -601,6 +604,30 @@ long compat_sys_clock_getres(clockid_t which_clock, | |||
601 | return err; | 604 | return err; |
602 | } | 605 | } |
603 | 606 | ||
607 | static long compat_clock_nanosleep_restart(struct restart_block *restart) | ||
608 | { | ||
609 | long err; | ||
610 | mm_segment_t oldfs; | ||
611 | struct timespec tu; | ||
612 | struct compat_timespec *rmtp = (struct compat_timespec *)(restart->arg1); | ||
613 | |||
614 | restart->arg1 = (unsigned long) &tu; | ||
615 | oldfs = get_fs(); | ||
616 | set_fs(KERNEL_DS); | ||
617 | err = clock_nanosleep_restart(restart); | ||
618 | set_fs(oldfs); | ||
619 | |||
620 | if ((err == -ERESTART_RESTARTBLOCK) && rmtp && | ||
621 | put_compat_timespec(&tu, rmtp)) | ||
622 | return -EFAULT; | ||
623 | |||
624 | if (err == -ERESTART_RESTARTBLOCK) { | ||
625 | restart->fn = compat_clock_nanosleep_restart; | ||
626 | restart->arg1 = (unsigned long) rmtp; | ||
627 | } | ||
628 | return err; | ||
629 | } | ||
630 | |||
604 | long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, | 631 | long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, |
605 | struct compat_timespec __user *rqtp, | 632 | struct compat_timespec __user *rqtp, |
606 | struct compat_timespec __user *rmtp) | 633 | struct compat_timespec __user *rmtp) |
@@ -608,6 +635,7 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, | |||
608 | long err; | 635 | long err; |
609 | mm_segment_t oldfs; | 636 | mm_segment_t oldfs; |
610 | struct timespec in, out; | 637 | struct timespec in, out; |
638 | struct restart_block *restart; | ||
611 | 639 | ||
612 | if (get_compat_timespec(&in, rqtp)) | 640 | if (get_compat_timespec(&in, rqtp)) |
613 | return -EFAULT; | 641 | return -EFAULT; |
@@ -618,9 +646,16 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, | |||
618 | (struct timespec __user *) &in, | 646 | (struct timespec __user *) &in, |
619 | (struct timespec __user *) &out); | 647 | (struct timespec __user *) &out); |
620 | set_fs(oldfs); | 648 | set_fs(oldfs); |
649 | |||
621 | if ((err == -ERESTART_RESTARTBLOCK) && rmtp && | 650 | if ((err == -ERESTART_RESTARTBLOCK) && rmtp && |
622 | put_compat_timespec(&out, rmtp)) | 651 | put_compat_timespec(&out, rmtp)) |
623 | return -EFAULT; | 652 | return -EFAULT; |
653 | |||
654 | if (err == -ERESTART_RESTARTBLOCK) { | ||
655 | restart = ¤t_thread_info()->restart_block; | ||
656 | restart->fn = compat_clock_nanosleep_restart; | ||
657 | restart->arg1 = (unsigned long) rmtp; | ||
658 | } | ||
624 | return err; | 659 | return err; |
625 | } | 660 | } |
626 | 661 | ||
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 1b32c2c04c15..8c3c400cce91 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -240,7 +240,7 @@ static struct super_block *cpuset_sb; | |||
240 | * A cpuset can only be deleted if both its 'count' of using tasks | 240 | * A cpuset can only be deleted if both its 'count' of using tasks |
241 | * is zero, and its list of 'children' cpusets is empty. Since all | 241 | * is zero, and its list of 'children' cpusets is empty. Since all |
242 | * tasks in the system use _some_ cpuset, and since there is always at | 242 | * tasks in the system use _some_ cpuset, and since there is always at |
243 | * least one task in the system (init, pid == 1), therefore, top_cpuset | 243 | * least one task in the system (init), therefore, top_cpuset |
244 | * always has either children cpusets and/or using tasks. So we don't | 244 | * always has either children cpusets and/or using tasks. So we don't |
245 | * need a special hack to ensure that top_cpuset cannot be deleted. | 245 | * need a special hack to ensure that top_cpuset cannot be deleted. |
246 | * | 246 | * |
@@ -912,6 +912,10 @@ static int update_nodemask(struct cpuset *cs, char *buf) | |||
912 | int fudge; | 912 | int fudge; |
913 | int retval; | 913 | int retval; |
914 | 914 | ||
915 | /* top_cpuset.mems_allowed tracks node_online_map; it's read-only */ | ||
916 | if (cs == &top_cpuset) | ||
917 | return -EACCES; | ||
918 | |||
915 | trialcs = *cs; | 919 | trialcs = *cs; |
916 | retval = nodelist_parse(buf, trialcs.mems_allowed); | 920 | retval = nodelist_parse(buf, trialcs.mems_allowed); |
917 | if (retval < 0) | 921 | if (retval < 0) |
@@ -1221,7 +1225,12 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf) | |||
1221 | 1225 | ||
1222 | task_lock(tsk); | 1226 | task_lock(tsk); |
1223 | oldcs = tsk->cpuset; | 1227 | oldcs = tsk->cpuset; |
1224 | if (!oldcs) { | 1228 | /* |
1229 | * After getting 'oldcs' cpuset ptr, be sure still not exiting. | ||
1230 | * If 'oldcs' might be the top_cpuset due to the_top_cpuset_hack | ||
1231 | * then fail this attach_task(), to avoid breaking top_cpuset.count. | ||
1232 | */ | ||
1233 | if (tsk->flags & PF_EXITING) { | ||
1225 | task_unlock(tsk); | 1234 | task_unlock(tsk); |
1226 | mutex_unlock(&callback_mutex); | 1235 | mutex_unlock(&callback_mutex); |
1227 | put_task_struct(tsk); | 1236 | put_task_struct(tsk); |
@@ -2036,33 +2045,104 @@ out: | |||
2036 | return err; | 2045 | return err; |
2037 | } | 2046 | } |
2038 | 2047 | ||
2048 | #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG) | ||
2039 | /* | 2049 | /* |
2040 | * The top_cpuset tracks what CPUs and Memory Nodes are online, | 2050 | * If common_cpu_mem_hotplug_unplug(), below, unplugs any CPUs |
2041 | * period. This is necessary in order to make cpusets transparent | 2051 | * or memory nodes, we need to walk over the cpuset hierarchy, |
2042 | * (of no affect) on systems that are actively using CPU hotplug | 2052 | * removing that CPU or node from all cpusets. If this removes the |
2043 | * but making no active use of cpusets. | 2053 | * last CPU or node from a cpuset, then the guarantee_online_cpus() |
2044 | * | 2054 | * or guarantee_online_mems() code will use that emptied cpusets |
2045 | * This handles CPU hotplug (cpuhp) events. If someday Memory | 2055 | * parent online CPUs or nodes. Cpusets that were already empty of |
2046 | * Nodes can be hotplugged (dynamically changing node_online_map) | 2056 | * CPUs or nodes are left empty. |
2047 | * then we should handle that too, perhaps in a similar way. | 2057 | * |
2058 | * This routine is intentionally inefficient in a couple of regards. | ||
2059 | * It will check all cpusets in a subtree even if the top cpuset of | ||
2060 | * the subtree has no offline CPUs or nodes. It checks both CPUs and | ||
2061 | * nodes, even though the caller could have been coded to know that | ||
2062 | * only one of CPUs or nodes needed to be checked on a given call. | ||
2063 | * This was done to minimize text size rather than cpu cycles. | ||
2064 | * | ||
2065 | * Call with both manage_mutex and callback_mutex held. | ||
2066 | * | ||
2067 | * Recursive, on depth of cpuset subtree. | ||
2048 | */ | 2068 | */ |
2049 | 2069 | ||
2050 | #ifdef CONFIG_HOTPLUG_CPU | 2070 | static void guarantee_online_cpus_mems_in_subtree(const struct cpuset *cur) |
2051 | static int cpuset_handle_cpuhp(struct notifier_block *nb, | 2071 | { |
2052 | unsigned long phase, void *cpu) | 2072 | struct cpuset *c; |
2073 | |||
2074 | /* Each of our child cpusets mems must be online */ | ||
2075 | list_for_each_entry(c, &cur->children, sibling) { | ||
2076 | guarantee_online_cpus_mems_in_subtree(c); | ||
2077 | if (!cpus_empty(c->cpus_allowed)) | ||
2078 | guarantee_online_cpus(c, &c->cpus_allowed); | ||
2079 | if (!nodes_empty(c->mems_allowed)) | ||
2080 | guarantee_online_mems(c, &c->mems_allowed); | ||
2081 | } | ||
2082 | } | ||
2083 | |||
2084 | /* | ||
2085 | * The cpus_allowed and mems_allowed nodemasks in the top_cpuset track | ||
2086 | * cpu_online_map and node_online_map. Force the top cpuset to track | ||
2087 | * whats online after any CPU or memory node hotplug or unplug event. | ||
2088 | * | ||
2089 | * To ensure that we don't remove a CPU or node from the top cpuset | ||
2090 | * that is currently in use by a child cpuset (which would violate | ||
2091 | * the rule that cpusets must be subsets of their parent), we first | ||
2092 | * call the recursive routine guarantee_online_cpus_mems_in_subtree(). | ||
2093 | * | ||
2094 | * Since there are two callers of this routine, one for CPU hotplug | ||
2095 | * events and one for memory node hotplug events, we could have coded | ||
2096 | * two separate routines here. We code it as a single common routine | ||
2097 | * in order to minimize text size. | ||
2098 | */ | ||
2099 | |||
2100 | static void common_cpu_mem_hotplug_unplug(void) | ||
2053 | { | 2101 | { |
2054 | mutex_lock(&manage_mutex); | 2102 | mutex_lock(&manage_mutex); |
2055 | mutex_lock(&callback_mutex); | 2103 | mutex_lock(&callback_mutex); |
2056 | 2104 | ||
2105 | guarantee_online_cpus_mems_in_subtree(&top_cpuset); | ||
2057 | top_cpuset.cpus_allowed = cpu_online_map; | 2106 | top_cpuset.cpus_allowed = cpu_online_map; |
2107 | top_cpuset.mems_allowed = node_online_map; | ||
2058 | 2108 | ||
2059 | mutex_unlock(&callback_mutex); | 2109 | mutex_unlock(&callback_mutex); |
2060 | mutex_unlock(&manage_mutex); | 2110 | mutex_unlock(&manage_mutex); |
2111 | } | ||
2112 | #endif | ||
2113 | |||
2114 | #ifdef CONFIG_HOTPLUG_CPU | ||
2115 | /* | ||
2116 | * The top_cpuset tracks what CPUs and Memory Nodes are online, | ||
2117 | * period. This is necessary in order to make cpusets transparent | ||
2118 | * (of no affect) on systems that are actively using CPU hotplug | ||
2119 | * but making no active use of cpusets. | ||
2120 | * | ||
2121 | * This routine ensures that top_cpuset.cpus_allowed tracks | ||
2122 | * cpu_online_map on each CPU hotplug (cpuhp) event. | ||
2123 | */ | ||
2061 | 2124 | ||
2125 | static int cpuset_handle_cpuhp(struct notifier_block *nb, | ||
2126 | unsigned long phase, void *cpu) | ||
2127 | { | ||
2128 | common_cpu_mem_hotplug_unplug(); | ||
2062 | return 0; | 2129 | return 0; |
2063 | } | 2130 | } |
2064 | #endif | 2131 | #endif |
2065 | 2132 | ||
2133 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
2134 | /* | ||
2135 | * Keep top_cpuset.mems_allowed tracking node_online_map. | ||
2136 | * Call this routine anytime after you change node_online_map. | ||
2137 | * See also the previous routine cpuset_handle_cpuhp(). | ||
2138 | */ | ||
2139 | |||
2140 | void cpuset_track_online_nodes() | ||
2141 | { | ||
2142 | common_cpu_mem_hotplug_unplug(); | ||
2143 | } | ||
2144 | #endif | ||
2145 | |||
2066 | /** | 2146 | /** |
2067 | * cpuset_init_smp - initialize cpus_allowed | 2147 | * cpuset_init_smp - initialize cpus_allowed |
2068 | * | 2148 | * |
diff --git a/kernel/exit.c b/kernel/exit.c index d891883420f7..c189de2927ab 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/pipe_fs_i.h> | 38 | #include <linux/pipe_fs_i.h> |
39 | #include <linux/audit.h> /* for audit_free() */ | 39 | #include <linux/audit.h> /* for audit_free() */ |
40 | #include <linux/resource.h> | 40 | #include <linux/resource.h> |
41 | #include <linux/blkdev.h> | ||
41 | 42 | ||
42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
43 | #include <asm/unistd.h> | 44 | #include <asm/unistd.h> |
@@ -219,7 +220,7 @@ static int will_become_orphaned_pgrp(int pgrp, struct task_struct *ignored_task) | |||
219 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 220 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { |
220 | if (p == ignored_task | 221 | if (p == ignored_task |
221 | || p->exit_state | 222 | || p->exit_state |
222 | || p->real_parent->pid == 1) | 223 | || is_init(p->real_parent)) |
223 | continue; | 224 | continue; |
224 | if (process_group(p->real_parent) != pgrp | 225 | if (process_group(p->real_parent) != pgrp |
225 | && p->real_parent->signal->session == p->signal->session) { | 226 | && p->real_parent->signal->session == p->signal->session) { |
@@ -249,17 +250,6 @@ static int has_stopped_jobs(int pgrp) | |||
249 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 250 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { |
250 | if (p->state != TASK_STOPPED) | 251 | if (p->state != TASK_STOPPED) |
251 | continue; | 252 | continue; |
252 | |||
253 | /* If p is stopped by a debugger on a signal that won't | ||
254 | stop it, then don't count p as stopped. This isn't | ||
255 | perfect but it's a good approximation. */ | ||
256 | if (unlikely (p->ptrace) | ||
257 | && p->exit_code != SIGSTOP | ||
258 | && p->exit_code != SIGTSTP | ||
259 | && p->exit_code != SIGTTOU | ||
260 | && p->exit_code != SIGTTIN) | ||
261 | continue; | ||
262 | |||
263 | retval = 1; | 253 | retval = 1; |
264 | break; | 254 | break; |
265 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); | 255 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); |
@@ -292,9 +282,7 @@ static void reparent_to_init(void) | |||
292 | /* Set the exit signal to SIGCHLD so we signal init on exit */ | 282 | /* Set the exit signal to SIGCHLD so we signal init on exit */ |
293 | current->exit_signal = SIGCHLD; | 283 | current->exit_signal = SIGCHLD; |
294 | 284 | ||
295 | if ((current->policy == SCHED_NORMAL || | 285 | if (!has_rt_policy(current) && (task_nice(current) < 0)) |
296 | current->policy == SCHED_BATCH) | ||
297 | && (task_nice(current) < 0)) | ||
298 | set_user_nice(current, 0); | 286 | set_user_nice(current, 0); |
299 | /* cpus_allowed? */ | 287 | /* cpus_allowed? */ |
300 | /* rt_priority? */ | 288 | /* rt_priority? */ |
@@ -487,6 +475,18 @@ void fastcall put_files_struct(struct files_struct *files) | |||
487 | 475 | ||
488 | EXPORT_SYMBOL(put_files_struct); | 476 | EXPORT_SYMBOL(put_files_struct); |
489 | 477 | ||
478 | void reset_files_struct(struct task_struct *tsk, struct files_struct *files) | ||
479 | { | ||
480 | struct files_struct *old; | ||
481 | |||
482 | old = tsk->files; | ||
483 | task_lock(tsk); | ||
484 | tsk->files = files; | ||
485 | task_unlock(tsk); | ||
486 | put_files_struct(old); | ||
487 | } | ||
488 | EXPORT_SYMBOL(reset_files_struct); | ||
489 | |||
490 | static inline void __exit_files(struct task_struct *tsk) | 490 | static inline void __exit_files(struct task_struct *tsk) |
491 | { | 491 | { |
492 | struct files_struct * files = tsk->files; | 492 | struct files_struct * files = tsk->files; |
@@ -954,15 +954,15 @@ fastcall NORET_TYPE void do_exit(long code) | |||
954 | if (tsk->splice_pipe) | 954 | if (tsk->splice_pipe) |
955 | __free_pipe_info(tsk->splice_pipe); | 955 | __free_pipe_info(tsk->splice_pipe); |
956 | 956 | ||
957 | /* PF_DEAD causes final put_task_struct after we schedule. */ | ||
958 | preempt_disable(); | 957 | preempt_disable(); |
959 | BUG_ON(tsk->flags & PF_DEAD); | 958 | /* causes final put_task_struct in finish_task_switch(). */ |
960 | tsk->flags |= PF_DEAD; | 959 | tsk->state = TASK_DEAD; |
961 | 960 | ||
962 | schedule(); | 961 | schedule(); |
963 | BUG(); | 962 | BUG(); |
964 | /* Avoid "noreturn function does return". */ | 963 | /* Avoid "noreturn function does return". */ |
965 | for (;;) ; | 964 | for (;;) |
965 | cpu_relax(); /* For when BUG is null */ | ||
966 | } | 966 | } |
967 | 967 | ||
968 | EXPORT_SYMBOL_GPL(do_exit); | 968 | EXPORT_SYMBOL_GPL(do_exit); |
@@ -971,7 +971,7 @@ NORET_TYPE void complete_and_exit(struct completion *comp, long code) | |||
971 | { | 971 | { |
972 | if (comp) | 972 | if (comp) |
973 | complete(comp); | 973 | complete(comp); |
974 | 974 | ||
975 | do_exit(code); | 975 | do_exit(code); |
976 | } | 976 | } |
977 | 977 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index a0dad84567c9..1c999f3e0b47 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -183,7 +183,9 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
183 | /* One for us, one for whoever does the "release_task()" (usually parent) */ | 183 | /* One for us, one for whoever does the "release_task()" (usually parent) */ |
184 | atomic_set(&tsk->usage,2); | 184 | atomic_set(&tsk->usage,2); |
185 | atomic_set(&tsk->fs_excl, 0); | 185 | atomic_set(&tsk->fs_excl, 0); |
186 | #ifdef CONFIG_BLK_DEV_IO_TRACE | ||
186 | tsk->btrace_seq = 0; | 187 | tsk->btrace_seq = 0; |
188 | #endif | ||
187 | tsk->splice_pipe = NULL; | 189 | tsk->splice_pipe = NULL; |
188 | return tsk; | 190 | return tsk; |
189 | } | 191 | } |
@@ -1061,7 +1063,11 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1061 | #endif | 1063 | #endif |
1062 | #ifdef CONFIG_TRACE_IRQFLAGS | 1064 | #ifdef CONFIG_TRACE_IRQFLAGS |
1063 | p->irq_events = 0; | 1065 | p->irq_events = 0; |
1066 | #ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW | ||
1067 | p->hardirqs_enabled = 1; | ||
1068 | #else | ||
1064 | p->hardirqs_enabled = 0; | 1069 | p->hardirqs_enabled = 0; |
1070 | #endif | ||
1065 | p->hardirq_enable_ip = 0; | 1071 | p->hardirq_enable_ip = 0; |
1066 | p->hardirq_enable_event = 0; | 1072 | p->hardirq_enable_event = 0; |
1067 | p->hardirq_disable_ip = _THIS_IP_; | 1073 | p->hardirq_disable_ip = _THIS_IP_; |
@@ -1144,7 +1150,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1144 | 1150 | ||
1145 | /* Our parent execution domain becomes current domain | 1151 | /* Our parent execution domain becomes current domain |
1146 | These must match for thread signalling to apply */ | 1152 | These must match for thread signalling to apply */ |
1147 | |||
1148 | p->parent_exec_id = p->self_exec_id; | 1153 | p->parent_exec_id = p->self_exec_id; |
1149 | 1154 | ||
1150 | /* ok, now we should be set up.. */ | 1155 | /* ok, now we should be set up.. */ |
@@ -1167,6 +1172,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1167 | /* Need tasklist lock for parent etc handling! */ | 1172 | /* Need tasklist lock for parent etc handling! */ |
1168 | write_lock_irq(&tasklist_lock); | 1173 | write_lock_irq(&tasklist_lock); |
1169 | 1174 | ||
1175 | /* for sys_ioprio_set(IOPRIO_WHO_PGRP) */ | ||
1176 | p->ioprio = current->ioprio; | ||
1177 | |||
1170 | /* | 1178 | /* |
1171 | * The task hasn't been attached yet, so its cpus_allowed mask will | 1179 | * The task hasn't been attached yet, so its cpus_allowed mask will |
1172 | * not be changed, nor will its assigned CPU. | 1180 | * not be changed, nor will its assigned CPU. |
@@ -1226,11 +1234,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1226 | } | 1234 | } |
1227 | } | 1235 | } |
1228 | 1236 | ||
1229 | /* | ||
1230 | * inherit ioprio | ||
1231 | */ | ||
1232 | p->ioprio = current->ioprio; | ||
1233 | |||
1234 | if (likely(p->pid)) { | 1237 | if (likely(p->pid)) { |
1235 | add_parent(p); | 1238 | add_parent(p); |
1236 | if (unlikely(p->ptrace & PT_PTRACED)) | 1239 | if (unlikely(p->ptrace & PT_PTRACED)) |
diff --git a/kernel/futex.c b/kernel/futex.c index 9d260e838cff..4b6770e9806d 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -389,7 +389,7 @@ static struct task_struct * futex_find_get_task(pid_t pid) | |||
389 | { | 389 | { |
390 | struct task_struct *p; | 390 | struct task_struct *p; |
391 | 391 | ||
392 | read_lock(&tasklist_lock); | 392 | rcu_read_lock(); |
393 | p = find_task_by_pid(pid); | 393 | p = find_task_by_pid(pid); |
394 | if (!p) | 394 | if (!p) |
395 | goto out_unlock; | 395 | goto out_unlock; |
@@ -403,7 +403,7 @@ static struct task_struct * futex_find_get_task(pid_t pid) | |||
403 | } | 403 | } |
404 | get_task_struct(p); | 404 | get_task_struct(p); |
405 | out_unlock: | 405 | out_unlock: |
406 | read_unlock(&tasklist_lock); | 406 | rcu_read_unlock(); |
407 | 407 | ||
408 | return p; | 408 | return p; |
409 | } | 409 | } |
@@ -1624,7 +1624,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr, | |||
1624 | struct task_struct *p; | 1624 | struct task_struct *p; |
1625 | 1625 | ||
1626 | ret = -ESRCH; | 1626 | ret = -ESRCH; |
1627 | read_lock(&tasklist_lock); | 1627 | rcu_read_lock(); |
1628 | p = find_task_by_pid(pid); | 1628 | p = find_task_by_pid(pid); |
1629 | if (!p) | 1629 | if (!p) |
1630 | goto err_unlock; | 1630 | goto err_unlock; |
@@ -1633,7 +1633,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr, | |||
1633 | !capable(CAP_SYS_PTRACE)) | 1633 | !capable(CAP_SYS_PTRACE)) |
1634 | goto err_unlock; | 1634 | goto err_unlock; |
1635 | head = p->robust_list; | 1635 | head = p->robust_list; |
1636 | read_unlock(&tasklist_lock); | 1636 | rcu_read_unlock(); |
1637 | } | 1637 | } |
1638 | 1638 | ||
1639 | if (put_user(sizeof(*head), len_ptr)) | 1639 | if (put_user(sizeof(*head), len_ptr)) |
@@ -1641,7 +1641,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr, | |||
1641 | return put_user(head, head_ptr); | 1641 | return put_user(head, head_ptr); |
1642 | 1642 | ||
1643 | err_unlock: | 1643 | err_unlock: |
1644 | read_unlock(&tasklist_lock); | 1644 | rcu_read_unlock(); |
1645 | 1645 | ||
1646 | return ret; | 1646 | return ret; |
1647 | } | 1647 | } |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 21c38a7e666b..d0ba190dfeb6 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -693,7 +693,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod | |||
693 | return t->task == NULL; | 693 | return t->task == NULL; |
694 | } | 694 | } |
695 | 695 | ||
696 | static long __sched nanosleep_restart(struct restart_block *restart) | 696 | long __sched hrtimer_nanosleep_restart(struct restart_block *restart) |
697 | { | 697 | { |
698 | struct hrtimer_sleeper t; | 698 | struct hrtimer_sleeper t; |
699 | struct timespec __user *rmtp; | 699 | struct timespec __user *rmtp; |
@@ -702,13 +702,13 @@ static long __sched nanosleep_restart(struct restart_block *restart) | |||
702 | 702 | ||
703 | restart->fn = do_no_restart_syscall; | 703 | restart->fn = do_no_restart_syscall; |
704 | 704 | ||
705 | hrtimer_init(&t.timer, restart->arg3, HRTIMER_ABS); | 705 | hrtimer_init(&t.timer, restart->arg0, HRTIMER_ABS); |
706 | t.timer.expires.tv64 = ((u64)restart->arg1 << 32) | (u64) restart->arg0; | 706 | t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2; |
707 | 707 | ||
708 | if (do_nanosleep(&t, HRTIMER_ABS)) | 708 | if (do_nanosleep(&t, HRTIMER_ABS)) |
709 | return 0; | 709 | return 0; |
710 | 710 | ||
711 | rmtp = (struct timespec __user *) restart->arg2; | 711 | rmtp = (struct timespec __user *) restart->arg1; |
712 | if (rmtp) { | 712 | if (rmtp) { |
713 | time = ktime_sub(t.timer.expires, t.timer.base->get_time()); | 713 | time = ktime_sub(t.timer.expires, t.timer.base->get_time()); |
714 | if (time.tv64 <= 0) | 714 | if (time.tv64 <= 0) |
@@ -718,7 +718,7 @@ static long __sched nanosleep_restart(struct restart_block *restart) | |||
718 | return -EFAULT; | 718 | return -EFAULT; |
719 | } | 719 | } |
720 | 720 | ||
721 | restart->fn = nanosleep_restart; | 721 | restart->fn = hrtimer_nanosleep_restart; |
722 | 722 | ||
723 | /* The other values in restart are already filled in */ | 723 | /* The other values in restart are already filled in */ |
724 | return -ERESTART_RESTARTBLOCK; | 724 | return -ERESTART_RESTARTBLOCK; |
@@ -751,11 +751,11 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, | |||
751 | } | 751 | } |
752 | 752 | ||
753 | restart = ¤t_thread_info()->restart_block; | 753 | restart = ¤t_thread_info()->restart_block; |
754 | restart->fn = nanosleep_restart; | 754 | restart->fn = hrtimer_nanosleep_restart; |
755 | restart->arg0 = t.timer.expires.tv64 & 0xFFFFFFFF; | 755 | restart->arg0 = (unsigned long) t.timer.base->index; |
756 | restart->arg1 = t.timer.expires.tv64 >> 32; | 756 | restart->arg1 = (unsigned long) rmtp; |
757 | restart->arg2 = (unsigned long) rmtp; | 757 | restart->arg2 = t.timer.expires.tv64 & 0xFFFFFFFF; |
758 | restart->arg3 = (unsigned long) t.timer.base->index; | 758 | restart->arg3 = t.timer.expires.tv64 >> 32; |
759 | 759 | ||
760 | return -ERESTART_RESTARTBLOCK; | 760 | return -ERESTART_RESTARTBLOCK; |
761 | } | 761 | } |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index ac1f850d4937..736cb0bd498f 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -40,10 +40,6 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip) | |||
40 | spin_lock_irqsave(&desc->lock, flags); | 40 | spin_lock_irqsave(&desc->lock, flags); |
41 | irq_chip_set_defaults(chip); | 41 | irq_chip_set_defaults(chip); |
42 | desc->chip = chip; | 42 | desc->chip = chip; |
43 | /* | ||
44 | * For compatibility only: | ||
45 | */ | ||
46 | desc->chip = chip; | ||
47 | spin_unlock_irqrestore(&desc->lock, flags); | 43 | spin_unlock_irqrestore(&desc->lock, flags); |
48 | 44 | ||
49 | return 0; | 45 | return 0; |
@@ -146,7 +142,7 @@ static void default_disable(unsigned int irq) | |||
146 | struct irq_desc *desc = irq_desc + irq; | 142 | struct irq_desc *desc = irq_desc + irq; |
147 | 143 | ||
148 | if (!(desc->status & IRQ_DELAYED_DISABLE)) | 144 | if (!(desc->status & IRQ_DELAYED_DISABLE)) |
149 | irq_desc[irq].chip->mask(irq); | 145 | desc->chip->mask(irq); |
150 | } | 146 | } |
151 | 147 | ||
152 | /* | 148 | /* |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 50087ecf337e..fcdd5d2bc3f4 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -40,7 +40,7 @@ struct resource crashk_res = { | |||
40 | 40 | ||
41 | int kexec_should_crash(struct task_struct *p) | 41 | int kexec_should_crash(struct task_struct *p) |
42 | { | 42 | { |
43 | if (in_interrupt() || !p->pid || p->pid == 1 || panic_on_oops) | 43 | if (in_interrupt() || !p->pid || is_init(p) || panic_on_oops) |
44 | return 1; | 44 | return 1; |
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
@@ -995,7 +995,8 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, | |||
995 | image = xchg(dest_image, image); | 995 | image = xchg(dest_image, image); |
996 | 996 | ||
997 | out: | 997 | out: |
998 | xchg(&kexec_lock, 0); /* Release the mutex */ | 998 | locked = xchg(&kexec_lock, 0); /* Release the mutex */ |
999 | BUG_ON(!locked); | ||
999 | kimage_free(image); | 1000 | kimage_free(image); |
1000 | 1001 | ||
1001 | return result; | 1002 | return result; |
@@ -1061,7 +1062,8 @@ void crash_kexec(struct pt_regs *regs) | |||
1061 | machine_crash_shutdown(&fixed_regs); | 1062 | machine_crash_shutdown(&fixed_regs); |
1062 | machine_kexec(kexec_crash_image); | 1063 | machine_kexec(kexec_crash_image); |
1063 | } | 1064 | } |
1064 | xchg(&kexec_lock, 0); | 1065 | locked = xchg(&kexec_lock, 0); |
1066 | BUG_ON(!locked); | ||
1065 | } | 1067 | } |
1066 | } | 1068 | } |
1067 | 1069 | ||
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 64ab045c3d9d..5d1d907378a2 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c | |||
@@ -122,6 +122,13 @@ unsigned int __kfifo_put(struct kfifo *fifo, | |||
122 | 122 | ||
123 | len = min(len, fifo->size - fifo->in + fifo->out); | 123 | len = min(len, fifo->size - fifo->in + fifo->out); |
124 | 124 | ||
125 | /* | ||
126 | * Ensure that we sample the fifo->out index -before- we | ||
127 | * start putting bytes into the kfifo. | ||
128 | */ | ||
129 | |||
130 | smp_mb(); | ||
131 | |||
125 | /* first put the data starting from fifo->in to buffer end */ | 132 | /* first put the data starting from fifo->in to buffer end */ |
126 | l = min(len, fifo->size - (fifo->in & (fifo->size - 1))); | 133 | l = min(len, fifo->size - (fifo->in & (fifo->size - 1))); |
127 | memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l); | 134 | memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l); |
@@ -129,6 +136,13 @@ unsigned int __kfifo_put(struct kfifo *fifo, | |||
129 | /* then put the rest (if any) at the beginning of the buffer */ | 136 | /* then put the rest (if any) at the beginning of the buffer */ |
130 | memcpy(fifo->buffer, buffer + l, len - l); | 137 | memcpy(fifo->buffer, buffer + l, len - l); |
131 | 138 | ||
139 | /* | ||
140 | * Ensure that we add the bytes to the kfifo -before- | ||
141 | * we update the fifo->in index. | ||
142 | */ | ||
143 | |||
144 | smp_wmb(); | ||
145 | |||
132 | fifo->in += len; | 146 | fifo->in += len; |
133 | 147 | ||
134 | return len; | 148 | return len; |
@@ -154,6 +168,13 @@ unsigned int __kfifo_get(struct kfifo *fifo, | |||
154 | 168 | ||
155 | len = min(len, fifo->in - fifo->out); | 169 | len = min(len, fifo->in - fifo->out); |
156 | 170 | ||
171 | /* | ||
172 | * Ensure that we sample the fifo->in index -before- we | ||
173 | * start removing bytes from the kfifo. | ||
174 | */ | ||
175 | |||
176 | smp_rmb(); | ||
177 | |||
157 | /* first get the data from fifo->out until the end of the buffer */ | 178 | /* first get the data from fifo->out until the end of the buffer */ |
158 | l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); | 179 | l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); |
159 | memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l); | 180 | memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l); |
@@ -161,6 +182,13 @@ unsigned int __kfifo_get(struct kfifo *fifo, | |||
161 | /* then get the rest (if any) from the beginning of the buffer */ | 182 | /* then get the rest (if any) from the beginning of the buffer */ |
162 | memcpy(buffer + l, fifo->buffer, len - l); | 183 | memcpy(buffer + l, fifo->buffer, len - l); |
163 | 184 | ||
185 | /* | ||
186 | * Ensure that we remove the bytes from the kfifo -before- | ||
187 | * we update the fifo->out index. | ||
188 | */ | ||
189 | |||
190 | smp_mb(); | ||
191 | |||
164 | fifo->out += len; | 192 | fifo->out += len; |
165 | 193 | ||
166 | return len; | 194 | return len; |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 5c470c57fb57..842f8015d7fd 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -176,6 +176,8 @@ static int wait_for_helper(void *data) | |||
176 | if (pid < 0) { | 176 | if (pid < 0) { |
177 | sub_info->retval = pid; | 177 | sub_info->retval = pid; |
178 | } else { | 178 | } else { |
179 | int ret; | ||
180 | |||
179 | /* | 181 | /* |
180 | * Normally it is bogus to call wait4() from in-kernel because | 182 | * Normally it is bogus to call wait4() from in-kernel because |
181 | * wait4() wants to write the exit code to a userspace address. | 183 | * wait4() wants to write the exit code to a userspace address. |
@@ -185,7 +187,15 @@ static int wait_for_helper(void *data) | |||
185 | * | 187 | * |
186 | * Thus the __user pointer cast is valid here. | 188 | * Thus the __user pointer cast is valid here. |
187 | */ | 189 | */ |
188 | sys_wait4(pid, (int __user *) &sub_info->retval, 0, NULL); | 190 | sys_wait4(pid, (int __user *)&ret, 0, NULL); |
191 | |||
192 | /* | ||
193 | * If ret is 0, either ____call_usermodehelper failed and the | ||
194 | * real error code is already in sub_info->retval or | ||
195 | * sub_info->retval is 0 anyway, so don't mess with it then. | ||
196 | */ | ||
197 | if (ret) | ||
198 | sub_info->retval = ret; | ||
189 | } | 199 | } |
190 | 200 | ||
191 | complete(sub_info->complete); | 201 | complete(sub_info->complete); |
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index c088e5542e84..e596525669ed 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/stacktrace.h> | 36 | #include <linux/stacktrace.h> |
37 | #include <linux/debug_locks.h> | 37 | #include <linux/debug_locks.h> |
38 | #include <linux/irqflags.h> | 38 | #include <linux/irqflags.h> |
39 | #include <linux/utsname.h> | ||
39 | 40 | ||
40 | #include <asm/sections.h> | 41 | #include <asm/sections.h> |
41 | 42 | ||
@@ -121,8 +122,8 @@ static struct list_head chainhash_table[CHAINHASH_SIZE]; | |||
121 | * unique. | 122 | * unique. |
122 | */ | 123 | */ |
123 | #define iterate_chain_key(key1, key2) \ | 124 | #define iterate_chain_key(key1, key2) \ |
124 | (((key1) << MAX_LOCKDEP_KEYS_BITS/2) ^ \ | 125 | (((key1) << MAX_LOCKDEP_KEYS_BITS) ^ \ |
125 | ((key1) >> (64-MAX_LOCKDEP_KEYS_BITS/2)) ^ \ | 126 | ((key1) >> (64-MAX_LOCKDEP_KEYS_BITS)) ^ \ |
126 | (key2)) | 127 | (key2)) |
127 | 128 | ||
128 | void lockdep_off(void) | 129 | void lockdep_off(void) |
@@ -515,6 +516,13 @@ print_circular_bug_entry(struct lock_list *target, unsigned int depth) | |||
515 | return 0; | 516 | return 0; |
516 | } | 517 | } |
517 | 518 | ||
519 | static void print_kernel_version(void) | ||
520 | { | ||
521 | printk("%s %.*s\n", system_utsname.release, | ||
522 | (int)strcspn(system_utsname.version, " "), | ||
523 | system_utsname.version); | ||
524 | } | ||
525 | |||
518 | /* | 526 | /* |
519 | * When a circular dependency is detected, print the | 527 | * When a circular dependency is detected, print the |
520 | * header first: | 528 | * header first: |
@@ -531,6 +539,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth) | |||
531 | 539 | ||
532 | printk("\n=======================================================\n"); | 540 | printk("\n=======================================================\n"); |
533 | printk( "[ INFO: possible circular locking dependency detected ]\n"); | 541 | printk( "[ INFO: possible circular locking dependency detected ]\n"); |
542 | print_kernel_version(); | ||
534 | printk( "-------------------------------------------------------\n"); | 543 | printk( "-------------------------------------------------------\n"); |
535 | printk("%s/%d is trying to acquire lock:\n", | 544 | printk("%s/%d is trying to acquire lock:\n", |
536 | curr->comm, curr->pid); | 545 | curr->comm, curr->pid); |
@@ -712,6 +721,7 @@ print_bad_irq_dependency(struct task_struct *curr, | |||
712 | printk("\n======================================================\n"); | 721 | printk("\n======================================================\n"); |
713 | printk( "[ INFO: %s-safe -> %s-unsafe lock order detected ]\n", | 722 | printk( "[ INFO: %s-safe -> %s-unsafe lock order detected ]\n", |
714 | irqclass, irqclass); | 723 | irqclass, irqclass); |
724 | print_kernel_version(); | ||
715 | printk( "------------------------------------------------------\n"); | 725 | printk( "------------------------------------------------------\n"); |
716 | printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n", | 726 | printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n", |
717 | curr->comm, curr->pid, | 727 | curr->comm, curr->pid, |
@@ -793,6 +803,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev, | |||
793 | 803 | ||
794 | printk("\n=============================================\n"); | 804 | printk("\n=============================================\n"); |
795 | printk( "[ INFO: possible recursive locking detected ]\n"); | 805 | printk( "[ INFO: possible recursive locking detected ]\n"); |
806 | print_kernel_version(); | ||
796 | printk( "---------------------------------------------\n"); | 807 | printk( "---------------------------------------------\n"); |
797 | printk("%s/%d is trying to acquire lock:\n", | 808 | printk("%s/%d is trying to acquire lock:\n", |
798 | curr->comm, curr->pid); | 809 | curr->comm, curr->pid); |
@@ -1375,6 +1386,7 @@ print_irq_inversion_bug(struct task_struct *curr, struct lock_class *other, | |||
1375 | 1386 | ||
1376 | printk("\n=========================================================\n"); | 1387 | printk("\n=========================================================\n"); |
1377 | printk( "[ INFO: possible irq lock inversion dependency detected ]\n"); | 1388 | printk( "[ INFO: possible irq lock inversion dependency detected ]\n"); |
1389 | print_kernel_version(); | ||
1378 | printk( "---------------------------------------------------------\n"); | 1390 | printk( "---------------------------------------------------------\n"); |
1379 | printk("%s/%d just changed the state of lock:\n", | 1391 | printk("%s/%d just changed the state of lock:\n", |
1380 | curr->comm, curr->pid); | 1392 | curr->comm, curr->pid); |
@@ -1469,6 +1481,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this, | |||
1469 | 1481 | ||
1470 | printk("\n=================================\n"); | 1482 | printk("\n=================================\n"); |
1471 | printk( "[ INFO: inconsistent lock state ]\n"); | 1483 | printk( "[ INFO: inconsistent lock state ]\n"); |
1484 | print_kernel_version(); | ||
1472 | printk( "---------------------------------\n"); | 1485 | printk( "---------------------------------\n"); |
1473 | 1486 | ||
1474 | printk("inconsistent {%s} -> {%s} usage.\n", | 1487 | printk("inconsistent {%s} -> {%s} usage.\n", |
diff --git a/kernel/module.c b/kernel/module.c index b7fe6e840963..05625d5dc758 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -933,6 +933,15 @@ static ssize_t module_sect_show(struct module_attribute *mattr, | |||
933 | return sprintf(buf, "0x%lx\n", sattr->address); | 933 | return sprintf(buf, "0x%lx\n", sattr->address); |
934 | } | 934 | } |
935 | 935 | ||
936 | static void free_sect_attrs(struct module_sect_attrs *sect_attrs) | ||
937 | { | ||
938 | int section; | ||
939 | |||
940 | for (section = 0; section < sect_attrs->nsections; section++) | ||
941 | kfree(sect_attrs->attrs[section].name); | ||
942 | kfree(sect_attrs); | ||
943 | } | ||
944 | |||
936 | static void add_sect_attrs(struct module *mod, unsigned int nsect, | 945 | static void add_sect_attrs(struct module *mod, unsigned int nsect, |
937 | char *secstrings, Elf_Shdr *sechdrs) | 946 | char *secstrings, Elf_Shdr *sechdrs) |
938 | { | 947 | { |
@@ -949,21 +958,26 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, | |||
949 | + nloaded * sizeof(sect_attrs->attrs[0]), | 958 | + nloaded * sizeof(sect_attrs->attrs[0]), |
950 | sizeof(sect_attrs->grp.attrs[0])); | 959 | sizeof(sect_attrs->grp.attrs[0])); |
951 | size[1] = (nloaded + 1) * sizeof(sect_attrs->grp.attrs[0]); | 960 | size[1] = (nloaded + 1) * sizeof(sect_attrs->grp.attrs[0]); |
952 | if (! (sect_attrs = kmalloc(size[0] + size[1], GFP_KERNEL))) | 961 | sect_attrs = kzalloc(size[0] + size[1], GFP_KERNEL); |
962 | if (sect_attrs == NULL) | ||
953 | return; | 963 | return; |
954 | 964 | ||
955 | /* Setup section attributes. */ | 965 | /* Setup section attributes. */ |
956 | sect_attrs->grp.name = "sections"; | 966 | sect_attrs->grp.name = "sections"; |
957 | sect_attrs->grp.attrs = (void *)sect_attrs + size[0]; | 967 | sect_attrs->grp.attrs = (void *)sect_attrs + size[0]; |
958 | 968 | ||
969 | sect_attrs->nsections = 0; | ||
959 | sattr = §_attrs->attrs[0]; | 970 | sattr = §_attrs->attrs[0]; |
960 | gattr = §_attrs->grp.attrs[0]; | 971 | gattr = §_attrs->grp.attrs[0]; |
961 | for (i = 0; i < nsect; i++) { | 972 | for (i = 0; i < nsect; i++) { |
962 | if (! (sechdrs[i].sh_flags & SHF_ALLOC)) | 973 | if (! (sechdrs[i].sh_flags & SHF_ALLOC)) |
963 | continue; | 974 | continue; |
964 | sattr->address = sechdrs[i].sh_addr; | 975 | sattr->address = sechdrs[i].sh_addr; |
965 | strlcpy(sattr->name, secstrings + sechdrs[i].sh_name, | 976 | sattr->name = kstrdup(secstrings + sechdrs[i].sh_name, |
966 | MODULE_SECT_NAME_LEN); | 977 | GFP_KERNEL); |
978 | if (sattr->name == NULL) | ||
979 | goto out; | ||
980 | sect_attrs->nsections++; | ||
967 | sattr->mattr.show = module_sect_show; | 981 | sattr->mattr.show = module_sect_show; |
968 | sattr->mattr.store = NULL; | 982 | sattr->mattr.store = NULL; |
969 | sattr->mattr.attr.name = sattr->name; | 983 | sattr->mattr.attr.name = sattr->name; |
@@ -979,7 +993,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, | |||
979 | mod->sect_attrs = sect_attrs; | 993 | mod->sect_attrs = sect_attrs; |
980 | return; | 994 | return; |
981 | out: | 995 | out: |
982 | kfree(sect_attrs); | 996 | free_sect_attrs(sect_attrs); |
983 | } | 997 | } |
984 | 998 | ||
985 | static void remove_sect_attrs(struct module *mod) | 999 | static void remove_sect_attrs(struct module *mod) |
@@ -989,13 +1003,13 @@ static void remove_sect_attrs(struct module *mod) | |||
989 | &mod->sect_attrs->grp); | 1003 | &mod->sect_attrs->grp); |
990 | /* We are positive that no one is using any sect attrs | 1004 | /* We are positive that no one is using any sect attrs |
991 | * at this point. Deallocate immediately. */ | 1005 | * at this point. Deallocate immediately. */ |
992 | kfree(mod->sect_attrs); | 1006 | free_sect_attrs(mod->sect_attrs); |
993 | mod->sect_attrs = NULL; | 1007 | mod->sect_attrs = NULL; |
994 | } | 1008 | } |
995 | } | 1009 | } |
996 | 1010 | ||
997 | |||
998 | #else | 1011 | #else |
1012 | |||
999 | static inline void add_sect_attrs(struct module *mod, unsigned int nsect, | 1013 | static inline void add_sect_attrs(struct module *mod, unsigned int nsect, |
1000 | char *sectstrings, Elf_Shdr *sechdrs) | 1014 | char *sectstrings, Elf_Shdr *sechdrs) |
1001 | { | 1015 | { |
diff --git a/kernel/panic.c b/kernel/panic.c index 6ceb664fb52a..525e365f7239 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/debug_locks.h> | 21 | #include <linux/debug_locks.h> |
22 | 22 | ||
23 | int panic_on_oops; | 23 | int panic_on_oops; |
24 | int panic_on_unrecovered_nmi; | ||
25 | int tainted; | 24 | int tainted; |
26 | static int pause_on_oops; | 25 | static int pause_on_oops; |
27 | static int pause_on_oops_flag; | 26 | static int pause_on_oops_flag; |
diff --git a/kernel/params.c b/kernel/params.c index 91aea7aa532e..f406655d6653 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -547,6 +547,7 @@ static void __init kernel_param_sysfs_setup(const char *name, | |||
547 | unsigned int name_skip) | 547 | unsigned int name_skip) |
548 | { | 548 | { |
549 | struct module_kobject *mk; | 549 | struct module_kobject *mk; |
550 | int ret; | ||
550 | 551 | ||
551 | mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL); | 552 | mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL); |
552 | BUG_ON(!mk); | 553 | BUG_ON(!mk); |
@@ -554,7 +555,8 @@ static void __init kernel_param_sysfs_setup(const char *name, | |||
554 | mk->mod = THIS_MODULE; | 555 | mk->mod = THIS_MODULE; |
555 | kobj_set_kset_s(mk, module_subsys); | 556 | kobj_set_kset_s(mk, module_subsys); |
556 | kobject_set_name(&mk->kobj, name); | 557 | kobject_set_name(&mk->kobj, name); |
557 | kobject_register(&mk->kobj); | 558 | ret = kobject_register(&mk->kobj); |
559 | BUG_ON(ret < 0); | ||
558 | 560 | ||
559 | /* no need to keep the kobject if no parameter is exported */ | 561 | /* no need to keep the kobject if no parameter is exported */ |
560 | if (!param_sysfs_setup(mk, kparam, num_params, name_skip)) { | 562 | if (!param_sysfs_setup(mk, kparam, num_params, name_skip)) { |
@@ -684,13 +686,20 @@ decl_subsys(module, &module_ktype, NULL); | |||
684 | */ | 686 | */ |
685 | static int __init param_sysfs_init(void) | 687 | static int __init param_sysfs_init(void) |
686 | { | 688 | { |
687 | subsystem_register(&module_subsys); | 689 | int ret; |
690 | |||
691 | ret = subsystem_register(&module_subsys); | ||
692 | if (ret < 0) { | ||
693 | printk(KERN_WARNING "%s (%d): subsystem_register error: %d\n", | ||
694 | __FILE__, __LINE__, ret); | ||
695 | return ret; | ||
696 | } | ||
688 | 697 | ||
689 | param_sysfs_builtin(); | 698 | param_sysfs_builtin(); |
690 | 699 | ||
691 | return 0; | 700 | return 0; |
692 | } | 701 | } |
693 | __initcall(param_sysfs_init); | 702 | subsys_initcall(param_sysfs_init); |
694 | 703 | ||
695 | EXPORT_SYMBOL(param_set_byte); | 704 | EXPORT_SYMBOL(param_set_byte); |
696 | EXPORT_SYMBOL(param_get_byte); | 705 | EXPORT_SYMBOL(param_get_byte); |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index d38d9ec3276c..479b16b44f79 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -1393,25 +1393,13 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, | |||
1393 | } | 1393 | } |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | static long posix_cpu_clock_nanosleep_restart(struct restart_block *); | 1396 | static int do_cpu_nanosleep(const clockid_t which_clock, int flags, |
1397 | 1397 | struct timespec *rqtp, struct itimerspec *it) | |
1398 | int posix_cpu_nsleep(const clockid_t which_clock, int flags, | ||
1399 | struct timespec *rqtp, struct timespec __user *rmtp) | ||
1400 | { | 1398 | { |
1401 | struct restart_block *restart_block = | ||
1402 | ¤t_thread_info()->restart_block; | ||
1403 | struct k_itimer timer; | 1399 | struct k_itimer timer; |
1404 | int error; | 1400 | int error; |
1405 | 1401 | ||
1406 | /* | 1402 | /* |
1407 | * Diagnose required errors first. | ||
1408 | */ | ||
1409 | if (CPUCLOCK_PERTHREAD(which_clock) && | ||
1410 | (CPUCLOCK_PID(which_clock) == 0 || | ||
1411 | CPUCLOCK_PID(which_clock) == current->pid)) | ||
1412 | return -EINVAL; | ||
1413 | |||
1414 | /* | ||
1415 | * Set up a temporary timer and then wait for it to go off. | 1403 | * Set up a temporary timer and then wait for it to go off. |
1416 | */ | 1404 | */ |
1417 | memset(&timer, 0, sizeof timer); | 1405 | memset(&timer, 0, sizeof timer); |
@@ -1422,11 +1410,12 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags, | |||
1422 | timer.it_process = current; | 1410 | timer.it_process = current; |
1423 | if (!error) { | 1411 | if (!error) { |
1424 | static struct itimerspec zero_it; | 1412 | static struct itimerspec zero_it; |
1425 | struct itimerspec it = { .it_value = *rqtp, | 1413 | |
1426 | .it_interval = {} }; | 1414 | memset(it, 0, sizeof *it); |
1415 | it->it_value = *rqtp; | ||
1427 | 1416 | ||
1428 | spin_lock_irq(&timer.it_lock); | 1417 | spin_lock_irq(&timer.it_lock); |
1429 | error = posix_cpu_timer_set(&timer, flags, &it, NULL); | 1418 | error = posix_cpu_timer_set(&timer, flags, it, NULL); |
1430 | if (error) { | 1419 | if (error) { |
1431 | spin_unlock_irq(&timer.it_lock); | 1420 | spin_unlock_irq(&timer.it_lock); |
1432 | return error; | 1421 | return error; |
@@ -1454,49 +1443,89 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags, | |||
1454 | * We were interrupted by a signal. | 1443 | * We were interrupted by a signal. |
1455 | */ | 1444 | */ |
1456 | sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp); | 1445 | sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp); |
1457 | posix_cpu_timer_set(&timer, 0, &zero_it, &it); | 1446 | posix_cpu_timer_set(&timer, 0, &zero_it, it); |
1458 | spin_unlock_irq(&timer.it_lock); | 1447 | spin_unlock_irq(&timer.it_lock); |
1459 | 1448 | ||
1460 | if ((it.it_value.tv_sec | it.it_value.tv_nsec) == 0) { | 1449 | if ((it->it_value.tv_sec | it->it_value.tv_nsec) == 0) { |
1461 | /* | 1450 | /* |
1462 | * It actually did fire already. | 1451 | * It actually did fire already. |
1463 | */ | 1452 | */ |
1464 | return 0; | 1453 | return 0; |
1465 | } | 1454 | } |
1466 | 1455 | ||
1456 | error = -ERESTART_RESTARTBLOCK; | ||
1457 | } | ||
1458 | |||
1459 | return error; | ||
1460 | } | ||
1461 | |||
1462 | int posix_cpu_nsleep(const clockid_t which_clock, int flags, | ||
1463 | struct timespec *rqtp, struct timespec __user *rmtp) | ||
1464 | { | ||
1465 | struct restart_block *restart_block = | ||
1466 | ¤t_thread_info()->restart_block; | ||
1467 | struct itimerspec it; | ||
1468 | int error; | ||
1469 | |||
1470 | /* | ||
1471 | * Diagnose required errors first. | ||
1472 | */ | ||
1473 | if (CPUCLOCK_PERTHREAD(which_clock) && | ||
1474 | (CPUCLOCK_PID(which_clock) == 0 || | ||
1475 | CPUCLOCK_PID(which_clock) == current->pid)) | ||
1476 | return -EINVAL; | ||
1477 | |||
1478 | error = do_cpu_nanosleep(which_clock, flags, rqtp, &it); | ||
1479 | |||
1480 | if (error == -ERESTART_RESTARTBLOCK) { | ||
1481 | |||
1482 | if (flags & TIMER_ABSTIME) | ||
1483 | return -ERESTARTNOHAND; | ||
1467 | /* | 1484 | /* |
1468 | * Report back to the user the time still remaining. | 1485 | * Report back to the user the time still remaining. |
1469 | */ | 1486 | */ |
1470 | if (rmtp != NULL && !(flags & TIMER_ABSTIME) && | 1487 | if (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) |
1471 | copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) | ||
1472 | return -EFAULT; | 1488 | return -EFAULT; |
1473 | 1489 | ||
1474 | restart_block->fn = posix_cpu_clock_nanosleep_restart; | 1490 | restart_block->fn = posix_cpu_nsleep_restart; |
1475 | /* Caller already set restart_block->arg1 */ | ||
1476 | restart_block->arg0 = which_clock; | 1491 | restart_block->arg0 = which_clock; |
1477 | restart_block->arg1 = (unsigned long) rmtp; | 1492 | restart_block->arg1 = (unsigned long) rmtp; |
1478 | restart_block->arg2 = rqtp->tv_sec; | 1493 | restart_block->arg2 = rqtp->tv_sec; |
1479 | restart_block->arg3 = rqtp->tv_nsec; | 1494 | restart_block->arg3 = rqtp->tv_nsec; |
1480 | |||
1481 | error = -ERESTART_RESTARTBLOCK; | ||
1482 | } | 1495 | } |
1483 | |||
1484 | return error; | 1496 | return error; |
1485 | } | 1497 | } |
1486 | 1498 | ||
1487 | static long | 1499 | long posix_cpu_nsleep_restart(struct restart_block *restart_block) |
1488 | posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block) | ||
1489 | { | 1500 | { |
1490 | clockid_t which_clock = restart_block->arg0; | 1501 | clockid_t which_clock = restart_block->arg0; |
1491 | struct timespec __user *rmtp; | 1502 | struct timespec __user *rmtp; |
1492 | struct timespec t; | 1503 | struct timespec t; |
1504 | struct itimerspec it; | ||
1505 | int error; | ||
1493 | 1506 | ||
1494 | rmtp = (struct timespec __user *) restart_block->arg1; | 1507 | rmtp = (struct timespec __user *) restart_block->arg1; |
1495 | t.tv_sec = restart_block->arg2; | 1508 | t.tv_sec = restart_block->arg2; |
1496 | t.tv_nsec = restart_block->arg3; | 1509 | t.tv_nsec = restart_block->arg3; |
1497 | 1510 | ||
1498 | restart_block->fn = do_no_restart_syscall; | 1511 | restart_block->fn = do_no_restart_syscall; |
1499 | return posix_cpu_nsleep(which_clock, TIMER_ABSTIME, &t, rmtp); | 1512 | error = do_cpu_nanosleep(which_clock, TIMER_ABSTIME, &t, &it); |
1513 | |||
1514 | if (error == -ERESTART_RESTARTBLOCK) { | ||
1515 | /* | ||
1516 | * Report back to the user the time still remaining. | ||
1517 | */ | ||
1518 | if (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) | ||
1519 | return -EFAULT; | ||
1520 | |||
1521 | restart_block->fn = posix_cpu_nsleep_restart; | ||
1522 | restart_block->arg0 = which_clock; | ||
1523 | restart_block->arg1 = (unsigned long) rmtp; | ||
1524 | restart_block->arg2 = t.tv_sec; | ||
1525 | restart_block->arg3 = t.tv_nsec; | ||
1526 | } | ||
1527 | return error; | ||
1528 | |||
1500 | } | 1529 | } |
1501 | 1530 | ||
1502 | 1531 | ||
@@ -1524,6 +1553,10 @@ static int process_cpu_nsleep(const clockid_t which_clock, int flags, | |||
1524 | { | 1553 | { |
1525 | return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp); | 1554 | return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp); |
1526 | } | 1555 | } |
1556 | static long process_cpu_nsleep_restart(struct restart_block *restart_block) | ||
1557 | { | ||
1558 | return -EINVAL; | ||
1559 | } | ||
1527 | static int thread_cpu_clock_getres(const clockid_t which_clock, | 1560 | static int thread_cpu_clock_getres(const clockid_t which_clock, |
1528 | struct timespec *tp) | 1561 | struct timespec *tp) |
1529 | { | 1562 | { |
@@ -1544,6 +1577,10 @@ static int thread_cpu_nsleep(const clockid_t which_clock, int flags, | |||
1544 | { | 1577 | { |
1545 | return -EINVAL; | 1578 | return -EINVAL; |
1546 | } | 1579 | } |
1580 | static long thread_cpu_nsleep_restart(struct restart_block *restart_block) | ||
1581 | { | ||
1582 | return -EINVAL; | ||
1583 | } | ||
1547 | 1584 | ||
1548 | static __init int init_posix_cpu_timers(void) | 1585 | static __init int init_posix_cpu_timers(void) |
1549 | { | 1586 | { |
@@ -1553,6 +1590,7 @@ static __init int init_posix_cpu_timers(void) | |||
1553 | .clock_set = do_posix_clock_nosettime, | 1590 | .clock_set = do_posix_clock_nosettime, |
1554 | .timer_create = process_cpu_timer_create, | 1591 | .timer_create = process_cpu_timer_create, |
1555 | .nsleep = process_cpu_nsleep, | 1592 | .nsleep = process_cpu_nsleep, |
1593 | .nsleep_restart = process_cpu_nsleep_restart, | ||
1556 | }; | 1594 | }; |
1557 | struct k_clock thread = { | 1595 | struct k_clock thread = { |
1558 | .clock_getres = thread_cpu_clock_getres, | 1596 | .clock_getres = thread_cpu_clock_getres, |
@@ -1560,6 +1598,7 @@ static __init int init_posix_cpu_timers(void) | |||
1560 | .clock_set = do_posix_clock_nosettime, | 1598 | .clock_set = do_posix_clock_nosettime, |
1561 | .timer_create = thread_cpu_timer_create, | 1599 | .timer_create = thread_cpu_timer_create, |
1562 | .nsleep = thread_cpu_nsleep, | 1600 | .nsleep = thread_cpu_nsleep, |
1601 | .nsleep_restart = thread_cpu_nsleep_restart, | ||
1563 | }; | 1602 | }; |
1564 | 1603 | ||
1565 | register_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process); | 1604 | register_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process); |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index ac6dc8744429..e5ebcc1ec3a0 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -973,3 +973,24 @@ sys_clock_nanosleep(const clockid_t which_clock, int flags, | |||
973 | return CLOCK_DISPATCH(which_clock, nsleep, | 973 | return CLOCK_DISPATCH(which_clock, nsleep, |
974 | (which_clock, flags, &t, rmtp)); | 974 | (which_clock, flags, &t, rmtp)); |
975 | } | 975 | } |
976 | |||
977 | /* | ||
978 | * nanosleep_restart for monotonic and realtime clocks | ||
979 | */ | ||
980 | static int common_nsleep_restart(struct restart_block *restart_block) | ||
981 | { | ||
982 | return hrtimer_nanosleep_restart(restart_block); | ||
983 | } | ||
984 | |||
985 | /* | ||
986 | * This will restart clock_nanosleep. This is required only by | ||
987 | * compat_clock_nanosleep_restart for now. | ||
988 | */ | ||
989 | long | ||
990 | clock_nanosleep_restart(struct restart_block *restart_block) | ||
991 | { | ||
992 | clockid_t which_clock = restart_block->arg0; | ||
993 | |||
994 | return CLOCK_DISPATCH(which_clock, nsleep_restart, | ||
995 | (restart_block)); | ||
996 | } | ||
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 8aad0331d82e..4d50e06fd745 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -440,6 +440,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid) | |||
440 | child = find_task_by_pid(pid); | 440 | child = find_task_by_pid(pid); |
441 | if (child) | 441 | if (child) |
442 | get_task_struct(child); | 442 | get_task_struct(child); |
443 | |||
443 | read_unlock(&tasklist_lock); | 444 | read_unlock(&tasklist_lock); |
444 | if (!child) | 445 | if (!child) |
445 | return ERR_PTR(-ESRCH); | 446 | return ERR_PTR(-ESRCH); |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 4d1c3d247127..4f2c4272d59c 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -192,13 +192,13 @@ static struct rcu_torture_ops *cur_ops = NULL; | |||
192 | * Definitions for rcu torture testing. | 192 | * Definitions for rcu torture testing. |
193 | */ | 193 | */ |
194 | 194 | ||
195 | static int rcu_torture_read_lock(void) | 195 | static int rcu_torture_read_lock(void) __acquires(RCU) |
196 | { | 196 | { |
197 | rcu_read_lock(); | 197 | rcu_read_lock(); |
198 | return 0; | 198 | return 0; |
199 | } | 199 | } |
200 | 200 | ||
201 | static void rcu_torture_read_unlock(int idx) | 201 | static void rcu_torture_read_unlock(int idx) __releases(RCU) |
202 | { | 202 | { |
203 | rcu_read_unlock(); | 203 | rcu_read_unlock(); |
204 | } | 204 | } |
@@ -250,13 +250,13 @@ static struct rcu_torture_ops rcu_ops = { | |||
250 | * Definitions for rcu_bh torture testing. | 250 | * Definitions for rcu_bh torture testing. |
251 | */ | 251 | */ |
252 | 252 | ||
253 | static int rcu_bh_torture_read_lock(void) | 253 | static int rcu_bh_torture_read_lock(void) __acquires(RCU_BH) |
254 | { | 254 | { |
255 | rcu_read_lock_bh(); | 255 | rcu_read_lock_bh(); |
256 | return 0; | 256 | return 0; |
257 | } | 257 | } |
258 | 258 | ||
259 | static void rcu_bh_torture_read_unlock(int idx) | 259 | static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH) |
260 | { | 260 | { |
261 | rcu_read_unlock_bh(); | 261 | rcu_read_unlock_bh(); |
262 | } | 262 | } |
diff --git a/kernel/relay.c b/kernel/relay.c index 85786ff2a4f9..1d63ecddfa70 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -95,7 +95,7 @@ int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma) | |||
95 | * @buf: the buffer struct | 95 | * @buf: the buffer struct |
96 | * @size: total size of the buffer | 96 | * @size: total size of the buffer |
97 | * | 97 | * |
98 | * Returns a pointer to the resulting buffer, NULL if unsuccessful. The | 98 | * Returns a pointer to the resulting buffer, %NULL if unsuccessful. The |
99 | * passed in size will get page aligned, if it isn't already. | 99 | * passed in size will get page aligned, if it isn't already. |
100 | */ | 100 | */ |
101 | static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size) | 101 | static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size) |
@@ -132,10 +132,9 @@ depopulate: | |||
132 | 132 | ||
133 | /** | 133 | /** |
134 | * relay_create_buf - allocate and initialize a channel buffer | 134 | * relay_create_buf - allocate and initialize a channel buffer |
135 | * @alloc_size: size of the buffer to allocate | 135 | * @chan: the relay channel |
136 | * @n_subbufs: number of sub-buffers in the channel | ||
137 | * | 136 | * |
138 | * Returns channel buffer if successful, NULL otherwise | 137 | * Returns channel buffer if successful, %NULL otherwise. |
139 | */ | 138 | */ |
140 | struct rchan_buf *relay_create_buf(struct rchan *chan) | 139 | struct rchan_buf *relay_create_buf(struct rchan *chan) |
141 | { | 140 | { |
@@ -163,6 +162,7 @@ free_buf: | |||
163 | 162 | ||
164 | /** | 163 | /** |
165 | * relay_destroy_channel - free the channel struct | 164 | * relay_destroy_channel - free the channel struct |
165 | * @kref: target kernel reference that contains the relay channel | ||
166 | * | 166 | * |
167 | * Should only be called from kref_put(). | 167 | * Should only be called from kref_put(). |
168 | */ | 168 | */ |
@@ -194,6 +194,7 @@ void relay_destroy_buf(struct rchan_buf *buf) | |||
194 | 194 | ||
195 | /** | 195 | /** |
196 | * relay_remove_buf - remove a channel buffer | 196 | * relay_remove_buf - remove a channel buffer |
197 | * @kref: target kernel reference that contains the relay buffer | ||
197 | * | 198 | * |
198 | * Removes the file from the fileystem, which also frees the | 199 | * Removes the file from the fileystem, which also frees the |
199 | * rchan_buf_struct and the channel buffer. Should only be called from | 200 | * rchan_buf_struct and the channel buffer. Should only be called from |
@@ -374,7 +375,7 @@ void relay_reset(struct rchan *chan) | |||
374 | } | 375 | } |
375 | EXPORT_SYMBOL_GPL(relay_reset); | 376 | EXPORT_SYMBOL_GPL(relay_reset); |
376 | 377 | ||
377 | /** | 378 | /* |
378 | * relay_open_buf - create a new relay channel buffer | 379 | * relay_open_buf - create a new relay channel buffer |
379 | * | 380 | * |
380 | * Internal - used by relay_open(). | 381 | * Internal - used by relay_open(). |
@@ -448,12 +449,12 @@ static inline void setup_callbacks(struct rchan *chan, | |||
448 | /** | 449 | /** |
449 | * relay_open - create a new relay channel | 450 | * relay_open - create a new relay channel |
450 | * @base_filename: base name of files to create | 451 | * @base_filename: base name of files to create |
451 | * @parent: dentry of parent directory, NULL for root directory | 452 | * @parent: dentry of parent directory, %NULL for root directory |
452 | * @subbuf_size: size of sub-buffers | 453 | * @subbuf_size: size of sub-buffers |
453 | * @n_subbufs: number of sub-buffers | 454 | * @n_subbufs: number of sub-buffers |
454 | * @cb: client callback functions | 455 | * @cb: client callback functions |
455 | * | 456 | * |
456 | * Returns channel pointer if successful, NULL otherwise. | 457 | * Returns channel pointer if successful, %NULL otherwise. |
457 | * | 458 | * |
458 | * Creates a channel buffer for each cpu using the sizes and | 459 | * Creates a channel buffer for each cpu using the sizes and |
459 | * attributes specified. The created channel buffer files | 460 | * attributes specified. The created channel buffer files |
@@ -585,7 +586,7 @@ EXPORT_SYMBOL_GPL(relay_switch_subbuf); | |||
585 | * subbufs_consumed should be the number of sub-buffers newly consumed, | 586 | * subbufs_consumed should be the number of sub-buffers newly consumed, |
586 | * not the total consumed. | 587 | * not the total consumed. |
587 | * | 588 | * |
588 | * NOTE: kernel clients don't need to call this function if the channel | 589 | * NOTE: Kernel clients don't need to call this function if the channel |
589 | * mode is 'overwrite'. | 590 | * mode is 'overwrite'. |
590 | */ | 591 | */ |
591 | void relay_subbufs_consumed(struct rchan *chan, | 592 | void relay_subbufs_consumed(struct rchan *chan, |
@@ -641,7 +642,7 @@ EXPORT_SYMBOL_GPL(relay_close); | |||
641 | * relay_flush - close the channel | 642 | * relay_flush - close the channel |
642 | * @chan: the channel | 643 | * @chan: the channel |
643 | * | 644 | * |
644 | * Flushes all channel buffers i.e. forces buffer switch. | 645 | * Flushes all channel buffers, i.e. forces buffer switch. |
645 | */ | 646 | */ |
646 | void relay_flush(struct rchan *chan) | 647 | void relay_flush(struct rchan *chan) |
647 | { | 648 | { |
@@ -729,7 +730,7 @@ static int relay_file_release(struct inode *inode, struct file *filp) | |||
729 | return 0; | 730 | return 0; |
730 | } | 731 | } |
731 | 732 | ||
732 | /** | 733 | /* |
733 | * relay_file_read_consume - update the consumed count for the buffer | 734 | * relay_file_read_consume - update the consumed count for the buffer |
734 | */ | 735 | */ |
735 | static void relay_file_read_consume(struct rchan_buf *buf, | 736 | static void relay_file_read_consume(struct rchan_buf *buf, |
@@ -756,7 +757,7 @@ static void relay_file_read_consume(struct rchan_buf *buf, | |||
756 | } | 757 | } |
757 | } | 758 | } |
758 | 759 | ||
759 | /** | 760 | /* |
760 | * relay_file_read_avail - boolean, are there unconsumed bytes available? | 761 | * relay_file_read_avail - boolean, are there unconsumed bytes available? |
761 | */ | 762 | */ |
762 | static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) | 763 | static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) |
@@ -793,6 +794,8 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) | |||
793 | 794 | ||
794 | /** | 795 | /** |
795 | * relay_file_read_subbuf_avail - return bytes available in sub-buffer | 796 | * relay_file_read_subbuf_avail - return bytes available in sub-buffer |
797 | * @read_pos: file read position | ||
798 | * @buf: relay channel buffer | ||
796 | */ | 799 | */ |
797 | static size_t relay_file_read_subbuf_avail(size_t read_pos, | 800 | static size_t relay_file_read_subbuf_avail(size_t read_pos, |
798 | struct rchan_buf *buf) | 801 | struct rchan_buf *buf) |
@@ -818,6 +821,8 @@ static size_t relay_file_read_subbuf_avail(size_t read_pos, | |||
818 | 821 | ||
819 | /** | 822 | /** |
820 | * relay_file_read_start_pos - find the first available byte to read | 823 | * relay_file_read_start_pos - find the first available byte to read |
824 | * @read_pos: file read position | ||
825 | * @buf: relay channel buffer | ||
821 | * | 826 | * |
822 | * If the read_pos is in the middle of padding, return the | 827 | * If the read_pos is in the middle of padding, return the |
823 | * position of the first actually available byte, otherwise | 828 | * position of the first actually available byte, otherwise |
@@ -844,6 +849,9 @@ static size_t relay_file_read_start_pos(size_t read_pos, | |||
844 | 849 | ||
845 | /** | 850 | /** |
846 | * relay_file_read_end_pos - return the new read position | 851 | * relay_file_read_end_pos - return the new read position |
852 | * @read_pos: file read position | ||
853 | * @buf: relay channel buffer | ||
854 | * @count: number of bytes to be read | ||
847 | */ | 855 | */ |
848 | static size_t relay_file_read_end_pos(struct rchan_buf *buf, | 856 | static size_t relay_file_read_end_pos(struct rchan_buf *buf, |
849 | size_t read_pos, | 857 | size_t read_pos, |
@@ -865,7 +873,7 @@ static size_t relay_file_read_end_pos(struct rchan_buf *buf, | |||
865 | return end_pos; | 873 | return end_pos; |
866 | } | 874 | } |
867 | 875 | ||
868 | /** | 876 | /* |
869 | * subbuf_read_actor - read up to one subbuf's worth of data | 877 | * subbuf_read_actor - read up to one subbuf's worth of data |
870 | */ | 878 | */ |
871 | static int subbuf_read_actor(size_t read_start, | 879 | static int subbuf_read_actor(size_t read_start, |
@@ -890,7 +898,7 @@ static int subbuf_read_actor(size_t read_start, | |||
890 | return ret; | 898 | return ret; |
891 | } | 899 | } |
892 | 900 | ||
893 | /** | 901 | /* |
894 | * subbuf_send_actor - send up to one subbuf's worth of data | 902 | * subbuf_send_actor - send up to one subbuf's worth of data |
895 | */ | 903 | */ |
896 | static int subbuf_send_actor(size_t read_start, | 904 | static int subbuf_send_actor(size_t read_start, |
@@ -933,7 +941,7 @@ typedef int (*subbuf_actor_t) (size_t read_start, | |||
933 | read_descriptor_t *desc, | 941 | read_descriptor_t *desc, |
934 | read_actor_t actor); | 942 | read_actor_t actor); |
935 | 943 | ||
936 | /** | 944 | /* |
937 | * relay_file_read_subbufs - read count bytes, bridging subbuf boundaries | 945 | * relay_file_read_subbufs - read count bytes, bridging subbuf boundaries |
938 | */ | 946 | */ |
939 | static inline ssize_t relay_file_read_subbufs(struct file *filp, | 947 | static inline ssize_t relay_file_read_subbufs(struct file *filp, |
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index 3e13a1e5856f..4ab17da46fd8 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c | |||
@@ -251,6 +251,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, | |||
251 | 251 | ||
252 | /* Grab the next task */ | 252 | /* Grab the next task */ |
253 | task = rt_mutex_owner(lock); | 253 | task = rt_mutex_owner(lock); |
254 | get_task_struct(task); | ||
254 | spin_lock_irqsave(&task->pi_lock, flags); | 255 | spin_lock_irqsave(&task->pi_lock, flags); |
255 | 256 | ||
256 | if (waiter == rt_mutex_top_waiter(lock)) { | 257 | if (waiter == rt_mutex_top_waiter(lock)) { |
@@ -269,7 +270,6 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, | |||
269 | __rt_mutex_adjust_prio(task); | 270 | __rt_mutex_adjust_prio(task); |
270 | } | 271 | } |
271 | 272 | ||
272 | get_task_struct(task); | ||
273 | spin_unlock_irqrestore(&task->pi_lock, flags); | 273 | spin_unlock_irqrestore(&task->pi_lock, flags); |
274 | 274 | ||
275 | top_waiter = rt_mutex_top_waiter(lock); | 275 | top_waiter = rt_mutex_top_waiter(lock); |
@@ -409,7 +409,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, | |||
409 | struct task_struct *owner = rt_mutex_owner(lock); | 409 | struct task_struct *owner = rt_mutex_owner(lock); |
410 | struct rt_mutex_waiter *top_waiter = waiter; | 410 | struct rt_mutex_waiter *top_waiter = waiter; |
411 | unsigned long flags; | 411 | unsigned long flags; |
412 | int boost = 0, res; | 412 | int chain_walk = 0, res; |
413 | 413 | ||
414 | spin_lock_irqsave(¤t->pi_lock, flags); | 414 | spin_lock_irqsave(¤t->pi_lock, flags); |
415 | __rt_mutex_adjust_prio(current); | 415 | __rt_mutex_adjust_prio(current); |
@@ -433,25 +433,23 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, | |||
433 | plist_add(&waiter->pi_list_entry, &owner->pi_waiters); | 433 | plist_add(&waiter->pi_list_entry, &owner->pi_waiters); |
434 | 434 | ||
435 | __rt_mutex_adjust_prio(owner); | 435 | __rt_mutex_adjust_prio(owner); |
436 | if (owner->pi_blocked_on) { | 436 | if (owner->pi_blocked_on) |
437 | boost = 1; | 437 | chain_walk = 1; |
438 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | ||
439 | get_task_struct(owner); | ||
440 | } | ||
441 | spin_unlock_irqrestore(&owner->pi_lock, flags); | ||
442 | } | ||
443 | else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) { | ||
444 | spin_lock_irqsave(&owner->pi_lock, flags); | ||
445 | if (owner->pi_blocked_on) { | ||
446 | boost = 1; | ||
447 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | ||
448 | get_task_struct(owner); | ||
449 | } | ||
450 | spin_unlock_irqrestore(&owner->pi_lock, flags); | 438 | spin_unlock_irqrestore(&owner->pi_lock, flags); |
451 | } | 439 | } |
452 | if (!boost) | 440 | else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) |
441 | chain_walk = 1; | ||
442 | |||
443 | if (!chain_walk) | ||
453 | return 0; | 444 | return 0; |
454 | 445 | ||
446 | /* | ||
447 | * The owner can't disappear while holding a lock, | ||
448 | * so the owner struct is protected by wait_lock. | ||
449 | * Gets dropped in rt_mutex_adjust_prio_chain()! | ||
450 | */ | ||
451 | get_task_struct(owner); | ||
452 | |||
455 | spin_unlock(&lock->wait_lock); | 453 | spin_unlock(&lock->wait_lock); |
456 | 454 | ||
457 | res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, waiter, | 455 | res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, waiter, |
@@ -532,7 +530,7 @@ static void remove_waiter(struct rt_mutex *lock, | |||
532 | int first = (waiter == rt_mutex_top_waiter(lock)); | 530 | int first = (waiter == rt_mutex_top_waiter(lock)); |
533 | struct task_struct *owner = rt_mutex_owner(lock); | 531 | struct task_struct *owner = rt_mutex_owner(lock); |
534 | unsigned long flags; | 532 | unsigned long flags; |
535 | int boost = 0; | 533 | int chain_walk = 0; |
536 | 534 | ||
537 | spin_lock_irqsave(¤t->pi_lock, flags); | 535 | spin_lock_irqsave(¤t->pi_lock, flags); |
538 | plist_del(&waiter->list_entry, &lock->wait_list); | 536 | plist_del(&waiter->list_entry, &lock->wait_list); |
@@ -554,19 +552,20 @@ static void remove_waiter(struct rt_mutex *lock, | |||
554 | } | 552 | } |
555 | __rt_mutex_adjust_prio(owner); | 553 | __rt_mutex_adjust_prio(owner); |
556 | 554 | ||
557 | if (owner->pi_blocked_on) { | 555 | if (owner->pi_blocked_on) |
558 | boost = 1; | 556 | chain_walk = 1; |
559 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | 557 | |
560 | get_task_struct(owner); | ||
561 | } | ||
562 | spin_unlock_irqrestore(&owner->pi_lock, flags); | 558 | spin_unlock_irqrestore(&owner->pi_lock, flags); |
563 | } | 559 | } |
564 | 560 | ||
565 | WARN_ON(!plist_node_empty(&waiter->pi_list_entry)); | 561 | WARN_ON(!plist_node_empty(&waiter->pi_list_entry)); |
566 | 562 | ||
567 | if (!boost) | 563 | if (!chain_walk) |
568 | return; | 564 | return; |
569 | 565 | ||
566 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | ||
567 | get_task_struct(owner); | ||
568 | |||
570 | spin_unlock(&lock->wait_lock); | 569 | spin_unlock(&lock->wait_lock); |
571 | 570 | ||
572 | rt_mutex_adjust_prio_chain(owner, 0, lock, NULL, current); | 571 | rt_mutex_adjust_prio_chain(owner, 0, lock, NULL, current); |
@@ -592,10 +591,10 @@ void rt_mutex_adjust_pi(struct task_struct *task) | |||
592 | return; | 591 | return; |
593 | } | 592 | } |
594 | 593 | ||
595 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | ||
596 | get_task_struct(task); | ||
597 | spin_unlock_irqrestore(&task->pi_lock, flags); | 594 | spin_unlock_irqrestore(&task->pi_lock, flags); |
598 | 595 | ||
596 | /* gets dropped in rt_mutex_adjust_prio_chain()! */ | ||
597 | get_task_struct(task); | ||
599 | rt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task); | 598 | rt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task); |
600 | } | 599 | } |
601 | 600 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 5c848fd4e461..74f169ac0773 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -1755,27 +1755,27 @@ static inline void finish_task_switch(struct rq *rq, struct task_struct *prev) | |||
1755 | __releases(rq->lock) | 1755 | __releases(rq->lock) |
1756 | { | 1756 | { |
1757 | struct mm_struct *mm = rq->prev_mm; | 1757 | struct mm_struct *mm = rq->prev_mm; |
1758 | unsigned long prev_task_flags; | 1758 | long prev_state; |
1759 | 1759 | ||
1760 | rq->prev_mm = NULL; | 1760 | rq->prev_mm = NULL; |
1761 | 1761 | ||
1762 | /* | 1762 | /* |
1763 | * A task struct has one reference for the use as "current". | 1763 | * A task struct has one reference for the use as "current". |
1764 | * If a task dies, then it sets EXIT_ZOMBIE in tsk->exit_state and | 1764 | * If a task dies, then it sets TASK_DEAD in tsk->state and calls |
1765 | * calls schedule one last time. The schedule call will never return, | 1765 | * schedule one last time. The schedule call will never return, and |
1766 | * and the scheduled task must drop that reference. | 1766 | * the scheduled task must drop that reference. |
1767 | * The test for EXIT_ZOMBIE must occur while the runqueue locks are | 1767 | * The test for TASK_DEAD must occur while the runqueue locks are |
1768 | * still held, otherwise prev could be scheduled on another cpu, die | 1768 | * still held, otherwise prev could be scheduled on another cpu, die |
1769 | * there before we look at prev->state, and then the reference would | 1769 | * there before we look at prev->state, and then the reference would |
1770 | * be dropped twice. | 1770 | * be dropped twice. |
1771 | * Manfred Spraul <manfred@colorfullife.com> | 1771 | * Manfred Spraul <manfred@colorfullife.com> |
1772 | */ | 1772 | */ |
1773 | prev_task_flags = prev->flags; | 1773 | prev_state = prev->state; |
1774 | finish_arch_switch(prev); | 1774 | finish_arch_switch(prev); |
1775 | finish_lock_switch(rq, prev); | 1775 | finish_lock_switch(rq, prev); |
1776 | if (mm) | 1776 | if (mm) |
1777 | mmdrop(mm); | 1777 | mmdrop(mm); |
1778 | if (unlikely(prev_task_flags & PF_DEAD)) { | 1778 | if (unlikely(prev_state == TASK_DEAD)) { |
1779 | /* | 1779 | /* |
1780 | * Remove function-return probe instances associated with this | 1780 | * Remove function-return probe instances associated with this |
1781 | * task and put them back on the free list. | 1781 | * task and put them back on the free list. |
@@ -3348,9 +3348,6 @@ need_resched_nonpreemptible: | |||
3348 | 3348 | ||
3349 | spin_lock_irq(&rq->lock); | 3349 | spin_lock_irq(&rq->lock); |
3350 | 3350 | ||
3351 | if (unlikely(prev->flags & PF_DEAD)) | ||
3352 | prev->state = EXIT_DEAD; | ||
3353 | |||
3354 | switch_count = &prev->nivcsw; | 3351 | switch_count = &prev->nivcsw; |
3355 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { | 3352 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { |
3356 | switch_count = &prev->nvcsw; | 3353 | switch_count = &prev->nvcsw; |
@@ -4080,6 +4077,8 @@ static void __setscheduler(struct task_struct *p, int policy, int prio) | |||
4080 | * @p: the task in question. | 4077 | * @p: the task in question. |
4081 | * @policy: new policy. | 4078 | * @policy: new policy. |
4082 | * @param: structure containing the new RT priority. | 4079 | * @param: structure containing the new RT priority. |
4080 | * | ||
4081 | * NOTE: the task may be already dead | ||
4083 | */ | 4082 | */ |
4084 | int sched_setscheduler(struct task_struct *p, int policy, | 4083 | int sched_setscheduler(struct task_struct *p, int policy, |
4085 | struct sched_param *param) | 4084 | struct sched_param *param) |
@@ -4107,28 +4106,32 @@ recheck: | |||
4107 | (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) || | 4106 | (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) || |
4108 | (!p->mm && param->sched_priority > MAX_RT_PRIO-1)) | 4107 | (!p->mm && param->sched_priority > MAX_RT_PRIO-1)) |
4109 | return -EINVAL; | 4108 | return -EINVAL; |
4110 | if ((policy == SCHED_NORMAL || policy == SCHED_BATCH) | 4109 | if (is_rt_policy(policy) != (param->sched_priority != 0)) |
4111 | != (param->sched_priority == 0)) | ||
4112 | return -EINVAL; | 4110 | return -EINVAL; |
4113 | 4111 | ||
4114 | /* | 4112 | /* |
4115 | * Allow unprivileged RT tasks to decrease priority: | 4113 | * Allow unprivileged RT tasks to decrease priority: |
4116 | */ | 4114 | */ |
4117 | if (!capable(CAP_SYS_NICE)) { | 4115 | if (!capable(CAP_SYS_NICE)) { |
4118 | /* | 4116 | if (is_rt_policy(policy)) { |
4119 | * can't change policy, except between SCHED_NORMAL | 4117 | unsigned long rlim_rtprio; |
4120 | * and SCHED_BATCH: | 4118 | unsigned long flags; |
4121 | */ | 4119 | |
4122 | if (((policy != SCHED_NORMAL && p->policy != SCHED_BATCH) && | 4120 | if (!lock_task_sighand(p, &flags)) |
4123 | (policy != SCHED_BATCH && p->policy != SCHED_NORMAL)) && | 4121 | return -ESRCH; |
4124 | !p->signal->rlim[RLIMIT_RTPRIO].rlim_cur) | 4122 | rlim_rtprio = p->signal->rlim[RLIMIT_RTPRIO].rlim_cur; |
4125 | return -EPERM; | 4123 | unlock_task_sighand(p, &flags); |
4126 | /* can't increase priority */ | 4124 | |
4127 | if ((policy != SCHED_NORMAL && policy != SCHED_BATCH) && | 4125 | /* can't set/change the rt policy */ |
4128 | param->sched_priority > p->rt_priority && | 4126 | if (policy != p->policy && !rlim_rtprio) |
4129 | param->sched_priority > | 4127 | return -EPERM; |
4130 | p->signal->rlim[RLIMIT_RTPRIO].rlim_cur) | 4128 | |
4131 | return -EPERM; | 4129 | /* can't increase priority */ |
4130 | if (param->sched_priority > p->rt_priority && | ||
4131 | param->sched_priority > rlim_rtprio) | ||
4132 | return -EPERM; | ||
4133 | } | ||
4134 | |||
4132 | /* can't change other user's priorities */ | 4135 | /* can't change other user's priorities */ |
4133 | if ((current->euid != p->euid) && | 4136 | if ((current->euid != p->euid) && |
4134 | (current->euid != p->uid)) | 4137 | (current->euid != p->uid)) |
@@ -4193,14 +4196,13 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) | |||
4193 | return -EINVAL; | 4196 | return -EINVAL; |
4194 | if (copy_from_user(&lparam, param, sizeof(struct sched_param))) | 4197 | if (copy_from_user(&lparam, param, sizeof(struct sched_param))) |
4195 | return -EFAULT; | 4198 | return -EFAULT; |
4196 | read_lock_irq(&tasklist_lock); | 4199 | |
4200 | rcu_read_lock(); | ||
4201 | retval = -ESRCH; | ||
4197 | p = find_process_by_pid(pid); | 4202 | p = find_process_by_pid(pid); |
4198 | if (!p) { | 4203 | if (p != NULL) |
4199 | read_unlock_irq(&tasklist_lock); | 4204 | retval = sched_setscheduler(p, policy, &lparam); |
4200 | return -ESRCH; | 4205 | rcu_read_unlock(); |
4201 | } | ||
4202 | retval = sched_setscheduler(p, policy, &lparam); | ||
4203 | read_unlock_irq(&tasklist_lock); | ||
4204 | 4206 | ||
4205 | return retval; | 4207 | return retval; |
4206 | } | 4208 | } |
@@ -5151,7 +5153,7 @@ static void migrate_dead(unsigned int dead_cpu, struct task_struct *p) | |||
5151 | BUG_ON(p->exit_state != EXIT_ZOMBIE && p->exit_state != EXIT_DEAD); | 5153 | BUG_ON(p->exit_state != EXIT_ZOMBIE && p->exit_state != EXIT_DEAD); |
5152 | 5154 | ||
5153 | /* Cannot have done final schedule yet: would have vanished. */ | 5155 | /* Cannot have done final schedule yet: would have vanished. */ |
5154 | BUG_ON(p->flags & PF_DEAD); | 5156 | BUG_ON(p->state == TASK_DEAD); |
5155 | 5157 | ||
5156 | get_task_struct(p); | 5158 | get_task_struct(p); |
5157 | 5159 | ||
@@ -5272,9 +5274,11 @@ static struct notifier_block __cpuinitdata migration_notifier = { | |||
5272 | int __init migration_init(void) | 5274 | int __init migration_init(void) |
5273 | { | 5275 | { |
5274 | void *cpu = (void *)(long)smp_processor_id(); | 5276 | void *cpu = (void *)(long)smp_processor_id(); |
5277 | int err; | ||
5275 | 5278 | ||
5276 | /* Start one for the boot CPU: */ | 5279 | /* Start one for the boot CPU: */ |
5277 | migration_call(&migration_notifier, CPU_UP_PREPARE, cpu); | 5280 | err = migration_call(&migration_notifier, CPU_UP_PREPARE, cpu); |
5281 | BUG_ON(err == NOTIFY_BAD); | ||
5278 | migration_call(&migration_notifier, CPU_ONLINE, cpu); | 5282 | migration_call(&migration_notifier, CPU_ONLINE, cpu); |
5279 | register_cpu_notifier(&migration_notifier); | 5283 | register_cpu_notifier(&migration_notifier); |
5280 | 5284 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 05853a7337e3..fb5da6d19f14 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -417,9 +417,8 @@ static int collect_signal(int sig, struct sigpending *list, siginfo_t *info) | |||
417 | static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, | 417 | static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, |
418 | siginfo_t *info) | 418 | siginfo_t *info) |
419 | { | 419 | { |
420 | int sig = 0; | 420 | int sig = next_signal(pending, mask); |
421 | 421 | ||
422 | sig = next_signal(pending, mask); | ||
423 | if (sig) { | 422 | if (sig) { |
424 | if (current->notifier) { | 423 | if (current->notifier) { |
425 | if (sigismember(current->notifier_mask, sig)) { | 424 | if (sigismember(current->notifier_mask, sig)) { |
@@ -432,9 +431,7 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, | |||
432 | 431 | ||
433 | if (!collect_signal(sig, pending, info)) | 432 | if (!collect_signal(sig, pending, info)) |
434 | sig = 0; | 433 | sig = 0; |
435 | |||
436 | } | 434 | } |
437 | recalc_sigpending(); | ||
438 | 435 | ||
439 | return sig; | 436 | return sig; |
440 | } | 437 | } |
@@ -451,6 +448,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) | |||
451 | if (!signr) | 448 | if (!signr) |
452 | signr = __dequeue_signal(&tsk->signal->shared_pending, | 449 | signr = __dequeue_signal(&tsk->signal->shared_pending, |
453 | mask, info); | 450 | mask, info); |
451 | recalc_sigpending_tsk(tsk); | ||
454 | if (signr && unlikely(sig_kernel_stop(signr))) { | 452 | if (signr && unlikely(sig_kernel_stop(signr))) { |
455 | /* | 453 | /* |
456 | * Set a marker that we have dequeued a stop signal. Our | 454 | * Set a marker that we have dequeued a stop signal. Our |
diff --git a/kernel/softirq.c b/kernel/softirq.c index 3789ca98197c..bf25015dce16 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -612,7 +612,9 @@ static struct notifier_block __cpuinitdata cpu_nfb = { | |||
612 | __init int spawn_ksoftirqd(void) | 612 | __init int spawn_ksoftirqd(void) |
613 | { | 613 | { |
614 | void *cpu = (void *)(long)smp_processor_id(); | 614 | void *cpu = (void *)(long)smp_processor_id(); |
615 | cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); | 615 | int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); |
616 | |||
617 | BUG_ON(err == NOTIFY_BAD); | ||
616 | cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); | 618 | cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); |
617 | register_cpu_notifier(&cpu_nfb); | 619 | register_cpu_notifier(&cpu_nfb); |
618 | return 0; | 620 | return 0; |
diff --git a/kernel/softlockup.c b/kernel/softlockup.c index 03e6a2b0b787..50afeb813305 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c | |||
@@ -149,8 +149,9 @@ static struct notifier_block __cpuinitdata cpu_nfb = { | |||
149 | __init void spawn_softlockup_task(void) | 149 | __init void spawn_softlockup_task(void) |
150 | { | 150 | { |
151 | void *cpu = (void *)(long)smp_processor_id(); | 151 | void *cpu = (void *)(long)smp_processor_id(); |
152 | int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); | ||
152 | 153 | ||
153 | cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); | 154 | BUG_ON(err == NOTIFY_BAD); |
154 | cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); | 155 | cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); |
155 | register_cpu_notifier(&cpu_nfb); | 156 | register_cpu_notifier(&cpu_nfb); |
156 | 157 | ||
diff --git a/kernel/spinlock.c b/kernel/spinlock.c index 9644a41e0bef..d48143eafbfd 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c | |||
@@ -21,17 +21,6 @@ | |||
21 | #include <linux/debug_locks.h> | 21 | #include <linux/debug_locks.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | 23 | ||
24 | /* | ||
25 | * Generic declaration of the raw read_trylock() function, | ||
26 | * architectures are supposed to optimize this: | ||
27 | */ | ||
28 | int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock) | ||
29 | { | ||
30 | __raw_read_lock(lock); | ||
31 | return 1; | ||
32 | } | ||
33 | EXPORT_SYMBOL(generic__raw_read_trylock); | ||
34 | |||
35 | int __lockfunc _spin_trylock(spinlock_t *lock) | 24 | int __lockfunc _spin_trylock(spinlock_t *lock) |
36 | { | 25 | { |
37 | preempt_disable(); | 26 | preempt_disable(); |
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 51cacd111dbd..12458040e665 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c | |||
@@ -1,3 +1,6 @@ | |||
1 | /* Copyright 2005 Rusty Russell rusty@rustcorp.com.au IBM Corporation. | ||
2 | * GPL v2 and any later version. | ||
3 | */ | ||
1 | #include <linux/stop_machine.h> | 4 | #include <linux/stop_machine.h> |
2 | #include <linux/kthread.h> | 5 | #include <linux/kthread.h> |
3 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
diff --git a/kernel/sys.c b/kernel/sys.c index 3f894775488d..b88806c66244 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -612,7 +612,6 @@ void kernel_restart(char *cmd) | |||
612 | } else { | 612 | } else { |
613 | printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd); | 613 | printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd); |
614 | } | 614 | } |
615 | printk(".\n"); | ||
616 | machine_restart(cmd); | 615 | machine_restart(cmd); |
617 | } | 616 | } |
618 | EXPORT_SYMBOL_GPL(kernel_restart); | 617 | EXPORT_SYMBOL_GPL(kernel_restart); |
@@ -2084,12 +2083,12 @@ asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, | |||
2084 | * padding | 2083 | * padding |
2085 | */ | 2084 | */ |
2086 | unsigned long t0, t1; | 2085 | unsigned long t0, t1; |
2087 | get_user(t0, &cache->t0); | 2086 | get_user(t0, &cache->blob[0]); |
2088 | get_user(t1, &cache->t1); | 2087 | get_user(t1, &cache->blob[1]); |
2089 | t0++; | 2088 | t0++; |
2090 | t1++; | 2089 | t1++; |
2091 | put_user(t0, &cache->t0); | 2090 | put_user(t0, &cache->blob[0]); |
2092 | put_user(t1, &cache->t1); | 2091 | put_user(t1, &cache->blob[1]); |
2093 | } | 2092 | } |
2094 | return err ? -EFAULT : 0; | 2093 | return err ? -EFAULT : 0; |
2095 | } | 2094 | } |
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 6991bece67e8..7a3b2e75f040 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c | |||
@@ -134,3 +134,8 @@ cond_syscall(sys_madvise); | |||
134 | cond_syscall(sys_mremap); | 134 | cond_syscall(sys_mremap); |
135 | cond_syscall(sys_remap_file_pages); | 135 | cond_syscall(sys_remap_file_pages); |
136 | cond_syscall(compat_sys_move_pages); | 136 | cond_syscall(compat_sys_move_pages); |
137 | |||
138 | /* block-layer dependent */ | ||
139 | cond_syscall(sys_bdflush); | ||
140 | cond_syscall(sys_ioprio_set); | ||
141 | cond_syscall(sys_ioprio_get); | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8bfa7d117c54..c57c4532e296 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -52,6 +52,10 @@ | |||
52 | extern int proc_nr_files(ctl_table *table, int write, struct file *filp, | 52 | extern int proc_nr_files(ctl_table *table, int write, struct file *filp, |
53 | void __user *buffer, size_t *lenp, loff_t *ppos); | 53 | void __user *buffer, size_t *lenp, loff_t *ppos); |
54 | 54 | ||
55 | #ifdef CONFIG_X86 | ||
56 | #include <asm/nmi.h> | ||
57 | #endif | ||
58 | |||
55 | #if defined(CONFIG_SYSCTL) | 59 | #if defined(CONFIG_SYSCTL) |
56 | 60 | ||
57 | /* External variables not in a header file. */ | 61 | /* External variables not in a header file. */ |
@@ -74,13 +78,6 @@ extern int sysctl_drop_caches; | |||
74 | extern int percpu_pagelist_fraction; | 78 | extern int percpu_pagelist_fraction; |
75 | extern int compat_log; | 79 | extern int compat_log; |
76 | 80 | ||
77 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | ||
78 | int unknown_nmi_panic; | ||
79 | int nmi_watchdog_enabled; | ||
80 | extern int proc_nmi_enabled(struct ctl_table *, int , struct file *, | ||
81 | void __user *, size_t *, loff_t *); | ||
82 | #endif | ||
83 | |||
84 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ | 81 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ |
85 | static int maxolduid = 65535; | 82 | static int maxolduid = 65535; |
86 | static int minolduid; | 83 | static int minolduid; |
@@ -1915,7 +1912,7 @@ int proc_dointvec_bset(ctl_table *table, int write, struct file *filp, | |||
1915 | return -EPERM; | 1912 | return -EPERM; |
1916 | } | 1913 | } |
1917 | 1914 | ||
1918 | op = (current->pid == 1) ? OP_SET : OP_AND; | 1915 | op = is_init(current) ? OP_SET : OP_AND; |
1919 | return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, | 1916 | return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, |
1920 | do_proc_dointvec_bset_conv,&op); | 1917 | do_proc_dointvec_bset_conv,&op); |
1921 | } | 1918 | } |
diff --git a/kernel/timer.c b/kernel/timer.c index 1d7dd6267c2d..4f55622b0d38 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -136,7 +136,7 @@ static void internal_add_timer(tvec_base_t *base, struct timer_list *timer) | |||
136 | list_add_tail(&timer->entry, vec); | 136 | list_add_tail(&timer->entry, vec); |
137 | } | 137 | } |
138 | 138 | ||
139 | /*** | 139 | /** |
140 | * init_timer - initialize a timer. | 140 | * init_timer - initialize a timer. |
141 | * @timer: the timer to be initialized | 141 | * @timer: the timer to be initialized |
142 | * | 142 | * |
@@ -175,6 +175,7 @@ static inline void detach_timer(struct timer_list *timer, | |||
175 | */ | 175 | */ |
176 | static tvec_base_t *lock_timer_base(struct timer_list *timer, | 176 | static tvec_base_t *lock_timer_base(struct timer_list *timer, |
177 | unsigned long *flags) | 177 | unsigned long *flags) |
178 | __acquires(timer->base->lock) | ||
178 | { | 179 | { |
179 | tvec_base_t *base; | 180 | tvec_base_t *base; |
180 | 181 | ||
@@ -235,7 +236,7 @@ int __mod_timer(struct timer_list *timer, unsigned long expires) | |||
235 | 236 | ||
236 | EXPORT_SYMBOL(__mod_timer); | 237 | EXPORT_SYMBOL(__mod_timer); |
237 | 238 | ||
238 | /*** | 239 | /** |
239 | * add_timer_on - start a timer on a particular CPU | 240 | * add_timer_on - start a timer on a particular CPU |
240 | * @timer: the timer to be added | 241 | * @timer: the timer to be added |
241 | * @cpu: the CPU to start it on | 242 | * @cpu: the CPU to start it on |
@@ -255,9 +256,10 @@ void add_timer_on(struct timer_list *timer, int cpu) | |||
255 | } | 256 | } |
256 | 257 | ||
257 | 258 | ||
258 | /*** | 259 | /** |
259 | * mod_timer - modify a timer's timeout | 260 | * mod_timer - modify a timer's timeout |
260 | * @timer: the timer to be modified | 261 | * @timer: the timer to be modified |
262 | * @expires: new timeout in jiffies | ||
261 | * | 263 | * |
262 | * mod_timer is a more efficient way to update the expire field of an | 264 | * mod_timer is a more efficient way to update the expire field of an |
263 | * active timer (if the timer is inactive it will be activated) | 265 | * active timer (if the timer is inactive it will be activated) |
@@ -291,7 +293,7 @@ int mod_timer(struct timer_list *timer, unsigned long expires) | |||
291 | 293 | ||
292 | EXPORT_SYMBOL(mod_timer); | 294 | EXPORT_SYMBOL(mod_timer); |
293 | 295 | ||
294 | /*** | 296 | /** |
295 | * del_timer - deactive a timer. | 297 | * del_timer - deactive a timer. |
296 | * @timer: the timer to be deactivated | 298 | * @timer: the timer to be deactivated |
297 | * | 299 | * |
@@ -323,7 +325,10 @@ int del_timer(struct timer_list *timer) | |||
323 | EXPORT_SYMBOL(del_timer); | 325 | EXPORT_SYMBOL(del_timer); |
324 | 326 | ||
325 | #ifdef CONFIG_SMP | 327 | #ifdef CONFIG_SMP |
326 | /* | 328 | /** |
329 | * try_to_del_timer_sync - Try to deactivate a timer | ||
330 | * @timer: timer do del | ||
331 | * | ||
327 | * This function tries to deactivate a timer. Upon successful (ret >= 0) | 332 | * This function tries to deactivate a timer. Upon successful (ret >= 0) |
328 | * exit the timer is not queued and the handler is not running on any CPU. | 333 | * exit the timer is not queued and the handler is not running on any CPU. |
329 | * | 334 | * |
@@ -351,7 +356,7 @@ out: | |||
351 | return ret; | 356 | return ret; |
352 | } | 357 | } |
353 | 358 | ||
354 | /*** | 359 | /** |
355 | * del_timer_sync - deactivate a timer and wait for the handler to finish. | 360 | * del_timer_sync - deactivate a timer and wait for the handler to finish. |
356 | * @timer: the timer to be deactivated | 361 | * @timer: the timer to be deactivated |
357 | * | 362 | * |
@@ -401,15 +406,15 @@ static int cascade(tvec_base_t *base, tvec_t *tv, int index) | |||
401 | return index; | 406 | return index; |
402 | } | 407 | } |
403 | 408 | ||
404 | /*** | 409 | #define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK) |
410 | |||
411 | /** | ||
405 | * __run_timers - run all expired timers (if any) on this CPU. | 412 | * __run_timers - run all expired timers (if any) on this CPU. |
406 | * @base: the timer vector to be processed. | 413 | * @base: the timer vector to be processed. |
407 | * | 414 | * |
408 | * This function cascades all vectors and executes all expired timer | 415 | * This function cascades all vectors and executes all expired timer |
409 | * vectors. | 416 | * vectors. |
410 | */ | 417 | */ |
411 | #define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK) | ||
412 | |||
413 | static inline void __run_timers(tvec_base_t *base) | 418 | static inline void __run_timers(tvec_base_t *base) |
414 | { | 419 | { |
415 | struct timer_list *timer; | 420 | struct timer_list *timer; |
@@ -970,7 +975,7 @@ void __init timekeeping_init(void) | |||
970 | 975 | ||
971 | 976 | ||
972 | static int timekeeping_suspended; | 977 | static int timekeeping_suspended; |
973 | /* | 978 | /** |
974 | * timekeeping_resume - Resumes the generic timekeeping subsystem. | 979 | * timekeeping_resume - Resumes the generic timekeeping subsystem. |
975 | * @dev: unused | 980 | * @dev: unused |
976 | * | 981 | * |
@@ -1106,7 +1111,7 @@ static void clocksource_adjust(struct clocksource *clock, s64 offset) | |||
1106 | clock->error -= (interval - offset) << (TICK_LENGTH_SHIFT - clock->shift); | 1111 | clock->error -= (interval - offset) << (TICK_LENGTH_SHIFT - clock->shift); |
1107 | } | 1112 | } |
1108 | 1113 | ||
1109 | /* | 1114 | /** |
1110 | * update_wall_time - Uses the current clocksource to increment the wall time | 1115 | * update_wall_time - Uses the current clocksource to increment the wall time |
1111 | * | 1116 | * |
1112 | * Called from the timer interrupt, must hold a write on xtime_lock. | 1117 | * Called from the timer interrupt, must hold a write on xtime_lock. |
@@ -1217,10 +1222,8 @@ static inline void calc_load(unsigned long ticks) | |||
1217 | unsigned long active_tasks; /* fixed-point */ | 1222 | unsigned long active_tasks; /* fixed-point */ |
1218 | static int count = LOAD_FREQ; | 1223 | static int count = LOAD_FREQ; |
1219 | 1224 | ||
1220 | count -= ticks; | 1225 | active_tasks = count_active_tasks(); |
1221 | if (count < 0) { | 1226 | for (count -= ticks; count < 0; count += LOAD_FREQ) { |
1222 | count += LOAD_FREQ; | ||
1223 | active_tasks = count_active_tasks(); | ||
1224 | CALC_LOAD(avenrun[0], EXP_1, active_tasks); | 1227 | CALC_LOAD(avenrun[0], EXP_1, active_tasks); |
1225 | CALC_LOAD(avenrun[1], EXP_5, active_tasks); | 1228 | CALC_LOAD(avenrun[1], EXP_5, active_tasks); |
1226 | CALC_LOAD(avenrun[2], EXP_15, active_tasks); | 1229 | CALC_LOAD(avenrun[2], EXP_15, active_tasks); |
@@ -1265,11 +1268,8 @@ void run_local_timers(void) | |||
1265 | * Called by the timer interrupt. xtime_lock must already be taken | 1268 | * Called by the timer interrupt. xtime_lock must already be taken |
1266 | * by the timer IRQ! | 1269 | * by the timer IRQ! |
1267 | */ | 1270 | */ |
1268 | static inline void update_times(void) | 1271 | static inline void update_times(unsigned long ticks) |
1269 | { | 1272 | { |
1270 | unsigned long ticks; | ||
1271 | |||
1272 | ticks = jiffies - wall_jiffies; | ||
1273 | wall_jiffies += ticks; | 1273 | wall_jiffies += ticks; |
1274 | update_wall_time(); | 1274 | update_wall_time(); |
1275 | calc_load(ticks); | 1275 | calc_load(ticks); |
@@ -1281,12 +1281,10 @@ static inline void update_times(void) | |||
1281 | * jiffies is defined in the linker script... | 1281 | * jiffies is defined in the linker script... |
1282 | */ | 1282 | */ |
1283 | 1283 | ||
1284 | void do_timer(struct pt_regs *regs) | 1284 | void do_timer(unsigned long ticks) |
1285 | { | 1285 | { |
1286 | jiffies_64++; | 1286 | jiffies_64 += ticks; |
1287 | /* prevent loading jiffies before storing new jiffies_64 value. */ | 1287 | update_times(ticks); |
1288 | barrier(); | ||
1289 | update_times(); | ||
1290 | } | 1288 | } |
1291 | 1289 | ||
1292 | #ifdef __ARCH_WANT_SYS_ALARM | 1290 | #ifdef __ARCH_WANT_SYS_ALARM |
@@ -1470,8 +1468,9 @@ asmlinkage long sys_gettid(void) | |||
1470 | return current->pid; | 1468 | return current->pid; |
1471 | } | 1469 | } |
1472 | 1470 | ||
1473 | /* | 1471 | /** |
1474 | * sys_sysinfo - fill in sysinfo struct | 1472 | * sys_sysinfo - fill in sysinfo struct |
1473 | * @info: pointer to buffer to fill | ||
1475 | */ | 1474 | */ |
1476 | asmlinkage long sys_sysinfo(struct sysinfo __user *info) | 1475 | asmlinkage long sys_sysinfo(struct sysinfo __user *info) |
1477 | { | 1476 | { |
@@ -1688,8 +1687,10 @@ static struct notifier_block __cpuinitdata timers_nb = { | |||
1688 | 1687 | ||
1689 | void __init init_timers(void) | 1688 | void __init init_timers(void) |
1690 | { | 1689 | { |
1691 | timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE, | 1690 | int err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE, |
1692 | (void *)(long)smp_processor_id()); | 1691 | (void *)(long)smp_processor_id()); |
1692 | |||
1693 | BUG_ON(err == NOTIFY_BAD); | ||
1693 | register_cpu_notifier(&timers_nb); | 1694 | register_cpu_notifier(&timers_nb); |
1694 | open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL); | 1695 | open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL); |
1695 | } | 1696 | } |
diff --git a/kernel/unwind.c b/kernel/unwind.c index 3430475fcd88..2e2368607aab 100644 --- a/kernel/unwind.c +++ b/kernel/unwind.c | |||
@@ -102,7 +102,7 @@ static struct unwind_table { | |||
102 | unsigned long size; | 102 | unsigned long size; |
103 | struct unwind_table *link; | 103 | struct unwind_table *link; |
104 | const char *name; | 104 | const char *name; |
105 | } root_table, *last_table; | 105 | } root_table; |
106 | 106 | ||
107 | struct unwind_item { | 107 | struct unwind_item { |
108 | enum item_location { | 108 | enum item_location { |
@@ -174,6 +174,8 @@ void __init unwind_init(void) | |||
174 | 174 | ||
175 | #ifdef CONFIG_MODULES | 175 | #ifdef CONFIG_MODULES |
176 | 176 | ||
177 | static struct unwind_table *last_table; | ||
178 | |||
177 | /* Must be called with module_mutex held. */ | 179 | /* Must be called with module_mutex held. */ |
178 | void *unwind_add_table(struct module *module, | 180 | void *unwind_add_table(struct module *module, |
179 | const void *table_start, | 181 | const void *table_start, |