diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 8 | ||||
-rw-r--r-- | kernel/auditfilter.c | 10 | ||||
-rw-r--r-- | kernel/fork.c | 1 | ||||
-rw-r--r-- | kernel/gcov/Kconfig | 2 | ||||
-rw-r--r-- | kernel/irq/manage.c | 2 | ||||
-rw-r--r-- | kernel/irq/proc.c | 3 | ||||
-rw-r--r-- | kernel/perf_event.c | 17 | ||||
-rw-r--r-- | kernel/pid.c | 2 | ||||
-rw-r--r-- | kernel/pm_qos_params.c | 24 | ||||
-rw-r--r-- | kernel/power/Kconfig | 237 | ||||
-rw-r--r-- | kernel/power/hibernate.c | 9 | ||||
-rw-r--r-- | kernel/power/main.c | 3 | ||||
-rw-r--r-- | kernel/power/snapshot.c | 8 | ||||
-rw-r--r-- | kernel/power/suspend.c | 4 | ||||
-rw-r--r-- | kernel/printk.c | 138 | ||||
-rw-r--r-- | kernel/rcupdate.c | 10 | ||||
-rw-r--r-- | kernel/rcutiny_plugin.h | 2 | ||||
-rw-r--r-- | kernel/rcutorture.c | 1 | ||||
-rw-r--r-- | kernel/sched.c | 9 | ||||
-rw-r--r-- | kernel/smp.c | 71 | ||||
-rw-r--r-- | kernel/sys.c | 4 | ||||
-rw-r--r-- | kernel/sysctl.c | 5 | ||||
-rw-r--r-- | kernel/trace/Kconfig | 4 | ||||
-rw-r--r-- | kernel/trace/ring_buffer.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_events_filter.c | 2 | ||||
-rw-r--r-- | kernel/workqueue.c | 6 |
26 files changed, 349 insertions, 235 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index e4956244ae50..939500317066 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -74,6 +74,8 @@ static int audit_initialized; | |||
74 | int audit_enabled; | 74 | int audit_enabled; |
75 | int audit_ever_enabled; | 75 | int audit_ever_enabled; |
76 | 76 | ||
77 | EXPORT_SYMBOL_GPL(audit_enabled); | ||
78 | |||
77 | /* Default state when kernel boots without any parameters. */ | 79 | /* Default state when kernel boots without any parameters. */ |
78 | static int audit_default; | 80 | static int audit_default; |
79 | 81 | ||
@@ -671,9 +673,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
671 | 673 | ||
672 | pid = NETLINK_CREDS(skb)->pid; | 674 | pid = NETLINK_CREDS(skb)->pid; |
673 | uid = NETLINK_CREDS(skb)->uid; | 675 | uid = NETLINK_CREDS(skb)->uid; |
674 | loginuid = NETLINK_CB(skb).loginuid; | 676 | loginuid = audit_get_loginuid(current); |
675 | sessionid = NETLINK_CB(skb).sessionid; | 677 | sessionid = audit_get_sessionid(current); |
676 | sid = NETLINK_CB(skb).sid; | 678 | security_task_getsecid(current, &sid); |
677 | seq = nlh->nlmsg_seq; | 679 | seq = nlh->nlmsg_seq; |
678 | data = NLMSG_DATA(nlh); | 680 | data = NLMSG_DATA(nlh); |
679 | 681 | ||
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index add2819af71b..f8277c80d678 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -1238,6 +1238,7 @@ static int audit_filter_user_rules(struct netlink_skb_parms *cb, | |||
1238 | for (i = 0; i < rule->field_count; i++) { | 1238 | for (i = 0; i < rule->field_count; i++) { |
1239 | struct audit_field *f = &rule->fields[i]; | 1239 | struct audit_field *f = &rule->fields[i]; |
1240 | int result = 0; | 1240 | int result = 0; |
1241 | u32 sid; | ||
1241 | 1242 | ||
1242 | switch (f->type) { | 1243 | switch (f->type) { |
1243 | case AUDIT_PID: | 1244 | case AUDIT_PID: |
@@ -1250,19 +1251,22 @@ static int audit_filter_user_rules(struct netlink_skb_parms *cb, | |||
1250 | result = audit_comparator(cb->creds.gid, f->op, f->val); | 1251 | result = audit_comparator(cb->creds.gid, f->op, f->val); |
1251 | break; | 1252 | break; |
1252 | case AUDIT_LOGINUID: | 1253 | case AUDIT_LOGINUID: |
1253 | result = audit_comparator(cb->loginuid, f->op, f->val); | 1254 | result = audit_comparator(audit_get_loginuid(current), |
1255 | f->op, f->val); | ||
1254 | break; | 1256 | break; |
1255 | case AUDIT_SUBJ_USER: | 1257 | case AUDIT_SUBJ_USER: |
1256 | case AUDIT_SUBJ_ROLE: | 1258 | case AUDIT_SUBJ_ROLE: |
1257 | case AUDIT_SUBJ_TYPE: | 1259 | case AUDIT_SUBJ_TYPE: |
1258 | case AUDIT_SUBJ_SEN: | 1260 | case AUDIT_SUBJ_SEN: |
1259 | case AUDIT_SUBJ_CLR: | 1261 | case AUDIT_SUBJ_CLR: |
1260 | if (f->lsm_rule) | 1262 | if (f->lsm_rule) { |
1261 | result = security_audit_rule_match(cb->sid, | 1263 | security_task_getsecid(current, &sid); |
1264 | result = security_audit_rule_match(sid, | ||
1262 | f->type, | 1265 | f->type, |
1263 | f->op, | 1266 | f->op, |
1264 | f->lsm_rule, | 1267 | f->lsm_rule, |
1265 | NULL); | 1268 | NULL); |
1269 | } | ||
1266 | break; | 1270 | break; |
1267 | } | 1271 | } |
1268 | 1272 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index 25e429152ddc..05b92c457010 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -193,6 +193,7 @@ void __put_task_struct(struct task_struct *tsk) | |||
193 | if (!profile_handoff_task(tsk)) | 193 | if (!profile_handoff_task(tsk)) |
194 | free_task(tsk); | 194 | free_task(tsk); |
195 | } | 195 | } |
196 | EXPORT_SYMBOL_GPL(__put_task_struct); | ||
196 | 197 | ||
197 | /* | 198 | /* |
198 | * macro override instead of weak attribute alias, to workaround | 199 | * macro override instead of weak attribute alias, to workaround |
diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig index 70a298d6da71..b8cadf70b1fb 100644 --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig | |||
@@ -34,7 +34,7 @@ config GCOV_KERNEL | |||
34 | config GCOV_PROFILE_ALL | 34 | config GCOV_PROFILE_ALL |
35 | bool "Profile entire Kernel" | 35 | bool "Profile entire Kernel" |
36 | depends on GCOV_KERNEL | 36 | depends on GCOV_KERNEL |
37 | depends on S390 || X86 || (PPC && EXPERIMENTAL) || MICROBLAZE | 37 | depends on SUPERH || S390 || X86 || (PPC && EXPERIMENTAL) || MICROBLAZE |
38 | default n | 38 | default n |
39 | ---help--- | 39 | ---help--- |
40 | This options activates profiling for the entire kernel. | 40 | This options activates profiling for the entire kernel. |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index acd599a43bfb..0a2aa73e536c 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -1064,10 +1064,10 @@ mismatch: | |||
1064 | ret = -EBUSY; | 1064 | ret = -EBUSY; |
1065 | 1065 | ||
1066 | out_mask: | 1066 | out_mask: |
1067 | raw_spin_unlock_irqrestore(&desc->lock, flags); | ||
1067 | free_cpumask_var(mask); | 1068 | free_cpumask_var(mask); |
1068 | 1069 | ||
1069 | out_thread: | 1070 | out_thread: |
1070 | raw_spin_unlock_irqrestore(&desc->lock, flags); | ||
1071 | if (new->thread) { | 1071 | if (new->thread) { |
1072 | struct task_struct *t = new->thread; | 1072 | struct task_struct *t = new->thread; |
1073 | 1073 | ||
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 4cc2e5ed0bec..760248de109d 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -405,7 +405,8 @@ int show_interrupts(struct seq_file *p, void *v) | |||
405 | for_each_online_cpu(j) | 405 | for_each_online_cpu(j) |
406 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); | 406 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); |
407 | seq_printf(p, " %8s", desc->irq_data.chip->name); | 407 | seq_printf(p, " %8s", desc->irq_data.chip->name); |
408 | seq_printf(p, "-%-8s", desc->name); | 408 | if (desc->name) |
409 | seq_printf(p, "-%-8s", desc->name); | ||
409 | 410 | ||
410 | if (action) { | 411 | if (action) { |
411 | seq_printf(p, " %s", action->name); | 412 | seq_printf(p, " %s", action->name); |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index ed253aa24ba4..3472bb1a070c 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -5122,7 +5122,7 @@ static int perf_exclude_event(struct perf_event *event, | |||
5122 | struct pt_regs *regs) | 5122 | struct pt_regs *regs) |
5123 | { | 5123 | { |
5124 | if (event->hw.state & PERF_HES_STOPPED) | 5124 | if (event->hw.state & PERF_HES_STOPPED) |
5125 | return 0; | 5125 | return 1; |
5126 | 5126 | ||
5127 | if (regs) { | 5127 | if (regs) { |
5128 | if (event->attr.exclude_user && user_mode(regs)) | 5128 | if (event->attr.exclude_user && user_mode(regs)) |
@@ -5478,6 +5478,8 @@ static int perf_tp_event_match(struct perf_event *event, | |||
5478 | struct perf_sample_data *data, | 5478 | struct perf_sample_data *data, |
5479 | struct pt_regs *regs) | 5479 | struct pt_regs *regs) |
5480 | { | 5480 | { |
5481 | if (event->hw.state & PERF_HES_STOPPED) | ||
5482 | return 0; | ||
5481 | /* | 5483 | /* |
5482 | * All tracepoints are from kernel-space. | 5484 | * All tracepoints are from kernel-space. |
5483 | */ | 5485 | */ |
@@ -6720,17 +6722,20 @@ __perf_event_exit_task(struct perf_event *child_event, | |||
6720 | struct perf_event_context *child_ctx, | 6722 | struct perf_event_context *child_ctx, |
6721 | struct task_struct *child) | 6723 | struct task_struct *child) |
6722 | { | 6724 | { |
6723 | struct perf_event *parent_event; | 6725 | if (child_event->parent) { |
6726 | raw_spin_lock_irq(&child_ctx->lock); | ||
6727 | perf_group_detach(child_event); | ||
6728 | raw_spin_unlock_irq(&child_ctx->lock); | ||
6729 | } | ||
6724 | 6730 | ||
6725 | perf_remove_from_context(child_event); | 6731 | perf_remove_from_context(child_event); |
6726 | 6732 | ||
6727 | parent_event = child_event->parent; | ||
6728 | /* | 6733 | /* |
6729 | * It can happen that parent exits first, and has events | 6734 | * It can happen that the parent exits first, and has events |
6730 | * that are still around due to the child reference. These | 6735 | * that are still around due to the child reference. These |
6731 | * events need to be zapped - but otherwise linger. | 6736 | * events need to be zapped. |
6732 | */ | 6737 | */ |
6733 | if (parent_event) { | 6738 | if (child_event->parent) { |
6734 | sync_child_event(child_event, child); | 6739 | sync_child_event(child_event, child); |
6735 | free_event(child_event); | 6740 | free_event(child_event); |
6736 | } | 6741 | } |
diff --git a/kernel/pid.c b/kernel/pid.c index 39b65b69584f..02f221274265 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -435,6 +435,7 @@ struct pid *get_task_pid(struct task_struct *task, enum pid_type type) | |||
435 | rcu_read_unlock(); | 435 | rcu_read_unlock(); |
436 | return pid; | 436 | return pid; |
437 | } | 437 | } |
438 | EXPORT_SYMBOL_GPL(get_task_pid); | ||
438 | 439 | ||
439 | struct task_struct *get_pid_task(struct pid *pid, enum pid_type type) | 440 | struct task_struct *get_pid_task(struct pid *pid, enum pid_type type) |
440 | { | 441 | { |
@@ -446,6 +447,7 @@ struct task_struct *get_pid_task(struct pid *pid, enum pid_type type) | |||
446 | rcu_read_unlock(); | 447 | rcu_read_unlock(); |
447 | return result; | 448 | return result; |
448 | } | 449 | } |
450 | EXPORT_SYMBOL_GPL(get_pid_task); | ||
449 | 451 | ||
450 | struct pid *find_get_pid(pid_t nr) | 452 | struct pid *find_get_pid(pid_t nr) |
451 | { | 453 | { |
diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c index aeaa7f846821..0da058bff8eb 100644 --- a/kernel/pm_qos_params.c +++ b/kernel/pm_qos_params.c | |||
@@ -103,11 +103,14 @@ static struct pm_qos_object *pm_qos_array[] = { | |||
103 | 103 | ||
104 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | 104 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, |
105 | size_t count, loff_t *f_pos); | 105 | size_t count, loff_t *f_pos); |
106 | static ssize_t pm_qos_power_read(struct file *filp, char __user *buf, | ||
107 | size_t count, loff_t *f_pos); | ||
106 | static int pm_qos_power_open(struct inode *inode, struct file *filp); | 108 | static int pm_qos_power_open(struct inode *inode, struct file *filp); |
107 | static int pm_qos_power_release(struct inode *inode, struct file *filp); | 109 | static int pm_qos_power_release(struct inode *inode, struct file *filp); |
108 | 110 | ||
109 | static const struct file_operations pm_qos_power_fops = { | 111 | static const struct file_operations pm_qos_power_fops = { |
110 | .write = pm_qos_power_write, | 112 | .write = pm_qos_power_write, |
113 | .read = pm_qos_power_read, | ||
111 | .open = pm_qos_power_open, | 114 | .open = pm_qos_power_open, |
112 | .release = pm_qos_power_release, | 115 | .release = pm_qos_power_release, |
113 | .llseek = noop_llseek, | 116 | .llseek = noop_llseek, |
@@ -376,6 +379,27 @@ static int pm_qos_power_release(struct inode *inode, struct file *filp) | |||
376 | } | 379 | } |
377 | 380 | ||
378 | 381 | ||
382 | static ssize_t pm_qos_power_read(struct file *filp, char __user *buf, | ||
383 | size_t count, loff_t *f_pos) | ||
384 | { | ||
385 | s32 value; | ||
386 | unsigned long flags; | ||
387 | struct pm_qos_object *o; | ||
388 | struct pm_qos_request_list *pm_qos_req = filp->private_data;; | ||
389 | |||
390 | if (!pm_qos_req) | ||
391 | return -EINVAL; | ||
392 | if (!pm_qos_request_active(pm_qos_req)) | ||
393 | return -EINVAL; | ||
394 | |||
395 | o = pm_qos_array[pm_qos_req->pm_qos_class]; | ||
396 | spin_lock_irqsave(&pm_qos_lock, flags); | ||
397 | value = pm_qos_get_value(o); | ||
398 | spin_unlock_irqrestore(&pm_qos_lock, flags); | ||
399 | |||
400 | return simple_read_from_buffer(buf, count, f_pos, &value, sizeof(s32)); | ||
401 | } | ||
402 | |||
379 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | 403 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, |
380 | size_t count, loff_t *f_pos) | 404 | size_t count, loff_t *f_pos) |
381 | { | 405 | { |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 265729966ece..4603f08dc47b 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -1,125 +1,12 @@ | |||
1 | config PM | ||
2 | bool "Power Management support" | ||
3 | depends on !IA64_HP_SIM | ||
4 | ---help--- | ||
5 | "Power Management" means that parts of your computer are shut | ||
6 | off or put into a power conserving "sleep" mode if they are not | ||
7 | being used. There are two competing standards for doing this: APM | ||
8 | and ACPI. If you want to use either one, say Y here and then also | ||
9 | to the requisite support below. | ||
10 | |||
11 | Power Management is most important for battery powered laptop | ||
12 | computers; if you have a laptop, check out the Linux Laptop home | ||
13 | page on the WWW at <http://www.linux-on-laptops.com/> or | ||
14 | Tuxmobil - Linux on Mobile Computers at <http://www.tuxmobil.org/> | ||
15 | and the Battery Powered Linux mini-HOWTO, available from | ||
16 | <http://www.tldp.org/docs.html#howto>. | ||
17 | |||
18 | Note that, even if you say N here, Linux on the x86 architecture | ||
19 | will issue the hlt instruction if nothing is to be done, thereby | ||
20 | sending the processor to sleep and saving power. | ||
21 | |||
22 | config PM_DEBUG | ||
23 | bool "Power Management Debug Support" | ||
24 | depends on PM | ||
25 | ---help--- | ||
26 | This option enables various debugging support in the Power Management | ||
27 | code. This is helpful when debugging and reporting PM bugs, like | ||
28 | suspend support. | ||
29 | |||
30 | config PM_ADVANCED_DEBUG | ||
31 | bool "Extra PM attributes in sysfs for low-level debugging/testing" | ||
32 | depends on PM_DEBUG | ||
33 | default n | ||
34 | ---help--- | ||
35 | Add extra sysfs attributes allowing one to access some Power Management | ||
36 | fields of device objects from user space. If you are not a kernel | ||
37 | developer interested in debugging/testing Power Management, say "no". | ||
38 | |||
39 | config PM_VERBOSE | ||
40 | bool "Verbose Power Management debugging" | ||
41 | depends on PM_DEBUG | ||
42 | default n | ||
43 | ---help--- | ||
44 | This option enables verbose messages from the Power Management code. | ||
45 | |||
46 | config CAN_PM_TRACE | ||
47 | def_bool y | ||
48 | depends on PM_DEBUG && PM_SLEEP && EXPERIMENTAL | ||
49 | |||
50 | config PM_TRACE | ||
51 | bool | ||
52 | help | ||
53 | This enables code to save the last PM event point across | ||
54 | reboot. The architecture needs to support this, x86 for | ||
55 | example does by saving things in the RTC, see below. | ||
56 | |||
57 | The architecture specific code must provide the extern | ||
58 | functions from <linux/resume-trace.h> as well as the | ||
59 | <asm/resume-trace.h> header with a TRACE_RESUME() macro. | ||
60 | |||
61 | The way the information is presented is architecture- | ||
62 | dependent, x86 will print the information during a | ||
63 | late_initcall. | ||
64 | |||
65 | config PM_TRACE_RTC | ||
66 | bool "Suspend/resume event tracing" | ||
67 | depends on CAN_PM_TRACE | ||
68 | depends on X86 | ||
69 | select PM_TRACE | ||
70 | default n | ||
71 | ---help--- | ||
72 | This enables some cheesy code to save the last PM event point in the | ||
73 | RTC across reboots, so that you can debug a machine that just hangs | ||
74 | during suspend (or more commonly, during resume). | ||
75 | |||
76 | To use this debugging feature you should attempt to suspend the | ||
77 | machine, reboot it and then run | ||
78 | |||
79 | dmesg -s 1000000 | grep 'hash matches' | ||
80 | |||
81 | CAUTION: this option will cause your machine's real-time clock to be | ||
82 | set to an invalid time after a resume. | ||
83 | |||
84 | config PM_SLEEP_SMP | ||
85 | bool | ||
86 | depends on SMP | ||
87 | depends on ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE | ||
88 | depends on PM_SLEEP | ||
89 | select HOTPLUG | ||
90 | select HOTPLUG_CPU | ||
91 | default y | ||
92 | |||
93 | config PM_SLEEP | ||
94 | bool | ||
95 | depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE | ||
96 | default y | ||
97 | |||
98 | config PM_SLEEP_ADVANCED_DEBUG | ||
99 | bool | ||
100 | depends on PM_ADVANCED_DEBUG | ||
101 | default n | ||
102 | |||
103 | config SUSPEND | 1 | config SUSPEND |
104 | bool "Suspend to RAM and standby" | 2 | bool "Suspend to RAM and standby" |
105 | depends on PM && ARCH_SUSPEND_POSSIBLE | 3 | depends on ARCH_SUSPEND_POSSIBLE |
106 | default y | 4 | default y |
107 | ---help--- | 5 | ---help--- |
108 | Allow the system to enter sleep states in which main memory is | 6 | Allow the system to enter sleep states in which main memory is |
109 | powered and thus its contents are preserved, such as the | 7 | powered and thus its contents are preserved, such as the |
110 | suspend-to-RAM state (e.g. the ACPI S3 state). | 8 | suspend-to-RAM state (e.g. the ACPI S3 state). |
111 | 9 | ||
112 | config PM_TEST_SUSPEND | ||
113 | bool "Test suspend/resume and wakealarm during bootup" | ||
114 | depends on SUSPEND && PM_DEBUG && RTC_CLASS=y | ||
115 | ---help--- | ||
116 | This option will let you suspend your machine during bootup, and | ||
117 | make it wake up a few seconds later using an RTC wakeup alarm. | ||
118 | Enable this with a kernel parameter like "test_suspend=mem". | ||
119 | |||
120 | You probably want to have your system's RTC driver statically | ||
121 | linked, ensuring that it's available when this test runs. | ||
122 | |||
123 | config SUSPEND_FREEZER | 10 | config SUSPEND_FREEZER |
124 | bool "Enable freezer for suspend to RAM/standby" \ | 11 | bool "Enable freezer for suspend to RAM/standby" \ |
125 | if ARCH_WANTS_FREEZER_CONTROL || BROKEN | 12 | if ARCH_WANTS_FREEZER_CONTROL || BROKEN |
@@ -133,7 +20,7 @@ config SUSPEND_FREEZER | |||
133 | 20 | ||
134 | config HIBERNATION | 21 | config HIBERNATION |
135 | bool "Hibernation (aka 'suspend to disk')" | 22 | bool "Hibernation (aka 'suspend to disk')" |
136 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE | 23 | depends on SWAP && ARCH_HIBERNATION_POSSIBLE |
137 | select LZO_COMPRESS | 24 | select LZO_COMPRESS |
138 | select LZO_DECOMPRESS | 25 | select LZO_DECOMPRESS |
139 | ---help--- | 26 | ---help--- |
@@ -196,6 +83,106 @@ config PM_STD_PARTITION | |||
196 | suspended image to. It will simply pick the first available swap | 83 | suspended image to. It will simply pick the first available swap |
197 | device. | 84 | device. |
198 | 85 | ||
86 | config PM_SLEEP | ||
87 | def_bool y | ||
88 | depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE | ||
89 | |||
90 | config PM_SLEEP_SMP | ||
91 | def_bool y | ||
92 | depends on SMP | ||
93 | depends on ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE | ||
94 | depends on PM_SLEEP | ||
95 | select HOTPLUG | ||
96 | select HOTPLUG_CPU | ||
97 | |||
98 | config PM_RUNTIME | ||
99 | bool "Run-time PM core functionality" | ||
100 | depends on !IA64_HP_SIM | ||
101 | ---help--- | ||
102 | Enable functionality allowing I/O devices to be put into energy-saving | ||
103 | (low power) states at run time (or autosuspended) after a specified | ||
104 | period of inactivity and woken up in response to a hardware-generated | ||
105 | wake-up event or a driver's request. | ||
106 | |||
107 | Hardware support is generally required for this functionality to work | ||
108 | and the bus type drivers of the buses the devices are on are | ||
109 | responsible for the actual handling of the autosuspend requests and | ||
110 | wake-up events. | ||
111 | |||
112 | config PM | ||
113 | def_bool y | ||
114 | depends on PM_SLEEP || PM_RUNTIME | ||
115 | |||
116 | config PM_DEBUG | ||
117 | bool "Power Management Debug Support" | ||
118 | depends on PM | ||
119 | ---help--- | ||
120 | This option enables various debugging support in the Power Management | ||
121 | code. This is helpful when debugging and reporting PM bugs, like | ||
122 | suspend support. | ||
123 | |||
124 | config PM_VERBOSE | ||
125 | bool "Verbose Power Management debugging" | ||
126 | depends on PM_DEBUG | ||
127 | ---help--- | ||
128 | This option enables verbose messages from the Power Management code. | ||
129 | |||
130 | config PM_ADVANCED_DEBUG | ||
131 | bool "Extra PM attributes in sysfs for low-level debugging/testing" | ||
132 | depends on PM_DEBUG | ||
133 | ---help--- | ||
134 | Add extra sysfs attributes allowing one to access some Power Management | ||
135 | fields of device objects from user space. If you are not a kernel | ||
136 | developer interested in debugging/testing Power Management, say "no". | ||
137 | |||
138 | config PM_TEST_SUSPEND | ||
139 | bool "Test suspend/resume and wakealarm during bootup" | ||
140 | depends on SUSPEND && PM_DEBUG && RTC_CLASS=y | ||
141 | ---help--- | ||
142 | This option will let you suspend your machine during bootup, and | ||
143 | make it wake up a few seconds later using an RTC wakeup alarm. | ||
144 | Enable this with a kernel parameter like "test_suspend=mem". | ||
145 | |||
146 | You probably want to have your system's RTC driver statically | ||
147 | linked, ensuring that it's available when this test runs. | ||
148 | |||
149 | config CAN_PM_TRACE | ||
150 | def_bool y | ||
151 | depends on PM_DEBUG && PM_SLEEP | ||
152 | |||
153 | config PM_TRACE | ||
154 | bool | ||
155 | help | ||
156 | This enables code to save the last PM event point across | ||
157 | reboot. The architecture needs to support this, x86 for | ||
158 | example does by saving things in the RTC, see below. | ||
159 | |||
160 | The architecture specific code must provide the extern | ||
161 | functions from <linux/resume-trace.h> as well as the | ||
162 | <asm/resume-trace.h> header with a TRACE_RESUME() macro. | ||
163 | |||
164 | The way the information is presented is architecture- | ||
165 | dependent, x86 will print the information during a | ||
166 | late_initcall. | ||
167 | |||
168 | config PM_TRACE_RTC | ||
169 | bool "Suspend/resume event tracing" | ||
170 | depends on CAN_PM_TRACE | ||
171 | depends on X86 | ||
172 | select PM_TRACE | ||
173 | ---help--- | ||
174 | This enables some cheesy code to save the last PM event point in the | ||
175 | RTC across reboots, so that you can debug a machine that just hangs | ||
176 | during suspend (or more commonly, during resume). | ||
177 | |||
178 | To use this debugging feature you should attempt to suspend the | ||
179 | machine, reboot it and then run | ||
180 | |||
181 | dmesg -s 1000000 | grep 'hash matches' | ||
182 | |||
183 | CAUTION: this option will cause your machine's real-time clock to be | ||
184 | set to an invalid time after a resume. | ||
185 | |||
199 | config APM_EMULATION | 186 | config APM_EMULATION |
200 | tristate "Advanced Power Management Emulation" | 187 | tristate "Advanced Power Management Emulation" |
201 | depends on PM && SYS_SUPPORTS_APM_EMULATION | 188 | depends on PM && SYS_SUPPORTS_APM_EMULATION |
@@ -222,31 +209,11 @@ config APM_EMULATION | |||
222 | anything, try disabling/enabling this option (or disabling/enabling | 209 | anything, try disabling/enabling this option (or disabling/enabling |
223 | APM in your BIOS). | 210 | APM in your BIOS). |
224 | 211 | ||
225 | config PM_RUNTIME | ||
226 | bool "Run-time PM core functionality" | ||
227 | depends on PM | ||
228 | ---help--- | ||
229 | Enable functionality allowing I/O devices to be put into energy-saving | ||
230 | (low power) states at run time (or autosuspended) after a specified | ||
231 | period of inactivity and woken up in response to a hardware-generated | ||
232 | wake-up event or a driver's request. | ||
233 | |||
234 | Hardware support is generally required for this functionality to work | ||
235 | and the bus type drivers of the buses the devices are on are | ||
236 | responsible for the actual handling of the autosuspend requests and | ||
237 | wake-up events. | ||
238 | |||
239 | config PM_OPS | ||
240 | bool | ||
241 | depends on PM_SLEEP || PM_RUNTIME | ||
242 | default y | ||
243 | |||
244 | config ARCH_HAS_OPP | 212 | config ARCH_HAS_OPP |
245 | bool | 213 | bool |
246 | 214 | ||
247 | config PM_OPP | 215 | config PM_OPP |
248 | bool "Operating Performance Point (OPP) Layer library" | 216 | bool "Operating Performance Point (OPP) Layer library" |
249 | depends on PM | ||
250 | depends on ARCH_HAS_OPP | 217 | depends on ARCH_HAS_OPP |
251 | ---help--- | 218 | ---help--- |
252 | SOCs have a standard set of tuples consisting of frequency and | 219 | SOCs have a standard set of tuples consisting of frequency and |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 1832bd264219..aeabd26e3342 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/cpu.h> | 23 | #include <linux/cpu.h> |
24 | #include <linux/freezer.h> | 24 | #include <linux/freezer.h> |
25 | #include <linux/gfp.h> | 25 | #include <linux/gfp.h> |
26 | #include <linux/syscore_ops.h> | ||
26 | #include <scsi/scsi_scan.h> | 27 | #include <scsi/scsi_scan.h> |
27 | #include <asm/suspend.h> | 28 | #include <asm/suspend.h> |
28 | 29 | ||
@@ -272,6 +273,8 @@ static int create_image(int platform_mode) | |||
272 | local_irq_disable(); | 273 | local_irq_disable(); |
273 | 274 | ||
274 | error = sysdev_suspend(PMSG_FREEZE); | 275 | error = sysdev_suspend(PMSG_FREEZE); |
276 | if (!error) | ||
277 | error = syscore_suspend(); | ||
275 | if (error) { | 278 | if (error) { |
276 | printk(KERN_ERR "PM: Some system devices failed to power down, " | 279 | printk(KERN_ERR "PM: Some system devices failed to power down, " |
277 | "aborting hibernation\n"); | 280 | "aborting hibernation\n"); |
@@ -295,6 +298,7 @@ static int create_image(int platform_mode) | |||
295 | } | 298 | } |
296 | 299 | ||
297 | Power_up: | 300 | Power_up: |
301 | syscore_resume(); | ||
298 | sysdev_resume(); | 302 | sysdev_resume(); |
299 | /* NOTE: dpm_resume_noirq() is just a resume() for devices | 303 | /* NOTE: dpm_resume_noirq() is just a resume() for devices |
300 | * that suspended with irqs off ... no overall powerup. | 304 | * that suspended with irqs off ... no overall powerup. |
@@ -403,6 +407,8 @@ static int resume_target_kernel(bool platform_mode) | |||
403 | local_irq_disable(); | 407 | local_irq_disable(); |
404 | 408 | ||
405 | error = sysdev_suspend(PMSG_QUIESCE); | 409 | error = sysdev_suspend(PMSG_QUIESCE); |
410 | if (!error) | ||
411 | error = syscore_suspend(); | ||
406 | if (error) | 412 | if (error) |
407 | goto Enable_irqs; | 413 | goto Enable_irqs; |
408 | 414 | ||
@@ -429,6 +435,7 @@ static int resume_target_kernel(bool platform_mode) | |||
429 | restore_processor_state(); | 435 | restore_processor_state(); |
430 | touch_softlockup_watchdog(); | 436 | touch_softlockup_watchdog(); |
431 | 437 | ||
438 | syscore_resume(); | ||
432 | sysdev_resume(); | 439 | sysdev_resume(); |
433 | 440 | ||
434 | Enable_irqs: | 441 | Enable_irqs: |
@@ -516,6 +523,7 @@ int hibernation_platform_enter(void) | |||
516 | 523 | ||
517 | local_irq_disable(); | 524 | local_irq_disable(); |
518 | sysdev_suspend(PMSG_HIBERNATE); | 525 | sysdev_suspend(PMSG_HIBERNATE); |
526 | syscore_suspend(); | ||
519 | if (pm_wakeup_pending()) { | 527 | if (pm_wakeup_pending()) { |
520 | error = -EAGAIN; | 528 | error = -EAGAIN; |
521 | goto Power_up; | 529 | goto Power_up; |
@@ -526,6 +534,7 @@ int hibernation_platform_enter(void) | |||
526 | while (1); | 534 | while (1); |
527 | 535 | ||
528 | Power_up: | 536 | Power_up: |
537 | syscore_resume(); | ||
529 | sysdev_resume(); | 538 | sysdev_resume(); |
530 | local_irq_enable(); | 539 | local_irq_enable(); |
531 | enable_nonboot_cpus(); | 540 | enable_nonboot_cpus(); |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 701853042c28..8eaba5f27b10 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -17,9 +17,6 @@ | |||
17 | 17 | ||
18 | DEFINE_MUTEX(pm_mutex); | 18 | DEFINE_MUTEX(pm_mutex); |
19 | 19 | ||
20 | unsigned int pm_flags; | ||
21 | EXPORT_SYMBOL(pm_flags); | ||
22 | |||
23 | #ifdef CONFIG_PM_SLEEP | 20 | #ifdef CONFIG_PM_SLEEP |
24 | 21 | ||
25 | /* Routines for PM-transition notifications */ | 22 | /* Routines for PM-transition notifications */ |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 64db648ff911..ca0aacc24874 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -42,15 +42,15 @@ static void swsusp_unset_page_forbidden(struct page *); | |||
42 | 42 | ||
43 | /* | 43 | /* |
44 | * Preferred image size in bytes (tunable via /sys/power/image_size). | 44 | * Preferred image size in bytes (tunable via /sys/power/image_size). |
45 | * When it is set to N, swsusp will do its best to ensure the image | 45 | * When it is set to N, the image creating code will do its best to |
46 | * size will not exceed N bytes, but if that is impossible, it will | 46 | * ensure the image size will not exceed N bytes, but if that is |
47 | * try to create the smallest image possible. | 47 | * impossible, it will try to create the smallest image possible. |
48 | */ | 48 | */ |
49 | unsigned long image_size; | 49 | unsigned long image_size; |
50 | 50 | ||
51 | void __init hibernate_image_size_init(void) | 51 | void __init hibernate_image_size_init(void) |
52 | { | 52 | { |
53 | image_size = ((totalram_pages * 2) / 5) * PAGE_SIZE; | 53 | image_size = (totalram_pages / 3) * PAGE_SIZE; |
54 | } | 54 | } |
55 | 55 | ||
56 | /* List of PBEs needed for restoring the pages that were allocated before | 56 | /* List of PBEs needed for restoring the pages that were allocated before |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index de6f86bfa303..2814c32aed51 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/suspend.h> | 24 | #include <linux/suspend.h> |
25 | #include <linux/syscore_ops.h> | ||
25 | #include <trace/events/power.h> | 26 | #include <trace/events/power.h> |
26 | 27 | ||
27 | #include "power.h" | 28 | #include "power.h" |
@@ -163,11 +164,14 @@ static int suspend_enter(suspend_state_t state) | |||
163 | BUG_ON(!irqs_disabled()); | 164 | BUG_ON(!irqs_disabled()); |
164 | 165 | ||
165 | error = sysdev_suspend(PMSG_SUSPEND); | 166 | error = sysdev_suspend(PMSG_SUSPEND); |
167 | if (!error) | ||
168 | error = syscore_suspend(); | ||
166 | if (!error) { | 169 | if (!error) { |
167 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { | 170 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { |
168 | error = suspend_ops->enter(state); | 171 | error = suspend_ops->enter(state); |
169 | events_check_enabled = false; | 172 | events_check_enabled = false; |
170 | } | 173 | } |
174 | syscore_resume(); | ||
171 | sysdev_resume(); | 175 | sysdev_resume(); |
172 | } | 176 | } |
173 | 177 | ||
diff --git a/kernel/printk.c b/kernel/printk.c index 36231525e22f..33284adb2189 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -515,6 +515,71 @@ static void _call_console_drivers(unsigned start, | |||
515 | } | 515 | } |
516 | 516 | ||
517 | /* | 517 | /* |
518 | * Parse the syslog header <[0-9]*>. The decimal value represents 32bit, the | ||
519 | * lower 3 bit are the log level, the rest are the log facility. In case | ||
520 | * userspace passes usual userspace syslog messages to /dev/kmsg or | ||
521 | * /dev/ttyprintk, the log prefix might contain the facility. Printk needs | ||
522 | * to extract the correct log level for in-kernel processing, and not mangle | ||
523 | * the original value. | ||
524 | * | ||
525 | * If a prefix is found, the length of the prefix is returned. If 'level' is | ||
526 | * passed, it will be filled in with the log level without a possible facility | ||
527 | * value. If 'special' is passed, the special printk prefix chars are accepted | ||
528 | * and returned. If no valid header is found, 0 is returned and the passed | ||
529 | * variables are not touched. | ||
530 | */ | ||
531 | static size_t log_prefix(const char *p, unsigned int *level, char *special) | ||
532 | { | ||
533 | unsigned int lev = 0; | ||
534 | char sp = '\0'; | ||
535 | size_t len; | ||
536 | |||
537 | if (p[0] != '<' || !p[1]) | ||
538 | return 0; | ||
539 | if (p[2] == '>') { | ||
540 | /* usual single digit level number or special char */ | ||
541 | switch (p[1]) { | ||
542 | case '0' ... '7': | ||
543 | lev = p[1] - '0'; | ||
544 | break; | ||
545 | case 'c': /* KERN_CONT */ | ||
546 | case 'd': /* KERN_DEFAULT */ | ||
547 | sp = p[1]; | ||
548 | break; | ||
549 | default: | ||
550 | return 0; | ||
551 | } | ||
552 | len = 3; | ||
553 | } else { | ||
554 | /* multi digit including the level and facility number */ | ||
555 | char *endp = NULL; | ||
556 | |||
557 | if (p[1] < '0' && p[1] > '9') | ||
558 | return 0; | ||
559 | |||
560 | lev = (simple_strtoul(&p[1], &endp, 10) & 7); | ||
561 | if (endp == NULL || endp[0] != '>') | ||
562 | return 0; | ||
563 | len = (endp + 1) - p; | ||
564 | } | ||
565 | |||
566 | /* do not accept special char if not asked for */ | ||
567 | if (sp && !special) | ||
568 | return 0; | ||
569 | |||
570 | if (special) { | ||
571 | *special = sp; | ||
572 | /* return special char, do not touch level */ | ||
573 | if (sp) | ||
574 | return len; | ||
575 | } | ||
576 | |||
577 | if (level) | ||
578 | *level = lev; | ||
579 | return len; | ||
580 | } | ||
581 | |||
582 | /* | ||
518 | * Call the console drivers, asking them to write out | 583 | * Call the console drivers, asking them to write out |
519 | * log_buf[start] to log_buf[end - 1]. | 584 | * log_buf[start] to log_buf[end - 1]. |
520 | * The console_lock must be held. | 585 | * The console_lock must be held. |
@@ -529,13 +594,9 @@ static void call_console_drivers(unsigned start, unsigned end) | |||
529 | cur_index = start; | 594 | cur_index = start; |
530 | start_print = start; | 595 | start_print = start; |
531 | while (cur_index != end) { | 596 | while (cur_index != end) { |
532 | if (msg_level < 0 && ((end - cur_index) > 2) && | 597 | if (msg_level < 0 && ((end - cur_index) > 2)) { |
533 | LOG_BUF(cur_index + 0) == '<' && | 598 | /* strip log prefix */ |
534 | LOG_BUF(cur_index + 1) >= '0' && | 599 | cur_index += log_prefix(&LOG_BUF(cur_index), &msg_level, NULL); |
535 | LOG_BUF(cur_index + 1) <= '7' && | ||
536 | LOG_BUF(cur_index + 2) == '>') { | ||
537 | msg_level = LOG_BUF(cur_index + 1) - '0'; | ||
538 | cur_index += 3; | ||
539 | start_print = cur_index; | 600 | start_print = cur_index; |
540 | } | 601 | } |
541 | while (cur_index != end) { | 602 | while (cur_index != end) { |
@@ -733,6 +794,8 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
733 | unsigned long flags; | 794 | unsigned long flags; |
734 | int this_cpu; | 795 | int this_cpu; |
735 | char *p; | 796 | char *p; |
797 | size_t plen; | ||
798 | char special; | ||
736 | 799 | ||
737 | boot_delay_msec(); | 800 | boot_delay_msec(); |
738 | printk_delay(); | 801 | printk_delay(); |
@@ -773,45 +836,52 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
773 | printed_len += vscnprintf(printk_buf + printed_len, | 836 | printed_len += vscnprintf(printk_buf + printed_len, |
774 | sizeof(printk_buf) - printed_len, fmt, args); | 837 | sizeof(printk_buf) - printed_len, fmt, args); |
775 | 838 | ||
776 | |||
777 | p = printk_buf; | 839 | p = printk_buf; |
778 | 840 | ||
779 | /* Do we have a loglevel in the string? */ | 841 | /* Read log level and handle special printk prefix */ |
780 | if (p[0] == '<') { | 842 | plen = log_prefix(p, ¤t_log_level, &special); |
781 | unsigned char c = p[1]; | 843 | if (plen) { |
782 | if (c && p[2] == '>') { | 844 | p += plen; |
783 | switch (c) { | 845 | |
784 | case '0' ... '7': /* loglevel */ | 846 | switch (special) { |
785 | current_log_level = c - '0'; | 847 | case 'c': /* Strip <c> KERN_CONT, continue line */ |
786 | /* Fallthrough - make sure we're on a new line */ | 848 | plen = 0; |
787 | case 'd': /* KERN_DEFAULT */ | 849 | break; |
788 | if (!new_text_line) { | 850 | case 'd': /* Strip <d> KERN_DEFAULT, start new line */ |
789 | emit_log_char('\n'); | 851 | plen = 0; |
790 | new_text_line = 1; | 852 | default: |
791 | } | 853 | if (!new_text_line) { |
792 | /* Fallthrough - skip the loglevel */ | 854 | emit_log_char('\n'); |
793 | case 'c': /* KERN_CONT */ | 855 | new_text_line = 1; |
794 | p += 3; | ||
795 | break; | ||
796 | } | 856 | } |
797 | } | 857 | } |
798 | } | 858 | } |
799 | 859 | ||
800 | /* | 860 | /* |
801 | * Copy the output into log_buf. If the caller didn't provide | 861 | * Copy the output into log_buf. If the caller didn't provide |
802 | * appropriate log level tags, we insert them here | 862 | * the appropriate log prefix, we insert them here |
803 | */ | 863 | */ |
804 | for ( ; *p; p++) { | 864 | for (; *p; p++) { |
805 | if (new_text_line) { | 865 | if (new_text_line) { |
806 | /* Always output the token */ | ||
807 | emit_log_char('<'); | ||
808 | emit_log_char(current_log_level + '0'); | ||
809 | emit_log_char('>'); | ||
810 | printed_len += 3; | ||
811 | new_text_line = 0; | 866 | new_text_line = 0; |
812 | 867 | ||
868 | if (plen) { | ||
869 | /* Copy original log prefix */ | ||
870 | int i; | ||
871 | |||
872 | for (i = 0; i < plen; i++) | ||
873 | emit_log_char(printk_buf[i]); | ||
874 | printed_len += plen; | ||
875 | } else { | ||
876 | /* Add log prefix */ | ||
877 | emit_log_char('<'); | ||
878 | emit_log_char(current_log_level + '0'); | ||
879 | emit_log_char('>'); | ||
880 | printed_len += 3; | ||
881 | } | ||
882 | |||
813 | if (printk_time) { | 883 | if (printk_time) { |
814 | /* Follow the token with the time */ | 884 | /* Add the current time stamp */ |
815 | char tbuf[50], *tp; | 885 | char tbuf[50], *tp; |
816 | unsigned tlen; | 886 | unsigned tlen; |
817 | unsigned long long t; | 887 | unsigned long long t; |
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index a23a57a976d1..f3240e987928 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -214,11 +214,12 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state) | |||
214 | * Ensure that queued callbacks are all executed. | 214 | * Ensure that queued callbacks are all executed. |
215 | * If we detect that we are nested in a RCU read-side critical | 215 | * If we detect that we are nested in a RCU read-side critical |
216 | * section, we should simply fail, otherwise we would deadlock. | 216 | * section, we should simply fail, otherwise we would deadlock. |
217 | * Note that the machinery to reliably determine whether | ||
218 | * or not we are in an RCU read-side critical section | ||
219 | * exists only in the preemptible RCU implementations | ||
220 | * (TINY_PREEMPT_RCU and TREE_PREEMPT_RCU), which is why | ||
221 | * DEBUG_OBJECTS_RCU_HEAD is disallowed if !PREEMPT. | ||
217 | */ | 222 | */ |
218 | #ifndef CONFIG_PREEMPT | ||
219 | WARN_ON(1); | ||
220 | return 0; | ||
221 | #else | ||
222 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || | 223 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || |
223 | irqs_disabled()) { | 224 | irqs_disabled()) { |
224 | WARN_ON(1); | 225 | WARN_ON(1); |
@@ -229,7 +230,6 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state) | |||
229 | rcu_barrier_bh(); | 230 | rcu_barrier_bh(); |
230 | debug_object_free(head, &rcuhead_debug_descr); | 231 | debug_object_free(head, &rcuhead_debug_descr); |
231 | return 1; | 232 | return 1; |
232 | #endif | ||
233 | default: | 233 | default: |
234 | return 0; | 234 | return 0; |
235 | } | 235 | } |
diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h index 015abaea962a..3cb8e362e883 100644 --- a/kernel/rcutiny_plugin.h +++ b/kernel/rcutiny_plugin.h | |||
@@ -852,7 +852,7 @@ void exit_rcu(void) | |||
852 | if (t->rcu_read_lock_nesting == 0) | 852 | if (t->rcu_read_lock_nesting == 0) |
853 | return; | 853 | return; |
854 | t->rcu_read_lock_nesting = 1; | 854 | t->rcu_read_lock_nesting = 1; |
855 | rcu_read_unlock(); | 855 | __rcu_read_unlock(); |
856 | } | 856 | } |
857 | 857 | ||
858 | #else /* #ifdef CONFIG_TINY_PREEMPT_RCU */ | 858 | #else /* #ifdef CONFIG_TINY_PREEMPT_RCU */ |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 89613f97ff26..c224da41890c 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <linux/srcu.h> | 47 | #include <linux/srcu.h> |
48 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
49 | #include <asm/byteorder.h> | 49 | #include <asm/byteorder.h> |
50 | #include <linux/sched.h> | ||
51 | 50 | ||
52 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
53 | MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com> and " | 52 | MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com> and " |
diff --git a/kernel/sched.c b/kernel/sched.c index 58d66ea7d200..a172494a9a63 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/uaccess.h> | 33 | #include <linux/uaccess.h> |
34 | #include <linux/highmem.h> | 34 | #include <linux/highmem.h> |
35 | #include <linux/smp_lock.h> | ||
36 | #include <asm/mmu_context.h> | 35 | #include <asm/mmu_context.h> |
37 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
38 | #include <linux/capability.h> | 37 | #include <linux/capability.h> |
@@ -4086,9 +4085,6 @@ need_resched: | |||
4086 | rcu_note_context_switch(cpu); | 4085 | rcu_note_context_switch(cpu); |
4087 | prev = rq->curr; | 4086 | prev = rq->curr; |
4088 | 4087 | ||
4089 | release_kernel_lock(prev); | ||
4090 | need_resched_nonpreemptible: | ||
4091 | |||
4092 | schedule_debug(prev); | 4088 | schedule_debug(prev); |
4093 | 4089 | ||
4094 | if (sched_feat(HRTICK)) | 4090 | if (sched_feat(HRTICK)) |
@@ -4148,9 +4144,6 @@ need_resched_nonpreemptible: | |||
4148 | 4144 | ||
4149 | post_schedule(rq); | 4145 | post_schedule(rq); |
4150 | 4146 | ||
4151 | if (unlikely(reacquire_kernel_lock(prev))) | ||
4152 | goto need_resched_nonpreemptible; | ||
4153 | |||
4154 | preempt_enable_no_resched(); | 4147 | preempt_enable_no_resched(); |
4155 | if (need_resched()) | 4148 | if (need_resched()) |
4156 | goto need_resched; | 4149 | goto need_resched; |
@@ -8277,7 +8270,7 @@ static inline int preempt_count_equals(int preempt_offset) | |||
8277 | { | 8270 | { |
8278 | int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth(); | 8271 | int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth(); |
8279 | 8272 | ||
8280 | return (nested == PREEMPT_INATOMIC_BASE + preempt_offset); | 8273 | return (nested == preempt_offset); |
8281 | } | 8274 | } |
8282 | 8275 | ||
8283 | void __might_sleep(const char *file, int line, int preempt_offset) | 8276 | void __might_sleep(const char *file, int line, int preempt_offset) |
diff --git a/kernel/smp.c b/kernel/smp.c index 9910744f0856..7cbd0f293df4 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -194,7 +194,7 @@ void generic_smp_call_function_interrupt(void) | |||
194 | */ | 194 | */ |
195 | list_for_each_entry_rcu(data, &call_function.queue, csd.list) { | 195 | list_for_each_entry_rcu(data, &call_function.queue, csd.list) { |
196 | int refs; | 196 | int refs; |
197 | void (*func) (void *info); | 197 | smp_call_func_t func; |
198 | 198 | ||
199 | /* | 199 | /* |
200 | * Since we walk the list without any locks, we might | 200 | * Since we walk the list without any locks, we might |
@@ -214,17 +214,17 @@ void generic_smp_call_function_interrupt(void) | |||
214 | if (atomic_read(&data->refs) == 0) | 214 | if (atomic_read(&data->refs) == 0) |
215 | continue; | 215 | continue; |
216 | 216 | ||
217 | func = data->csd.func; /* for later warn */ | 217 | func = data->csd.func; /* save for later warn */ |
218 | data->csd.func(data->csd.info); | 218 | func(data->csd.info); |
219 | 219 | ||
220 | /* | 220 | /* |
221 | * If the cpu mask is not still set then it enabled interrupts, | 221 | * If the cpu mask is not still set then func enabled |
222 | * we took another smp interrupt, and executed the function | 222 | * interrupts (BUG), and this cpu took another smp call |
223 | * twice on this cpu. In theory that copy decremented refs. | 223 | * function interrupt and executed func(info) twice |
224 | * on this cpu. That nested execution decremented refs. | ||
224 | */ | 225 | */ |
225 | if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) { | 226 | if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) { |
226 | WARN(1, "%pS enabled interrupts and double executed\n", | 227 | WARN(1, "%pf enabled interrupts and double executed\n", func); |
227 | func); | ||
228 | continue; | 228 | continue; |
229 | } | 229 | } |
230 | 230 | ||
@@ -450,7 +450,7 @@ void smp_call_function_many(const struct cpumask *mask, | |||
450 | { | 450 | { |
451 | struct call_function_data *data; | 451 | struct call_function_data *data; |
452 | unsigned long flags; | 452 | unsigned long flags; |
453 | int cpu, next_cpu, this_cpu = smp_processor_id(); | 453 | int refs, cpu, next_cpu, this_cpu = smp_processor_id(); |
454 | 454 | ||
455 | /* | 455 | /* |
456 | * Can deadlock when called with interrupts disabled. | 456 | * Can deadlock when called with interrupts disabled. |
@@ -461,7 +461,7 @@ void smp_call_function_many(const struct cpumask *mask, | |||
461 | WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled() | 461 | WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled() |
462 | && !oops_in_progress && !early_boot_irqs_disabled); | 462 | && !oops_in_progress && !early_boot_irqs_disabled); |
463 | 463 | ||
464 | /* So, what's a CPU they want? Ignoring this one. */ | 464 | /* Try to fastpath. So, what's a CPU they want? Ignoring this one. */ |
465 | cpu = cpumask_first_and(mask, cpu_online_mask); | 465 | cpu = cpumask_first_and(mask, cpu_online_mask); |
466 | if (cpu == this_cpu) | 466 | if (cpu == this_cpu) |
467 | cpu = cpumask_next_and(cpu, mask, cpu_online_mask); | 467 | cpu = cpumask_next_and(cpu, mask, cpu_online_mask); |
@@ -483,22 +483,49 @@ void smp_call_function_many(const struct cpumask *mask, | |||
483 | 483 | ||
484 | data = &__get_cpu_var(cfd_data); | 484 | data = &__get_cpu_var(cfd_data); |
485 | csd_lock(&data->csd); | 485 | csd_lock(&data->csd); |
486 | |||
487 | /* This BUG_ON verifies our reuse assertions and can be removed */ | ||
486 | BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask)); | 488 | BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask)); |
487 | 489 | ||
490 | /* | ||
491 | * The global call function queue list add and delete are protected | ||
492 | * by a lock, but the list is traversed without any lock, relying | ||
493 | * on the rcu list add and delete to allow safe concurrent traversal. | ||
494 | * We reuse the call function data without waiting for any grace | ||
495 | * period after some other cpu removes it from the global queue. | ||
496 | * This means a cpu might find our data block as it is being | ||
497 | * filled out. | ||
498 | * | ||
499 | * We hold off the interrupt handler on the other cpu by | ||
500 | * ordering our writes to the cpu mask vs our setting of the | ||
501 | * refs counter. We assert only the cpu owning the data block | ||
502 | * will set a bit in cpumask, and each bit will only be cleared | ||
503 | * by the subject cpu. Each cpu must first find its bit is | ||
504 | * set and then check that refs is set indicating the element is | ||
505 | * ready to be processed, otherwise it must skip the entry. | ||
506 | * | ||
507 | * On the previous iteration refs was set to 0 by another cpu. | ||
508 | * To avoid the use of transitivity, set the counter to 0 here | ||
509 | * so the wmb will pair with the rmb in the interrupt handler. | ||
510 | */ | ||
511 | atomic_set(&data->refs, 0); /* convert 3rd to 1st party write */ | ||
512 | |||
488 | data->csd.func = func; | 513 | data->csd.func = func; |
489 | data->csd.info = info; | 514 | data->csd.info = info; |
490 | cpumask_and(data->cpumask, mask, cpu_online_mask); | ||
491 | cpumask_clear_cpu(this_cpu, data->cpumask); | ||
492 | 515 | ||
493 | /* | 516 | /* Ensure 0 refs is visible before mask. Also orders func and info */ |
494 | * To ensure the interrupt handler gets an complete view | ||
495 | * we order the cpumask and refs writes and order the read | ||
496 | * of them in the interrupt handler. In addition we may | ||
497 | * only clear our own cpu bit from the mask. | ||
498 | */ | ||
499 | smp_wmb(); | 517 | smp_wmb(); |
500 | 518 | ||
501 | atomic_set(&data->refs, cpumask_weight(data->cpumask)); | 519 | /* We rely on the "and" being processed before the store */ |
520 | cpumask_and(data->cpumask, mask, cpu_online_mask); | ||
521 | cpumask_clear_cpu(this_cpu, data->cpumask); | ||
522 | refs = cpumask_weight(data->cpumask); | ||
523 | |||
524 | /* Some callers race with other cpus changing the passed mask */ | ||
525 | if (unlikely(!refs)) { | ||
526 | csd_unlock(&data->csd); | ||
527 | return; | ||
528 | } | ||
502 | 529 | ||
503 | raw_spin_lock_irqsave(&call_function.lock, flags); | 530 | raw_spin_lock_irqsave(&call_function.lock, flags); |
504 | /* | 531 | /* |
@@ -507,6 +534,12 @@ void smp_call_function_many(const struct cpumask *mask, | |||
507 | * will not miss any other list entries: | 534 | * will not miss any other list entries: |
508 | */ | 535 | */ |
509 | list_add_rcu(&data->csd.list, &call_function.queue); | 536 | list_add_rcu(&data->csd.list, &call_function.queue); |
537 | /* | ||
538 | * We rely on the wmb() in list_add_rcu to complete our writes | ||
539 | * to the cpumask before this write to refs, which indicates | ||
540 | * data is on the list and is ready to be processed. | ||
541 | */ | ||
542 | atomic_set(&data->refs, refs); | ||
510 | raw_spin_unlock_irqrestore(&call_function.lock, flags); | 543 | raw_spin_unlock_irqrestore(&call_function.lock, flags); |
511 | 544 | ||
512 | /* | 545 | /* |
diff --git a/kernel/sys.c b/kernel/sys.c index 18da702ec813..1ad48b3b9068 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/ptrace.h> | 37 | #include <linux/ptrace.h> |
38 | #include <linux/fs_struct.h> | 38 | #include <linux/fs_struct.h> |
39 | #include <linux/gfp.h> | 39 | #include <linux/gfp.h> |
40 | #include <linux/syscore_ops.h> | ||
40 | 41 | ||
41 | #include <linux/compat.h> | 42 | #include <linux/compat.h> |
42 | #include <linux/syscalls.h> | 43 | #include <linux/syscalls.h> |
@@ -298,6 +299,7 @@ void kernel_restart_prepare(char *cmd) | |||
298 | system_state = SYSTEM_RESTART; | 299 | system_state = SYSTEM_RESTART; |
299 | device_shutdown(); | 300 | device_shutdown(); |
300 | sysdev_shutdown(); | 301 | sysdev_shutdown(); |
302 | syscore_shutdown(); | ||
301 | } | 303 | } |
302 | 304 | ||
303 | /** | 305 | /** |
@@ -336,6 +338,7 @@ void kernel_halt(void) | |||
336 | { | 338 | { |
337 | kernel_shutdown_prepare(SYSTEM_HALT); | 339 | kernel_shutdown_prepare(SYSTEM_HALT); |
338 | sysdev_shutdown(); | 340 | sysdev_shutdown(); |
341 | syscore_shutdown(); | ||
339 | printk(KERN_EMERG "System halted.\n"); | 342 | printk(KERN_EMERG "System halted.\n"); |
340 | kmsg_dump(KMSG_DUMP_HALT); | 343 | kmsg_dump(KMSG_DUMP_HALT); |
341 | machine_halt(); | 344 | machine_halt(); |
@@ -355,6 +358,7 @@ void kernel_power_off(void) | |||
355 | pm_power_off_prepare(); | 358 | pm_power_off_prepare(); |
356 | disable_nonboot_cpus(); | 359 | disable_nonboot_cpus(); |
357 | sysdev_shutdown(); | 360 | sysdev_shutdown(); |
361 | syscore_shutdown(); | ||
358 | printk(KERN_EMERG "Power down.\n"); | 362 | printk(KERN_EMERG "Power down.\n"); |
359 | kmsg_dump(KMSG_DUMP_POWEROFF); | 363 | kmsg_dump(KMSG_DUMP_POWEROFF); |
360 | machine_power_off(); | 364 | machine_power_off(); |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 51054fea5d99..40245d697602 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -1683,13 +1683,8 @@ static int test_perm(int mode, int op) | |||
1683 | 1683 | ||
1684 | int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) | 1684 | int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) |
1685 | { | 1685 | { |
1686 | int error; | ||
1687 | int mode; | 1686 | int mode; |
1688 | 1687 | ||
1689 | error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC)); | ||
1690 | if (error) | ||
1691 | return error; | ||
1692 | |||
1693 | if (root->permissions) | 1688 | if (root->permissions) |
1694 | mode = root->permissions(root, current->nsproxy, table); | 1689 | mode = root->permissions(root, current->nsproxy, table); |
1695 | else | 1690 | else |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 14674dce77a6..61d7d59f4a1a 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -275,7 +275,7 @@ config PROFILE_ANNOTATED_BRANCHES | |||
275 | This tracer profiles all the the likely and unlikely macros | 275 | This tracer profiles all the the likely and unlikely macros |
276 | in the kernel. It will display the results in: | 276 | in the kernel. It will display the results in: |
277 | 277 | ||
278 | /sys/kernel/debug/tracing/profile_annotated_branch | 278 | /sys/kernel/debug/tracing/trace_stat/branch_annotated |
279 | 279 | ||
280 | Note: this will add a significant overhead; only turn this | 280 | Note: this will add a significant overhead; only turn this |
281 | on if you need to profile the system's use of these macros. | 281 | on if you need to profile the system's use of these macros. |
@@ -288,7 +288,7 @@ config PROFILE_ALL_BRANCHES | |||
288 | taken in the kernel is recorded whether it hit or miss. | 288 | taken in the kernel is recorded whether it hit or miss. |
289 | The results will be displayed in: | 289 | The results will be displayed in: |
290 | 290 | ||
291 | /sys/kernel/debug/tracing/profile_branch | 291 | /sys/kernel/debug/tracing/trace_stat/branch_all |
292 | 292 | ||
293 | This option also enables the likely/unlikely profiler. | 293 | This option also enables the likely/unlikely profiler. |
294 | 294 | ||
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index db7b439d23ee..d9c8bcafb120 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -668,7 +668,7 @@ static struct list_head *rb_list_head(struct list_head *list) | |||
668 | * the reader page). But if the next page is a header page, | 668 | * the reader page). But if the next page is a header page, |
669 | * its flags will be non zero. | 669 | * its flags will be non zero. |
670 | */ | 670 | */ |
671 | static int inline | 671 | static inline int |
672 | rb_is_head_page(struct ring_buffer_per_cpu *cpu_buffer, | 672 | rb_is_head_page(struct ring_buffer_per_cpu *cpu_buffer, |
673 | struct buffer_page *page, struct list_head *list) | 673 | struct buffer_page *page, struct list_head *list) |
674 | { | 674 | { |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 3249b4f77ef0..8008ddcfbf20 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
@@ -391,8 +391,8 @@ static int process_ops(struct filter_pred *preds, | |||
391 | struct filter_pred *op, void *rec) | 391 | struct filter_pred *op, void *rec) |
392 | { | 392 | { |
393 | struct filter_pred *pred; | 393 | struct filter_pred *pred; |
394 | int match = 0; | ||
394 | int type; | 395 | int type; |
395 | int match; | ||
396 | int i; | 396 | int i; |
397 | 397 | ||
398 | /* | 398 | /* |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index b5fe4c00eb3c..5ca7ce9ce754 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -251,10 +251,12 @@ struct workqueue_struct *system_wq __read_mostly; | |||
251 | struct workqueue_struct *system_long_wq __read_mostly; | 251 | struct workqueue_struct *system_long_wq __read_mostly; |
252 | struct workqueue_struct *system_nrt_wq __read_mostly; | 252 | struct workqueue_struct *system_nrt_wq __read_mostly; |
253 | struct workqueue_struct *system_unbound_wq __read_mostly; | 253 | struct workqueue_struct *system_unbound_wq __read_mostly; |
254 | struct workqueue_struct *system_freezable_wq __read_mostly; | ||
254 | EXPORT_SYMBOL_GPL(system_wq); | 255 | EXPORT_SYMBOL_GPL(system_wq); |
255 | EXPORT_SYMBOL_GPL(system_long_wq); | 256 | EXPORT_SYMBOL_GPL(system_long_wq); |
256 | EXPORT_SYMBOL_GPL(system_nrt_wq); | 257 | EXPORT_SYMBOL_GPL(system_nrt_wq); |
257 | EXPORT_SYMBOL_GPL(system_unbound_wq); | 258 | EXPORT_SYMBOL_GPL(system_unbound_wq); |
259 | EXPORT_SYMBOL_GPL(system_freezable_wq); | ||
258 | 260 | ||
259 | #define CREATE_TRACE_POINTS | 261 | #define CREATE_TRACE_POINTS |
260 | #include <trace/events/workqueue.h> | 262 | #include <trace/events/workqueue.h> |
@@ -3781,8 +3783,10 @@ static int __init init_workqueues(void) | |||
3781 | system_nrt_wq = alloc_workqueue("events_nrt", WQ_NON_REENTRANT, 0); | 3783 | system_nrt_wq = alloc_workqueue("events_nrt", WQ_NON_REENTRANT, 0); |
3782 | system_unbound_wq = alloc_workqueue("events_unbound", WQ_UNBOUND, | 3784 | system_unbound_wq = alloc_workqueue("events_unbound", WQ_UNBOUND, |
3783 | WQ_UNBOUND_MAX_ACTIVE); | 3785 | WQ_UNBOUND_MAX_ACTIVE); |
3786 | system_freezable_wq = alloc_workqueue("events_freezable", | ||
3787 | WQ_FREEZABLE, 0); | ||
3784 | BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq || | 3788 | BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq || |
3785 | !system_unbound_wq); | 3789 | !system_unbound_wq || !system_freezable_wq); |
3786 | return 0; | 3790 | return 0; |
3787 | } | 3791 | } |
3788 | early_initcall(init_workqueues); | 3792 | early_initcall(init_workqueues); |