diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/auditsc.c | 24 | ||||
-rw-r--r-- | kernel/cpu.c | 32 | ||||
-rw-r--r-- | kernel/exit.c | 2 | ||||
-rw-r--r-- | kernel/fork.c | 2 | ||||
-rw-r--r-- | kernel/futex.c | 2 | ||||
-rw-r--r-- | kernel/hrtimer.c | 30 | ||||
-rw-r--r-- | kernel/irq/devres.c | 2 | ||||
-rw-r--r-- | kernel/lockdep.c | 8 | ||||
-rw-r--r-- | kernel/module.c | 24 | ||||
-rw-r--r-- | kernel/power/console.c | 10 | ||||
-rw-r--r-- | kernel/power/disk.c | 7 | ||||
-rw-r--r-- | kernel/power/swsusp.c | 2 | ||||
-rw-r--r-- | kernel/power/user.c | 9 | ||||
-rw-r--r-- | kernel/sched.c | 36 | ||||
-rw-r--r-- | kernel/sysctl.c | 3 | ||||
-rw-r--r-- | kernel/time.c | 2 | ||||
-rw-r--r-- | kernel/time/clockevents.c | 69 | ||||
-rw-r--r-- | kernel/time/clocksource.c | 3 | ||||
-rw-r--r-- | kernel/time/jiffies.c | 2 | ||||
-rw-r--r-- | kernel/time/ntp.c | 30 | ||||
-rw-r--r-- | kernel/time/tick-broadcast.c | 27 | ||||
-rw-r--r-- | kernel/time/tick-common.c | 13 | ||||
-rw-r--r-- | kernel/time/tick-internal.h | 11 | ||||
-rw-r--r-- | kernel/time/tick-oneshot.c | 12 | ||||
-rw-r--r-- | kernel/time/timer_list.c | 6 | ||||
-rw-r--r-- | kernel/timer.c | 21 |
26 files changed, 192 insertions, 197 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 359955800dd2..628c7ac590a0 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -739,28 +739,26 @@ static inline void audit_free_context(struct audit_context *context) | |||
739 | void audit_log_task_context(struct audit_buffer *ab) | 739 | void audit_log_task_context(struct audit_buffer *ab) |
740 | { | 740 | { |
741 | char *ctx = NULL; | 741 | char *ctx = NULL; |
742 | ssize_t len = 0; | 742 | unsigned len; |
743 | int error; | ||
744 | u32 sid; | ||
745 | |||
746 | selinux_get_task_sid(current, &sid); | ||
747 | if (!sid) | ||
748 | return; | ||
743 | 749 | ||
744 | len = security_getprocattr(current, "current", NULL, 0); | 750 | error = selinux_sid_to_string(sid, &ctx, &len); |
745 | if (len < 0) { | 751 | if (error) { |
746 | if (len != -EINVAL) | 752 | if (error != -EINVAL) |
747 | goto error_path; | 753 | goto error_path; |
748 | return; | 754 | return; |
749 | } | 755 | } |
750 | 756 | ||
751 | ctx = kmalloc(len, GFP_KERNEL); | ||
752 | if (!ctx) | ||
753 | goto error_path; | ||
754 | |||
755 | len = security_getprocattr(current, "current", ctx, len); | ||
756 | if (len < 0 ) | ||
757 | goto error_path; | ||
758 | |||
759 | audit_log_format(ab, " subj=%s", ctx); | 757 | audit_log_format(ab, " subj=%s", ctx); |
758 | kfree(ctx); | ||
760 | return; | 759 | return; |
761 | 760 | ||
762 | error_path: | 761 | error_path: |
763 | kfree(ctx); | ||
764 | audit_panic("error in audit_log_task_context"); | 762 | audit_panic("error in audit_log_task_context"); |
765 | return; | 763 | return; |
766 | } | 764 | } |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 3d4206ada5c9..36e70845cfc3 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -254,6 +254,12 @@ int __cpuinit cpu_up(unsigned int cpu) | |||
254 | } | 254 | } |
255 | 255 | ||
256 | #ifdef CONFIG_SUSPEND_SMP | 256 | #ifdef CONFIG_SUSPEND_SMP |
257 | /* Needed to prevent the microcode driver from requesting firmware in its CPU | ||
258 | * hotplug notifier during the suspend/resume. | ||
259 | */ | ||
260 | int suspend_cpu_hotplug; | ||
261 | EXPORT_SYMBOL(suspend_cpu_hotplug); | ||
262 | |||
257 | static cpumask_t frozen_cpus; | 263 | static cpumask_t frozen_cpus; |
258 | 264 | ||
259 | int disable_nonboot_cpus(void) | 265 | int disable_nonboot_cpus(void) |
@@ -261,16 +267,8 @@ int disable_nonboot_cpus(void) | |||
261 | int cpu, first_cpu, error = 0; | 267 | int cpu, first_cpu, error = 0; |
262 | 268 | ||
263 | mutex_lock(&cpu_add_remove_lock); | 269 | mutex_lock(&cpu_add_remove_lock); |
264 | first_cpu = first_cpu(cpu_present_map); | 270 | suspend_cpu_hotplug = 1; |
265 | if (!cpu_online(first_cpu)) { | 271 | first_cpu = first_cpu(cpu_online_map); |
266 | error = _cpu_up(first_cpu); | ||
267 | if (error) { | ||
268 | printk(KERN_ERR "Could not bring CPU%d up.\n", | ||
269 | first_cpu); | ||
270 | goto out; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /* We take down all of the non-boot CPUs in one shot to avoid races | 272 | /* We take down all of the non-boot CPUs in one shot to avoid races |
275 | * with the userspace trying to use the CPU hotplug at the same time | 273 | * with the userspace trying to use the CPU hotplug at the same time |
276 | */ | 274 | */ |
@@ -296,7 +294,7 @@ int disable_nonboot_cpus(void) | |||
296 | } else { | 294 | } else { |
297 | printk(KERN_ERR "Non-boot CPUs are not disabled\n"); | 295 | printk(KERN_ERR "Non-boot CPUs are not disabled\n"); |
298 | } | 296 | } |
299 | out: | 297 | suspend_cpu_hotplug = 0; |
300 | mutex_unlock(&cpu_add_remove_lock); | 298 | mutex_unlock(&cpu_add_remove_lock); |
301 | return error; | 299 | return error; |
302 | } | 300 | } |
@@ -308,20 +306,22 @@ void enable_nonboot_cpus(void) | |||
308 | /* Allow everyone to use the CPU hotplug again */ | 306 | /* Allow everyone to use the CPU hotplug again */ |
309 | mutex_lock(&cpu_add_remove_lock); | 307 | mutex_lock(&cpu_add_remove_lock); |
310 | cpu_hotplug_disabled = 0; | 308 | cpu_hotplug_disabled = 0; |
311 | mutex_unlock(&cpu_add_remove_lock); | ||
312 | if (cpus_empty(frozen_cpus)) | 309 | if (cpus_empty(frozen_cpus)) |
313 | return; | 310 | goto out; |
314 | 311 | ||
312 | suspend_cpu_hotplug = 1; | ||
315 | printk("Enabling non-boot CPUs ...\n"); | 313 | printk("Enabling non-boot CPUs ...\n"); |
316 | for_each_cpu_mask(cpu, frozen_cpus) { | 314 | for_each_cpu_mask(cpu, frozen_cpus) { |
317 | error = cpu_up(cpu); | 315 | error = _cpu_up(cpu); |
318 | if (!error) { | 316 | if (!error) { |
319 | printk("CPU%d is up\n", cpu); | 317 | printk("CPU%d is up\n", cpu); |
320 | continue; | 318 | continue; |
321 | } | 319 | } |
322 | printk(KERN_WARNING "Error taking CPU%d up: %d\n", | 320 | printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error); |
323 | cpu, error); | ||
324 | } | 321 | } |
325 | cpus_clear(frozen_cpus); | 322 | cpus_clear(frozen_cpus); |
323 | suspend_cpu_hotplug = 0; | ||
324 | out: | ||
325 | mutex_unlock(&cpu_add_remove_lock); | ||
326 | } | 326 | } |
327 | #endif | 327 | #endif |
diff --git a/kernel/exit.c b/kernel/exit.c index f132349c0325..b55ed4cc9104 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -790,7 +790,7 @@ static void exit_notify(struct task_struct *tsk) | |||
790 | 790 | ||
791 | pgrp = task_pgrp(tsk); | 791 | pgrp = task_pgrp(tsk); |
792 | if ((task_pgrp(t) != pgrp) && | 792 | if ((task_pgrp(t) != pgrp) && |
793 | (task_session(t) != task_session(tsk)) && | 793 | (task_session(t) == task_session(tsk)) && |
794 | will_become_orphaned_pgrp(pgrp, tsk) && | 794 | will_become_orphaned_pgrp(pgrp, tsk) && |
795 | has_stopped_jobs(pgrp)) { | 795 | has_stopped_jobs(pgrp)) { |
796 | __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); | 796 | __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); |
diff --git a/kernel/fork.c b/kernel/fork.c index d154cc786489..6af959c034d8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -933,8 +933,8 @@ asmlinkage long sys_set_tid_address(int __user *tidptr) | |||
933 | 933 | ||
934 | static inline void rt_mutex_init_task(struct task_struct *p) | 934 | static inline void rt_mutex_init_task(struct task_struct *p) |
935 | { | 935 | { |
936 | #ifdef CONFIG_RT_MUTEXES | ||
937 | spin_lock_init(&p->pi_lock); | 936 | spin_lock_init(&p->pi_lock); |
937 | #ifdef CONFIG_RT_MUTEXES | ||
938 | plist_head_init(&p->pi_waiters, &p->pi_lock); | 938 | plist_head_init(&p->pi_waiters, &p->pi_lock); |
939 | p->pi_blocked_on = NULL; | 939 | p->pi_blocked_on = NULL; |
940 | #endif | 940 | #endif |
diff --git a/kernel/futex.c b/kernel/futex.c index e749e7df14b1..5a270b5e3f95 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -565,6 +565,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this) | |||
565 | if (!pi_state) | 565 | if (!pi_state) |
566 | return -EINVAL; | 566 | return -EINVAL; |
567 | 567 | ||
568 | spin_lock(&pi_state->pi_mutex.wait_lock); | ||
568 | new_owner = rt_mutex_next_owner(&pi_state->pi_mutex); | 569 | new_owner = rt_mutex_next_owner(&pi_state->pi_mutex); |
569 | 570 | ||
570 | /* | 571 | /* |
@@ -604,6 +605,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this) | |||
604 | pi_state->owner = new_owner; | 605 | pi_state->owner = new_owner; |
605 | spin_unlock_irq(&new_owner->pi_lock); | 606 | spin_unlock_irq(&new_owner->pi_lock); |
606 | 607 | ||
608 | spin_unlock(&pi_state->pi_mutex.wait_lock); | ||
607 | rt_mutex_unlock(&pi_state->pi_mutex); | 609 | rt_mutex_unlock(&pi_state->pi_mutex); |
608 | 610 | ||
609 | return 0; | 611 | return 0; |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index ec4cb9f3e3b7..b74860aaf5f1 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -135,7 +135,7 @@ EXPORT_SYMBOL_GPL(ktime_get_ts); | |||
135 | static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | 135 | static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) |
136 | { | 136 | { |
137 | ktime_t xtim, tomono; | 137 | ktime_t xtim, tomono; |
138 | struct timespec xts; | 138 | struct timespec xts, tom; |
139 | unsigned long seq; | 139 | unsigned long seq; |
140 | 140 | ||
141 | do { | 141 | do { |
@@ -145,10 +145,11 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | |||
145 | #else | 145 | #else |
146 | xts = xtime; | 146 | xts = xtime; |
147 | #endif | 147 | #endif |
148 | tom = wall_to_monotonic; | ||
148 | } while (read_seqretry(&xtime_lock, seq)); | 149 | } while (read_seqretry(&xtime_lock, seq)); |
149 | 150 | ||
150 | xtim = timespec_to_ktime(xts); | 151 | xtim = timespec_to_ktime(xts); |
151 | tomono = timespec_to_ktime(wall_to_monotonic); | 152 | tomono = timespec_to_ktime(tom); |
152 | base->clock_base[CLOCK_REALTIME].softirq_time = xtim; | 153 | base->clock_base[CLOCK_REALTIME].softirq_time = xtim; |
153 | base->clock_base[CLOCK_MONOTONIC].softirq_time = | 154 | base->clock_base[CLOCK_MONOTONIC].softirq_time = |
154 | ktime_add(xtim, tomono); | 155 | ktime_add(xtim, tomono); |
@@ -458,6 +459,18 @@ void clock_was_set(void) | |||
458 | } | 459 | } |
459 | 460 | ||
460 | /* | 461 | /* |
462 | * During resume we might have to reprogram the high resolution timer | ||
463 | * interrupt (on the local CPU): | ||
464 | */ | ||
465 | void hres_timers_resume(void) | ||
466 | { | ||
467 | WARN_ON_ONCE(num_online_cpus() > 1); | ||
468 | |||
469 | /* Retrigger the CPU local events: */ | ||
470 | retrigger_next_event(NULL); | ||
471 | } | ||
472 | |||
473 | /* | ||
461 | * Check, whether the timer is on the callback pending list | 474 | * Check, whether the timer is on the callback pending list |
462 | */ | 475 | */ |
463 | static inline int hrtimer_cb_pending(const struct hrtimer *timer) | 476 | static inline int hrtimer_cb_pending(const struct hrtimer *timer) |
@@ -644,6 +657,12 @@ hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) | |||
644 | orun++; | 657 | orun++; |
645 | } | 658 | } |
646 | timer->expires = ktime_add(timer->expires, interval); | 659 | timer->expires = ktime_add(timer->expires, interval); |
660 | /* | ||
661 | * Make sure, that the result did not wrap with a very large | ||
662 | * interval. | ||
663 | */ | ||
664 | if (timer->expires.tv64 < 0) | ||
665 | timer->expires = ktime_set(KTIME_SEC_MAX, 0); | ||
647 | 666 | ||
648 | return orun; | 667 | return orun; |
649 | } | 668 | } |
@@ -807,7 +826,12 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode) | |||
807 | 826 | ||
808 | timer_stats_hrtimer_set_start_info(timer); | 827 | timer_stats_hrtimer_set_start_info(timer); |
809 | 828 | ||
810 | enqueue_hrtimer(timer, new_base, base == new_base); | 829 | /* |
830 | * Only allow reprogramming if the new base is on this CPU. | ||
831 | * (it might still be on another CPU if the timer was pending) | ||
832 | */ | ||
833 | enqueue_hrtimer(timer, new_base, | ||
834 | new_base->cpu_base == &__get_cpu_var(hrtimer_bases)); | ||
811 | 835 | ||
812 | unlock_hrtimer_base(timer, &flags); | 836 | unlock_hrtimer_base(timer, &flags); |
813 | 837 | ||
diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c index 85a430da0fb6..d8ee241115f5 100644 --- a/kernel/irq/devres.c +++ b/kernel/irq/devres.c | |||
@@ -54,7 +54,7 @@ int devm_request_irq(struct device *dev, unsigned int irq, | |||
54 | 54 | ||
55 | rc = request_irq(irq, handler, irqflags, devname, dev_id); | 55 | rc = request_irq(irq, handler, irqflags, devname, dev_id); |
56 | if (rc) { | 56 | if (rc) { |
57 | kfree(dr); | 57 | devres_free(dr); |
58 | return rc; | 58 | return rc; |
59 | } | 59 | } |
60 | 60 | ||
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 8dc24c92dc6d..7065a687ac54 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -2742,6 +2742,10 @@ void debug_show_all_locks(void) | |||
2742 | int count = 10; | 2742 | int count = 10; |
2743 | int unlock = 1; | 2743 | int unlock = 1; |
2744 | 2744 | ||
2745 | if (unlikely(!debug_locks)) { | ||
2746 | printk("INFO: lockdep is turned off.\n"); | ||
2747 | return; | ||
2748 | } | ||
2745 | printk("\nShowing all locks held in the system:\n"); | 2749 | printk("\nShowing all locks held in the system:\n"); |
2746 | 2750 | ||
2747 | /* | 2751 | /* |
@@ -2785,6 +2789,10 @@ EXPORT_SYMBOL_GPL(debug_show_all_locks); | |||
2785 | 2789 | ||
2786 | void debug_show_held_locks(struct task_struct *task) | 2790 | void debug_show_held_locks(struct task_struct *task) |
2787 | { | 2791 | { |
2792 | if (unlikely(!debug_locks)) { | ||
2793 | printk("INFO: lockdep is turned off.\n"); | ||
2794 | return; | ||
2795 | } | ||
2788 | lockdep_print_held_locks(task); | 2796 | lockdep_print_held_locks(task); |
2789 | } | 2797 | } |
2790 | 2798 | ||
diff --git a/kernel/module.c b/kernel/module.c index f77e893e4620..dcdb32b8b13c 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2384,8 +2384,13 @@ void module_add_driver(struct module *mod, struct device_driver *drv) | |||
2384 | 2384 | ||
2385 | /* Lookup built-in module entry in /sys/modules */ | 2385 | /* Lookup built-in module entry in /sys/modules */ |
2386 | mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); | 2386 | mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); |
2387 | if (mkobj) | 2387 | if (mkobj) { |
2388 | mk = container_of(mkobj, struct module_kobject, kobj); | 2388 | mk = container_of(mkobj, struct module_kobject, kobj); |
2389 | /* remember our module structure */ | ||
2390 | drv->mkobj = mk; | ||
2391 | /* kset_find_obj took a reference */ | ||
2392 | kobject_put(mkobj); | ||
2393 | } | ||
2389 | } | 2394 | } |
2390 | 2395 | ||
2391 | if (!mk) | 2396 | if (!mk) |
@@ -2405,26 +2410,25 @@ EXPORT_SYMBOL(module_add_driver); | |||
2405 | 2410 | ||
2406 | void module_remove_driver(struct device_driver *drv) | 2411 | void module_remove_driver(struct device_driver *drv) |
2407 | { | 2412 | { |
2413 | struct module_kobject *mk = NULL; | ||
2408 | char *driver_name; | 2414 | char *driver_name; |
2409 | 2415 | ||
2410 | if (!drv) | 2416 | if (!drv) |
2411 | return; | 2417 | return; |
2412 | 2418 | ||
2413 | sysfs_remove_link(&drv->kobj, "module"); | 2419 | sysfs_remove_link(&drv->kobj, "module"); |
2414 | if (drv->owner && drv->owner->mkobj.drivers_dir) { | 2420 | |
2421 | if (drv->owner) | ||
2422 | mk = &drv->owner->mkobj; | ||
2423 | else if (drv->mkobj) | ||
2424 | mk = drv->mkobj; | ||
2425 | if (mk && mk->drivers_dir) { | ||
2415 | driver_name = make_driver_name(drv); | 2426 | driver_name = make_driver_name(drv); |
2416 | if (driver_name) { | 2427 | if (driver_name) { |
2417 | sysfs_remove_link(drv->owner->mkobj.drivers_dir, | 2428 | sysfs_remove_link(mk->drivers_dir, driver_name); |
2418 | driver_name); | ||
2419 | kfree(driver_name); | 2429 | kfree(driver_name); |
2420 | } | 2430 | } |
2421 | } | 2431 | } |
2422 | /* | ||
2423 | * Undo the additional reference we added in module_add_driver() | ||
2424 | * via kset_find_obj() | ||
2425 | */ | ||
2426 | if (drv->mod_name) | ||
2427 | kobject_put(&drv->kobj); | ||
2428 | } | 2432 | } |
2429 | EXPORT_SYMBOL(module_remove_driver); | 2433 | EXPORT_SYMBOL(module_remove_driver); |
2430 | #endif | 2434 | #endif |
diff --git a/kernel/power/console.c b/kernel/power/console.c index 623786d44159..89bcf4973ee5 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c | |||
@@ -27,7 +27,15 @@ int pm_prepare_console(void) | |||
27 | return 1; | 27 | return 1; |
28 | } | 28 | } |
29 | 29 | ||
30 | set_console(SUSPEND_CONSOLE); | 30 | if (set_console(SUSPEND_CONSOLE)) { |
31 | /* | ||
32 | * We're unable to switch to the SUSPEND_CONSOLE. | ||
33 | * Let the calling function know so it can decide | ||
34 | * what to do. | ||
35 | */ | ||
36 | release_console_sem(); | ||
37 | return 1; | ||
38 | } | ||
31 | release_console_sem(); | 39 | release_console_sem(); |
32 | 40 | ||
33 | if (vt_waitactive(SUSPEND_CONSOLE)) { | 41 | if (vt_waitactive(SUSPEND_CONSOLE)) { |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 406b20adb27a..aec19b063e3f 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -240,12 +240,6 @@ static int software_resume(void) | |||
240 | goto Done; | 240 | goto Done; |
241 | } | 241 | } |
242 | 242 | ||
243 | error = platform_prepare(); | ||
244 | if (error) { | ||
245 | swsusp_free(); | ||
246 | goto Thaw; | ||
247 | } | ||
248 | |||
249 | pr_debug("PM: Reading swsusp image.\n"); | 243 | pr_debug("PM: Reading swsusp image.\n"); |
250 | 244 | ||
251 | error = swsusp_read(); | 245 | error = swsusp_read(); |
@@ -268,7 +262,6 @@ static int software_resume(void) | |||
268 | enable_nonboot_cpus(); | 262 | enable_nonboot_cpus(); |
269 | Free: | 263 | Free: |
270 | swsusp_free(); | 264 | swsusp_free(); |
271 | platform_finish(); | ||
272 | device_resume(); | 265 | device_resume(); |
273 | resume_console(); | 266 | resume_console(); |
274 | Thaw: | 267 | Thaw: |
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 7fb834397a0d..175370824f37 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -229,13 +229,13 @@ int swsusp_shrink_memory(void) | |||
229 | size += highmem_size; | 229 | size += highmem_size; |
230 | for_each_zone (zone) | 230 | for_each_zone (zone) |
231 | if (populated_zone(zone)) { | 231 | if (populated_zone(zone)) { |
232 | tmp += snapshot_additional_pages(zone); | ||
232 | if (is_highmem(zone)) { | 233 | if (is_highmem(zone)) { |
233 | highmem_size -= | 234 | highmem_size -= |
234 | zone_page_state(zone, NR_FREE_PAGES); | 235 | zone_page_state(zone, NR_FREE_PAGES); |
235 | } else { | 236 | } else { |
236 | tmp -= zone_page_state(zone, NR_FREE_PAGES); | 237 | tmp -= zone_page_state(zone, NR_FREE_PAGES); |
237 | tmp += zone->lowmem_reserve[ZONE_NORMAL]; | 238 | tmp += zone->lowmem_reserve[ZONE_NORMAL]; |
238 | tmp += snapshot_additional_pages(zone); | ||
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
diff --git a/kernel/power/user.c b/kernel/power/user.c index dd09efe7df54..7cf6713b2325 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -368,9 +368,12 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
368 | if (error) { | 368 | if (error) { |
369 | printk(KERN_ERR "Failed to suspend some devices.\n"); | 369 | printk(KERN_ERR "Failed to suspend some devices.\n"); |
370 | } else { | 370 | } else { |
371 | /* Enter S3, system is already frozen */ | 371 | error = disable_nonboot_cpus(); |
372 | suspend_enter(PM_SUSPEND_MEM); | 372 | if (!error) { |
373 | 373 | /* Enter S3, system is already frozen */ | |
374 | suspend_enter(PM_SUSPEND_MEM); | ||
375 | enable_nonboot_cpus(); | ||
376 | } | ||
374 | /* Wake up devices */ | 377 | /* Wake up devices */ |
375 | device_resume(); | 378 | device_resume(); |
376 | } | 379 | } |
diff --git a/kernel/sched.c b/kernel/sched.c index a4ca632c477c..b9a683730148 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4687,32 +4687,10 @@ out_unlock: | |||
4687 | return retval; | 4687 | return retval; |
4688 | } | 4688 | } |
4689 | 4689 | ||
4690 | static inline struct task_struct *eldest_child(struct task_struct *p) | ||
4691 | { | ||
4692 | if (list_empty(&p->children)) | ||
4693 | return NULL; | ||
4694 | return list_entry(p->children.next,struct task_struct,sibling); | ||
4695 | } | ||
4696 | |||
4697 | static inline struct task_struct *older_sibling(struct task_struct *p) | ||
4698 | { | ||
4699 | if (p->sibling.prev==&p->parent->children) | ||
4700 | return NULL; | ||
4701 | return list_entry(p->sibling.prev,struct task_struct,sibling); | ||
4702 | } | ||
4703 | |||
4704 | static inline struct task_struct *younger_sibling(struct task_struct *p) | ||
4705 | { | ||
4706 | if (p->sibling.next==&p->parent->children) | ||
4707 | return NULL; | ||
4708 | return list_entry(p->sibling.next,struct task_struct,sibling); | ||
4709 | } | ||
4710 | |||
4711 | static const char stat_nam[] = "RSDTtZX"; | 4690 | static const char stat_nam[] = "RSDTtZX"; |
4712 | 4691 | ||
4713 | static void show_task(struct task_struct *p) | 4692 | static void show_task(struct task_struct *p) |
4714 | { | 4693 | { |
4715 | struct task_struct *relative; | ||
4716 | unsigned long free = 0; | 4694 | unsigned long free = 0; |
4717 | unsigned state; | 4695 | unsigned state; |
4718 | 4696 | ||
@@ -4738,19 +4716,7 @@ static void show_task(struct task_struct *p) | |||
4738 | free = (unsigned long)n - (unsigned long)end_of_stack(p); | 4716 | free = (unsigned long)n - (unsigned long)end_of_stack(p); |
4739 | } | 4717 | } |
4740 | #endif | 4718 | #endif |
4741 | printk("%5lu %5d %6d ", free, p->pid, p->parent->pid); | 4719 | printk("%5lu %5d %6d", free, p->pid, p->parent->pid); |
4742 | if ((relative = eldest_child(p))) | ||
4743 | printk("%5d ", relative->pid); | ||
4744 | else | ||
4745 | printk(" "); | ||
4746 | if ((relative = younger_sibling(p))) | ||
4747 | printk("%7d", relative->pid); | ||
4748 | else | ||
4749 | printk(" "); | ||
4750 | if ((relative = older_sibling(p))) | ||
4751 | printk(" %5d", relative->pid); | ||
4752 | else | ||
4753 | printk(" "); | ||
4754 | if (!p->mm) | 4720 | if (!p->mm) |
4755 | printk(" (L-TLB)\n"); | 4721 | printk(" (L-TLB)\n"); |
4756 | else | 4722 | else |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 34b2301276ce..1b255df4fcd0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -846,7 +846,8 @@ static ctl_table vm_table[] = { | |||
846 | .extra2 = &one_hundred, | 846 | .extra2 = &one_hundred, |
847 | }, | 847 | }, |
848 | #endif | 848 | #endif |
849 | #ifdef CONFIG_X86_32 | 849 | #if defined(CONFIG_X86_32) || \ |
850 | (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) | ||
850 | { | 851 | { |
851 | .ctl_name = VM_VDSO_ENABLED, | 852 | .ctl_name = VM_VDSO_ENABLED, |
852 | .procname = "vdso_enabled", | 853 | .procname = "vdso_enabled", |
diff --git a/kernel/time.c b/kernel/time.c index c6c80ea5d0ea..2f47888e46c9 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -635,6 +635,7 @@ timeval_to_jiffies(const struct timeval *value) | |||
635 | (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> | 635 | (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> |
636 | (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | 636 | (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; |
637 | } | 637 | } |
638 | EXPORT_SYMBOL(timeval_to_jiffies); | ||
638 | 639 | ||
639 | void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) | 640 | void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) |
640 | { | 641 | { |
@@ -649,6 +650,7 @@ void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) | |||
649 | tv_usec /= NSEC_PER_USEC; | 650 | tv_usec /= NSEC_PER_USEC; |
650 | value->tv_usec = tv_usec; | 651 | value->tv_usec = tv_usec; |
651 | } | 652 | } |
653 | EXPORT_SYMBOL(jiffies_to_timeval); | ||
652 | 654 | ||
653 | /* | 655 | /* |
654 | * Convert jiffies/jiffies_64 to clock_t and back. | 656 | * Convert jiffies/jiffies_64 to clock_t and back. |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 67932ea78c17..76212b2a99de 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -274,72 +274,3 @@ void clockevents_notify(unsigned long reason, void *arg) | |||
274 | } | 274 | } |
275 | EXPORT_SYMBOL_GPL(clockevents_notify); | 275 | EXPORT_SYMBOL_GPL(clockevents_notify); |
276 | 276 | ||
277 | #ifdef CONFIG_SYSFS | ||
278 | |||
279 | /** | ||
280 | * clockevents_show_registered - sysfs interface for listing clockevents | ||
281 | * @dev: unused | ||
282 | * @buf: char buffer to be filled with clock events list | ||
283 | * | ||
284 | * Provides sysfs interface for listing registered clock event devices | ||
285 | */ | ||
286 | static ssize_t clockevents_show_registered(struct sys_device *dev, char *buf) | ||
287 | { | ||
288 | struct list_head *tmp; | ||
289 | char *p = buf; | ||
290 | int cpu; | ||
291 | |||
292 | spin_lock(&clockevents_lock); | ||
293 | |||
294 | list_for_each(tmp, &clockevent_devices) { | ||
295 | struct clock_event_device *ce; | ||
296 | |||
297 | ce = list_entry(tmp, struct clock_event_device, list); | ||
298 | p += sprintf(p, "%-20s F:%04x M:%d", ce->name, | ||
299 | ce->features, ce->mode); | ||
300 | p += sprintf(p, " C:"); | ||
301 | if (!cpus_equal(ce->cpumask, cpu_possible_map)) { | ||
302 | for_each_cpu_mask(cpu, ce->cpumask) | ||
303 | p += sprintf(p, " %d", cpu); | ||
304 | } else { | ||
305 | /* | ||
306 | * FIXME: Add the cpu which is handling this sucker | ||
307 | */ | ||
308 | } | ||
309 | p += sprintf(p, "\n"); | ||
310 | } | ||
311 | |||
312 | spin_unlock(&clockevents_lock); | ||
313 | |||
314 | return p - buf; | ||
315 | } | ||
316 | |||
317 | /* | ||
318 | * Sysfs setup bits: | ||
319 | */ | ||
320 | static SYSDEV_ATTR(registered, 0600, | ||
321 | clockevents_show_registered, NULL); | ||
322 | |||
323 | static struct sysdev_class clockevents_sysclass = { | ||
324 | set_kset_name("clockevents"), | ||
325 | }; | ||
326 | |||
327 | static struct sys_device clockevents_sys_device = { | ||
328 | .id = 0, | ||
329 | .cls = &clockevents_sysclass, | ||
330 | }; | ||
331 | |||
332 | static int __init clockevents_sysfs_init(void) | ||
333 | { | ||
334 | int error = sysdev_class_register(&clockevents_sysclass); | ||
335 | |||
336 | if (!error) | ||
337 | error = sysdev_register(&clockevents_sys_device); | ||
338 | if (!error) | ||
339 | error = sysdev_create_file( | ||
340 | &clockevents_sys_device, | ||
341 | &attr_registered); | ||
342 | return error; | ||
343 | } | ||
344 | device_initcall(clockevents_sysfs_init); | ||
345 | #endif | ||
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 5b0e46b56fd0..fe5c7db24247 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -151,7 +151,8 @@ static void clocksource_check_watchdog(struct clocksource *cs) | |||
151 | watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; | 151 | watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; |
152 | add_timer(&watchdog_timer); | 152 | add_timer(&watchdog_timer); |
153 | } | 153 | } |
154 | } else if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) { | 154 | } else { |
155 | if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) | ||
155 | cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES; | 156 | cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES; |
156 | 157 | ||
157 | if (!watchdog || cs->rating > watchdog->rating) { | 158 | if (!watchdog || cs->rating > watchdog->rating) { |
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c index 3be8da8fed7e..4c256fdb8875 100644 --- a/kernel/time/jiffies.c +++ b/kernel/time/jiffies.c | |||
@@ -69,4 +69,4 @@ static int __init init_jiffies_clocksource(void) | |||
69 | return clocksource_register(&clocksource_jiffies); | 69 | return clocksource_register(&clocksource_jiffies); |
70 | } | 70 | } |
71 | 71 | ||
72 | module_init(init_jiffies_clocksource); | 72 | core_initcall(init_jiffies_clocksource); |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index eb12509e00bd..cb25649c6f50 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -32,7 +32,7 @@ static u64 tick_length, tick_length_base; | |||
32 | /* TIME_ERROR prevents overwriting the CMOS clock */ | 32 | /* TIME_ERROR prevents overwriting the CMOS clock */ |
33 | static int time_state = TIME_OK; /* clock synchronization status */ | 33 | static int time_state = TIME_OK; /* clock synchronization status */ |
34 | int time_status = STA_UNSYNC; /* clock status bits */ | 34 | int time_status = STA_UNSYNC; /* clock status bits */ |
35 | static long time_offset; /* time adjustment (ns) */ | 35 | static s64 time_offset; /* time adjustment (ns) */ |
36 | static long time_constant = 2; /* pll time constant */ | 36 | static long time_constant = 2; /* pll time constant */ |
37 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ | 37 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ |
38 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ | 38 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ |
@@ -196,7 +196,7 @@ void __attribute__ ((weak)) notify_arch_cmos_timer(void) | |||
196 | */ | 196 | */ |
197 | int do_adjtimex(struct timex *txc) | 197 | int do_adjtimex(struct timex *txc) |
198 | { | 198 | { |
199 | long ltemp, mtemp, save_adjust; | 199 | long mtemp, save_adjust, rem; |
200 | s64 freq_adj, temp64; | 200 | s64 freq_adj, temp64; |
201 | int result; | 201 | int result; |
202 | 202 | ||
@@ -277,14 +277,14 @@ int do_adjtimex(struct timex *txc) | |||
277 | time_adjust = txc->offset; | 277 | time_adjust = txc->offset; |
278 | } | 278 | } |
279 | else if (time_status & STA_PLL) { | 279 | else if (time_status & STA_PLL) { |
280 | ltemp = txc->offset * NSEC_PER_USEC; | 280 | time_offset = txc->offset * NSEC_PER_USEC; |
281 | 281 | ||
282 | /* | 282 | /* |
283 | * Scale the phase adjustment and | 283 | * Scale the phase adjustment and |
284 | * clamp to the operating range. | 284 | * clamp to the operating range. |
285 | */ | 285 | */ |
286 | time_offset = min(ltemp, MAXPHASE * NSEC_PER_USEC); | 286 | time_offset = min(time_offset, (s64)MAXPHASE * NSEC_PER_USEC); |
287 | time_offset = max(time_offset, -MAXPHASE * NSEC_PER_USEC); | 287 | time_offset = max(time_offset, (s64)-MAXPHASE * NSEC_PER_USEC); |
288 | 288 | ||
289 | /* | 289 | /* |
290 | * Select whether the frequency is to be controlled | 290 | * Select whether the frequency is to be controlled |
@@ -297,11 +297,11 @@ int do_adjtimex(struct timex *txc) | |||
297 | mtemp = xtime.tv_sec - time_reftime; | 297 | mtemp = xtime.tv_sec - time_reftime; |
298 | time_reftime = xtime.tv_sec; | 298 | time_reftime = xtime.tv_sec; |
299 | 299 | ||
300 | freq_adj = (s64)time_offset * mtemp; | 300 | freq_adj = time_offset * mtemp; |
301 | freq_adj = shift_right(freq_adj, time_constant * 2 + | 301 | freq_adj = shift_right(freq_adj, time_constant * 2 + |
302 | (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); | 302 | (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); |
303 | if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { | 303 | if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { |
304 | temp64 = (s64)time_offset << (SHIFT_NSEC - SHIFT_FLL); | 304 | temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL); |
305 | if (time_offset < 0) { | 305 | if (time_offset < 0) { |
306 | temp64 = -temp64; | 306 | temp64 = -temp64; |
307 | do_div(temp64, mtemp); | 307 | do_div(temp64, mtemp); |
@@ -314,8 +314,10 @@ int do_adjtimex(struct timex *txc) | |||
314 | freq_adj += time_freq; | 314 | freq_adj += time_freq; |
315 | freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); | 315 | freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); |
316 | time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); | 316 | time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); |
317 | time_offset = (time_offset / NTP_INTERVAL_FREQ) | 317 | time_offset = div_long_long_rem_signed(time_offset, |
318 | << SHIFT_UPDATE; | 318 | NTP_INTERVAL_FREQ, |
319 | &rem); | ||
320 | time_offset <<= SHIFT_UPDATE; | ||
319 | } /* STA_PLL */ | 321 | } /* STA_PLL */ |
320 | } /* txc->modes & ADJ_OFFSET */ | 322 | } /* txc->modes & ADJ_OFFSET */ |
321 | if (txc->modes & ADJ_TICK) | 323 | if (txc->modes & ADJ_TICK) |
@@ -328,12 +330,12 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) | |||
328 | result = TIME_ERROR; | 330 | result = TIME_ERROR; |
329 | 331 | ||
330 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) | 332 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) |
331 | txc->offset = save_adjust; | 333 | txc->offset = save_adjust; |
332 | else | 334 | else |
333 | txc->offset = shift_right(time_offset, SHIFT_UPDATE) | 335 | txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) * |
334 | * NTP_INTERVAL_FREQ / 1000; | 336 | NTP_INTERVAL_FREQ / 1000; |
335 | txc->freq = (time_freq / NSEC_PER_USEC) | 337 | txc->freq = (time_freq / NSEC_PER_USEC) << |
336 | << (SHIFT_USEC - SHIFT_NSEC); | 338 | (SHIFT_USEC - SHIFT_NSEC); |
337 | txc->maxerror = time_maxerror; | 339 | txc->maxerror = time_maxerror; |
338 | txc->esterror = time_esterror; | 340 | txc->esterror = time_esterror; |
339 | txc->status = time_status; | 341 | txc->status = time_status; |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 5567745470f7..eadfce2fff74 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -307,12 +307,19 @@ int tick_resume_broadcast(void) | |||
307 | spin_lock_irqsave(&tick_broadcast_lock, flags); | 307 | spin_lock_irqsave(&tick_broadcast_lock, flags); |
308 | 308 | ||
309 | bc = tick_broadcast_device.evtdev; | 309 | bc = tick_broadcast_device.evtdev; |
310 | if (bc) { | ||
311 | if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC && | ||
312 | !cpus_empty(tick_broadcast_mask)) | ||
313 | tick_broadcast_start_periodic(bc); | ||
314 | 310 | ||
315 | broadcast = cpu_isset(smp_processor_id(), tick_broadcast_mask); | 311 | if (bc) { |
312 | switch (tick_broadcast_device.mode) { | ||
313 | case TICKDEV_MODE_PERIODIC: | ||
314 | if(!cpus_empty(tick_broadcast_mask)) | ||
315 | tick_broadcast_start_periodic(bc); | ||
316 | broadcast = cpu_isset(smp_processor_id(), | ||
317 | tick_broadcast_mask); | ||
318 | break; | ||
319 | case TICKDEV_MODE_ONESHOT: | ||
320 | broadcast = tick_resume_broadcast_oneshot(bc); | ||
321 | break; | ||
322 | } | ||
316 | } | 323 | } |
317 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); | 324 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); |
318 | 325 | ||
@@ -347,6 +354,16 @@ static int tick_broadcast_set_event(ktime_t expires, int force) | |||
347 | } | 354 | } |
348 | } | 355 | } |
349 | 356 | ||
357 | int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | ||
358 | { | ||
359 | clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); | ||
360 | |||
361 | if(!cpus_empty(tick_broadcast_oneshot_mask)) | ||
362 | tick_broadcast_set_event(ktime_get(), 1); | ||
363 | |||
364 | return cpu_isset(smp_processor_id(), tick_broadcast_oneshot_mask); | ||
365 | } | ||
366 | |||
350 | /* | 367 | /* |
351 | * Reprogram the broadcast device: | 368 | * Reprogram the broadcast device: |
352 | * | 369 | * |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 43ba1bdec14c..bfda3f7f0716 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -298,18 +298,17 @@ static void tick_shutdown(unsigned int *cpup) | |||
298 | spin_unlock_irqrestore(&tick_device_lock, flags); | 298 | spin_unlock_irqrestore(&tick_device_lock, flags); |
299 | } | 299 | } |
300 | 300 | ||
301 | static void tick_suspend_periodic(void) | 301 | static void tick_suspend(void) |
302 | { | 302 | { |
303 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 303 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); |
304 | unsigned long flags; | 304 | unsigned long flags; |
305 | 305 | ||
306 | spin_lock_irqsave(&tick_device_lock, flags); | 306 | spin_lock_irqsave(&tick_device_lock, flags); |
307 | if (td->mode == TICKDEV_MODE_PERIODIC) | 307 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN); |
308 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN); | ||
309 | spin_unlock_irqrestore(&tick_device_lock, flags); | 308 | spin_unlock_irqrestore(&tick_device_lock, flags); |
310 | } | 309 | } |
311 | 310 | ||
312 | static void tick_resume_periodic(void) | 311 | static void tick_resume(void) |
313 | { | 312 | { |
314 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 313 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); |
315 | unsigned long flags; | 314 | unsigned long flags; |
@@ -317,6 +316,8 @@ static void tick_resume_periodic(void) | |||
317 | spin_lock_irqsave(&tick_device_lock, flags); | 316 | spin_lock_irqsave(&tick_device_lock, flags); |
318 | if (td->mode == TICKDEV_MODE_PERIODIC) | 317 | if (td->mode == TICKDEV_MODE_PERIODIC) |
319 | tick_setup_periodic(td->evtdev, 0); | 318 | tick_setup_periodic(td->evtdev, 0); |
319 | else | ||
320 | tick_resume_oneshot(); | ||
320 | spin_unlock_irqrestore(&tick_device_lock, flags); | 321 | spin_unlock_irqrestore(&tick_device_lock, flags); |
321 | } | 322 | } |
322 | 323 | ||
@@ -348,13 +349,13 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason, | |||
348 | break; | 349 | break; |
349 | 350 | ||
350 | case CLOCK_EVT_NOTIFY_SUSPEND: | 351 | case CLOCK_EVT_NOTIFY_SUSPEND: |
351 | tick_suspend_periodic(); | 352 | tick_suspend(); |
352 | tick_suspend_broadcast(); | 353 | tick_suspend_broadcast(); |
353 | break; | 354 | break; |
354 | 355 | ||
355 | case CLOCK_EVT_NOTIFY_RESUME: | 356 | case CLOCK_EVT_NOTIFY_RESUME: |
356 | if (!tick_resume_broadcast()) | 357 | if (!tick_resume_broadcast()) |
357 | tick_resume_periodic(); | 358 | tick_resume(); |
358 | break; | 359 | break; |
359 | 360 | ||
360 | default: | 361 | default: |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 75890efd24ff..c9d203bde518 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -19,12 +19,13 @@ extern void tick_setup_oneshot(struct clock_event_device *newdev, | |||
19 | extern int tick_program_event(ktime_t expires, int force); | 19 | extern int tick_program_event(ktime_t expires, int force); |
20 | extern void tick_oneshot_notify(void); | 20 | extern void tick_oneshot_notify(void); |
21 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); | 21 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); |
22 | 22 | extern void tick_resume_oneshot(void); | |
23 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 23 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
24 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); | 24 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); |
25 | extern void tick_broadcast_oneshot_control(unsigned long reason); | 25 | extern void tick_broadcast_oneshot_control(unsigned long reason); |
26 | extern void tick_broadcast_switch_to_oneshot(void); | 26 | extern void tick_broadcast_switch_to_oneshot(void); |
27 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); | 27 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); |
28 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | ||
28 | # else /* BROADCAST */ | 29 | # else /* BROADCAST */ |
29 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 30 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) |
30 | { | 31 | { |
@@ -43,6 +44,10 @@ void tick_setup_oneshot(struct clock_event_device *newdev, | |||
43 | { | 44 | { |
44 | BUG(); | 45 | BUG(); |
45 | } | 46 | } |
47 | static inline void tick_resume_oneshot(void) | ||
48 | { | ||
49 | BUG(); | ||
50 | } | ||
46 | static inline int tick_program_event(ktime_t expires, int force) | 51 | static inline int tick_program_event(ktime_t expires, int force) |
47 | { | 52 | { |
48 | return 0; | 53 | return 0; |
@@ -54,6 +59,10 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |||
54 | } | 59 | } |
55 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } | 60 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } |
56 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | 61 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } |
62 | static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | ||
63 | { | ||
64 | return 0; | ||
65 | } | ||
57 | #endif /* !TICK_ONESHOT */ | 66 | #endif /* !TICK_ONESHOT */ |
58 | 67 | ||
59 | /* | 68 | /* |
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 2e8b7ff863cc..f6997ab0c3c9 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c | |||
@@ -41,6 +41,18 @@ int tick_program_event(ktime_t expires, int force) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * tick_resume_onshot - resume oneshot mode | ||
45 | */ | ||
46 | void tick_resume_oneshot(void) | ||
47 | { | ||
48 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | ||
49 | struct clock_event_device *dev = td->evtdev; | ||
50 | |||
51 | clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); | ||
52 | tick_program_event(ktime_get(), 1); | ||
53 | } | ||
54 | |||
55 | /** | ||
44 | * tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) | 56 | * tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) |
45 | */ | 57 | */ |
46 | void tick_setup_oneshot(struct clock_event_device *newdev, | 58 | void tick_setup_oneshot(struct clock_event_device *newdev, |
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index f82c635c3d5c..59df5e8555a8 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c | |||
@@ -194,9 +194,9 @@ print_tickdevice(struct seq_file *m, struct tick_device *td) | |||
194 | return; | 194 | return; |
195 | } | 195 | } |
196 | SEQ_printf(m, "%s\n", dev->name); | 196 | SEQ_printf(m, "%s\n", dev->name); |
197 | SEQ_printf(m, " max_delta_ns: %ld\n", dev->max_delta_ns); | 197 | SEQ_printf(m, " max_delta_ns: %lu\n", dev->max_delta_ns); |
198 | SEQ_printf(m, " min_delta_ns: %ld\n", dev->min_delta_ns); | 198 | SEQ_printf(m, " min_delta_ns: %lu\n", dev->min_delta_ns); |
199 | SEQ_printf(m, " mult: %ld\n", dev->mult); | 199 | SEQ_printf(m, " mult: %lu\n", dev->mult); |
200 | SEQ_printf(m, " shift: %d\n", dev->shift); | 200 | SEQ_printf(m, " shift: %d\n", dev->shift); |
201 | SEQ_printf(m, " mode: %d\n", dev->mode); | 201 | SEQ_printf(m, " mode: %d\n", dev->mode); |
202 | SEQ_printf(m, " next_event: %Ld nsecs\n", | 202 | SEQ_printf(m, " next_event: %Ld nsecs\n", |
diff --git a/kernel/timer.c b/kernel/timer.c index 797cccb86431..dd6c2c1c561b 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -695,15 +695,28 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now, | |||
695 | { | 695 | { |
696 | ktime_t hr_delta = hrtimer_get_next_event(); | 696 | ktime_t hr_delta = hrtimer_get_next_event(); |
697 | struct timespec tsdelta; | 697 | struct timespec tsdelta; |
698 | unsigned long delta; | ||
698 | 699 | ||
699 | if (hr_delta.tv64 == KTIME_MAX) | 700 | if (hr_delta.tv64 == KTIME_MAX) |
700 | return expires; | 701 | return expires; |
701 | 702 | ||
702 | if (hr_delta.tv64 <= TICK_NSEC) | 703 | /* |
703 | return now; | 704 | * Expired timer available, let it expire in the next tick |
705 | */ | ||
706 | if (hr_delta.tv64 <= 0) | ||
707 | return now + 1; | ||
704 | 708 | ||
705 | tsdelta = ktime_to_timespec(hr_delta); | 709 | tsdelta = ktime_to_timespec(hr_delta); |
706 | now += timespec_to_jiffies(&tsdelta); | 710 | delta = timespec_to_jiffies(&tsdelta); |
711 | /* | ||
712 | * Take rounding errors in to account and make sure, that it | ||
713 | * expires in the next tick. Otherwise we go into an endless | ||
714 | * ping pong due to tick_nohz_stop_sched_tick() retriggering | ||
715 | * the timer softirq | ||
716 | */ | ||
717 | if (delta < 1) | ||
718 | delta = 1; | ||
719 | now += delta; | ||
707 | if (time_before(now, expires)) | 720 | if (time_before(now, expires)) |
708 | return now; | 721 | return now; |
709 | return expires; | 722 | return expires; |
@@ -1003,7 +1016,7 @@ static int timekeeping_resume(struct sys_device *dev) | |||
1003 | clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL); | 1016 | clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL); |
1004 | 1017 | ||
1005 | /* Resume hrtimers */ | 1018 | /* Resume hrtimers */ |
1006 | clock_was_set(); | 1019 | hres_timers_resume(); |
1007 | 1020 | ||
1008 | return 0; | 1021 | return 0; |
1009 | } | 1022 | } |