diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/hrtimer.c | 15 | ||||
-rw-r--r-- | kernel/power/Kconfig | 37 | ||||
-rw-r--r-- | kernel/rcutorture.c | 14 | ||||
-rw-r--r-- | kernel/time/tick-broadcast.c | 36 | ||||
-rw-r--r-- | kernel/time/tick-common.c | 32 | ||||
-rw-r--r-- | kernel/time/tick-internal.h | 4 | ||||
-rw-r--r-- | kernel/timer.c | 8 |
7 files changed, 118 insertions, 28 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index de93a8176ca6..ec4cb9f3e3b7 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -540,19 +540,19 @@ static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer, | |||
540 | /* | 540 | /* |
541 | * Switch to high resolution mode | 541 | * Switch to high resolution mode |
542 | */ | 542 | */ |
543 | static void hrtimer_switch_to_hres(void) | 543 | static int hrtimer_switch_to_hres(void) |
544 | { | 544 | { |
545 | struct hrtimer_cpu_base *base = &__get_cpu_var(hrtimer_bases); | 545 | struct hrtimer_cpu_base *base = &__get_cpu_var(hrtimer_bases); |
546 | unsigned long flags; | 546 | unsigned long flags; |
547 | 547 | ||
548 | if (base->hres_active) | 548 | if (base->hres_active) |
549 | return; | 549 | return 1; |
550 | 550 | ||
551 | local_irq_save(flags); | 551 | local_irq_save(flags); |
552 | 552 | ||
553 | if (tick_init_highres()) { | 553 | if (tick_init_highres()) { |
554 | local_irq_restore(flags); | 554 | local_irq_restore(flags); |
555 | return; | 555 | return 0; |
556 | } | 556 | } |
557 | base->hres_active = 1; | 557 | base->hres_active = 1; |
558 | base->clock_base[CLOCK_REALTIME].resolution = KTIME_HIGH_RES; | 558 | base->clock_base[CLOCK_REALTIME].resolution = KTIME_HIGH_RES; |
@@ -565,13 +565,14 @@ static void hrtimer_switch_to_hres(void) | |||
565 | local_irq_restore(flags); | 565 | local_irq_restore(flags); |
566 | printk(KERN_INFO "Switched to high resolution mode on CPU %d\n", | 566 | printk(KERN_INFO "Switched to high resolution mode on CPU %d\n", |
567 | smp_processor_id()); | 567 | smp_processor_id()); |
568 | return 1; | ||
568 | } | 569 | } |
569 | 570 | ||
570 | #else | 571 | #else |
571 | 572 | ||
572 | static inline int hrtimer_hres_active(void) { return 0; } | 573 | static inline int hrtimer_hres_active(void) { return 0; } |
573 | static inline int hrtimer_is_hres_enabled(void) { return 0; } | 574 | static inline int hrtimer_is_hres_enabled(void) { return 0; } |
574 | static inline void hrtimer_switch_to_hres(void) { } | 575 | static inline int hrtimer_switch_to_hres(void) { return 0; } |
575 | static inline void hrtimer_force_reprogram(struct hrtimer_cpu_base *base) { } | 576 | static inline void hrtimer_force_reprogram(struct hrtimer_cpu_base *base) { } |
576 | static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer, | 577 | static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer, |
577 | struct hrtimer_clock_base *base) | 578 | struct hrtimer_clock_base *base) |
@@ -1130,6 +1131,9 @@ static inline void run_hrtimer_queue(struct hrtimer_cpu_base *cpu_base, | |||
1130 | if (base->softirq_time.tv64 <= timer->expires.tv64) | 1131 | if (base->softirq_time.tv64 <= timer->expires.tv64) |
1131 | break; | 1132 | break; |
1132 | 1133 | ||
1134 | #ifdef CONFIG_HIGH_RES_TIMERS | ||
1135 | WARN_ON_ONCE(timer->cb_mode == HRTIMER_CB_IRQSAFE_NO_SOFTIRQ); | ||
1136 | #endif | ||
1133 | timer_stats_account_hrtimer(timer); | 1137 | timer_stats_account_hrtimer(timer); |
1134 | 1138 | ||
1135 | fn = timer->function; | 1139 | fn = timer->function; |
@@ -1173,7 +1177,8 @@ void hrtimer_run_queues(void) | |||
1173 | * deadlock vs. xtime_lock. | 1177 | * deadlock vs. xtime_lock. |
1174 | */ | 1178 | */ |
1175 | if (tick_check_oneshot_change(!hrtimer_is_hres_enabled())) | 1179 | if (tick_check_oneshot_change(!hrtimer_is_hres_enabled())) |
1176 | hrtimer_switch_to_hres(); | 1180 | if (hrtimer_switch_to_hres()) |
1181 | return; | ||
1177 | 1182 | ||
1178 | hrtimer_get_softirq_time(cpu_base); | 1183 | hrtimer_get_softirq_time(cpu_base); |
1179 | 1184 | ||
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 95f6657fff73..51a4dd0f1b74 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -81,29 +81,34 @@ config SOFTWARE_SUSPEND | |||
81 | bool "Software Suspend" | 81 | bool "Software Suspend" |
82 | depends on PM && SWAP && ((X86 && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP)) | 82 | depends on PM && SWAP && ((X86 && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP)) |
83 | ---help--- | 83 | ---help--- |
84 | Enable the possibility of suspending the machine. | 84 | Enable the suspend to disk (STD) functionality. |
85 | It doesn't need ACPI or APM. | ||
86 | You may suspend your machine by 'swsusp' or 'shutdown -z <time>' | ||
87 | (patch for sysvinit needed). | ||
88 | 85 | ||
89 | It creates an image which is saved in your active swap. Upon next | 86 | You can suspend your machine with 'echo disk > /sys/power/state'. |
87 | Alternatively, you can use the additional userland tools available | ||
88 | from <http://suspend.sf.net>. | ||
89 | |||
90 | In principle it does not require ACPI or APM, although for example | ||
91 | ACPI will be used if available. | ||
92 | |||
93 | It creates an image which is saved in your active swap. Upon the next | ||
90 | boot, pass the 'resume=/dev/swappartition' argument to the kernel to | 94 | boot, pass the 'resume=/dev/swappartition' argument to the kernel to |
91 | have it detect the saved image, restore memory state from it, and | 95 | have it detect the saved image, restore memory state from it, and |
92 | continue to run as before. If you do not want the previous state to | 96 | continue to run as before. If you do not want the previous state to |
93 | be reloaded, then use the 'noresume' kernel argument. However, note | 97 | be reloaded, then use the 'noresume' kernel command line argument. |
94 | that your partitions will be fsck'd and you must re-mkswap your swap | 98 | Note, however, that fsck will be run on your filesystems and you will |
95 | partitions. It does not work with swap files. | 99 | need to run mkswap against the swap partition used for the suspend. |
96 | 100 | ||
97 | Right now you may boot without resuming and then later resume but | 101 | It also works with swap files to a limited extent (for details see |
98 | in meantime you cannot use those swap partitions/files which were | 102 | <file:Documentation/power/swsusp-and-swap-files.txt>). |
99 | involved in suspending. Also in this case there is a risk that buffers | ||
100 | on disk won't match with saved ones. | ||
101 | 103 | ||
102 | For more information take a look at <file:Documentation/power/swsusp.txt>. | 104 | Right now you may boot without resuming and resume later but in the |
105 | meantime you cannot use the swap partition(s)/file(s) involved in | ||
106 | suspending. Also in this case you must not use the filesystems | ||
107 | that were mounted before the suspend. In particular, you MUST NOT | ||
108 | MOUNT any journaled filesystems mounted before the suspend or they | ||
109 | will get corrupted in a nasty way. | ||
103 | 110 | ||
104 | (For now, swsusp is incompatible with PAE aka HIGHMEM_64G on i386. | 111 | For more information take a look at <file:Documentation/power/swsusp.txt>. |
105 | we need identity mapping for resume to work, and that is trivial | ||
106 | to get with 4MB pages, but less than trivial on PAE). | ||
107 | 112 | ||
108 | config PM_STD_PARTITION | 113 | config PM_STD_PARTITION |
109 | string "Default resume partition" | 114 | string "Default resume partition" |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 482b11ff65cb..bcd14e83ef39 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -60,19 +60,19 @@ static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */ | |||
60 | static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ | 60 | static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ |
61 | static char *torture_type = "rcu"; /* What RCU implementation to torture. */ | 61 | static char *torture_type = "rcu"; /* What RCU implementation to torture. */ |
62 | 62 | ||
63 | module_param(nreaders, int, 0); | 63 | module_param(nreaders, int, 0444); |
64 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); | 64 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); |
65 | module_param(nfakewriters, int, 0); | 65 | module_param(nfakewriters, int, 0444); |
66 | MODULE_PARM_DESC(nfakewriters, "Number of RCU fake writer threads"); | 66 | MODULE_PARM_DESC(nfakewriters, "Number of RCU fake writer threads"); |
67 | module_param(stat_interval, int, 0); | 67 | module_param(stat_interval, int, 0444); |
68 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); | 68 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); |
69 | module_param(verbose, bool, 0); | 69 | module_param(verbose, bool, 0444); |
70 | MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); | 70 | MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); |
71 | module_param(test_no_idle_hz, bool, 0); | 71 | module_param(test_no_idle_hz, bool, 0444); |
72 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); | 72 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); |
73 | module_param(shuffle_interval, int, 0); | 73 | module_param(shuffle_interval, int, 0444); |
74 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); | 74 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); |
75 | module_param(torture_type, charp, 0); | 75 | module_param(torture_type, charp, 0444); |
76 | MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, srcu)"); | 76 | MODULE_PARM_DESC(torture_type, "Type of RCU to torture (rcu, rcu_bh, srcu)"); |
77 | 77 | ||
78 | #define TORTURE_FLAG "-torture:" | 78 | #define TORTURE_FLAG "-torture:" |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 12b3efeb9f6f..5567745470f7 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -284,6 +284,42 @@ void tick_shutdown_broadcast(unsigned int *cpup) | |||
284 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); | 284 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); |
285 | } | 285 | } |
286 | 286 | ||
287 | void tick_suspend_broadcast(void) | ||
288 | { | ||
289 | struct clock_event_device *bc; | ||
290 | unsigned long flags; | ||
291 | |||
292 | spin_lock_irqsave(&tick_broadcast_lock, flags); | ||
293 | |||
294 | bc = tick_broadcast_device.evtdev; | ||
295 | if (bc && tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) | ||
296 | clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); | ||
297 | |||
298 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); | ||
299 | } | ||
300 | |||
301 | int tick_resume_broadcast(void) | ||
302 | { | ||
303 | struct clock_event_device *bc; | ||
304 | unsigned long flags; | ||
305 | int broadcast = 0; | ||
306 | |||
307 | spin_lock_irqsave(&tick_broadcast_lock, flags); | ||
308 | |||
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 | |||
315 | broadcast = cpu_isset(smp_processor_id(), tick_broadcast_mask); | ||
316 | } | ||
317 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); | ||
318 | |||
319 | return broadcast; | ||
320 | } | ||
321 | |||
322 | |||
287 | #ifdef CONFIG_TICK_ONESHOT | 323 | #ifdef CONFIG_TICK_ONESHOT |
288 | 324 | ||
289 | static cpumask_t tick_broadcast_oneshot_mask; | 325 | static cpumask_t tick_broadcast_oneshot_mask; |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 0986a2bfab49..43ba1bdec14c 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -298,6 +298,28 @@ 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) | ||
302 | { | ||
303 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | ||
304 | unsigned long flags; | ||
305 | |||
306 | spin_lock_irqsave(&tick_device_lock, flags); | ||
307 | if (td->mode == TICKDEV_MODE_PERIODIC) | ||
308 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN); | ||
309 | spin_unlock_irqrestore(&tick_device_lock, flags); | ||
310 | } | ||
311 | |||
312 | static void tick_resume_periodic(void) | ||
313 | { | ||
314 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | ||
315 | unsigned long flags; | ||
316 | |||
317 | spin_lock_irqsave(&tick_device_lock, flags); | ||
318 | if (td->mode == TICKDEV_MODE_PERIODIC) | ||
319 | tick_setup_periodic(td->evtdev, 0); | ||
320 | spin_unlock_irqrestore(&tick_device_lock, flags); | ||
321 | } | ||
322 | |||
301 | /* | 323 | /* |
302 | * Notification about clock event devices | 324 | * Notification about clock event devices |
303 | */ | 325 | */ |
@@ -325,6 +347,16 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason, | |||
325 | tick_shutdown(dev); | 347 | tick_shutdown(dev); |
326 | break; | 348 | break; |
327 | 349 | ||
350 | case CLOCK_EVT_NOTIFY_SUSPEND: | ||
351 | tick_suspend_periodic(); | ||
352 | tick_suspend_broadcast(); | ||
353 | break; | ||
354 | |||
355 | case CLOCK_EVT_NOTIFY_RESUME: | ||
356 | if (!tick_resume_broadcast()) | ||
357 | tick_resume_periodic(); | ||
358 | break; | ||
359 | |||
328 | default: | 360 | default: |
329 | break; | 361 | break; |
330 | } | 362 | } |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 54861a0f29ff..75890efd24ff 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -67,6 +67,8 @@ extern int tick_check_broadcast_device(struct clock_event_device *dev); | |||
67 | extern int tick_is_broadcast_device(struct clock_event_device *dev); | 67 | extern int tick_is_broadcast_device(struct clock_event_device *dev); |
68 | extern void tick_broadcast_on_off(unsigned long reason, int *oncpu); | 68 | extern void tick_broadcast_on_off(unsigned long reason, int *oncpu); |
69 | extern void tick_shutdown_broadcast(unsigned int *cpup); | 69 | extern void tick_shutdown_broadcast(unsigned int *cpup); |
70 | extern void tick_suspend_broadcast(void); | ||
71 | extern int tick_resume_broadcast(void); | ||
70 | 72 | ||
71 | extern void | 73 | extern void |
72 | tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); | 74 | tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); |
@@ -90,6 +92,8 @@ static inline int tick_device_uses_broadcast(struct clock_event_device *dev, | |||
90 | static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } | 92 | static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } |
91 | static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } | 93 | static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } |
92 | static inline void tick_shutdown_broadcast(unsigned int *cpup) { } | 94 | static inline void tick_shutdown_broadcast(unsigned int *cpup) { } |
95 | static inline void tick_suspend_broadcast(void) { } | ||
96 | static inline int tick_resume_broadcast(void) { return 0; } | ||
93 | 97 | ||
94 | /* | 98 | /* |
95 | * Set the periodic handler in non broadcast mode | 99 | * Set the periodic handler in non broadcast mode |
diff --git a/kernel/timer.c b/kernel/timer.c index 8ad384253ef2..797cccb86431 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -862,6 +862,8 @@ int do_settimeofday(struct timespec *tv) | |||
862 | clock->error = 0; | 862 | clock->error = 0; |
863 | ntp_clear(); | 863 | ntp_clear(); |
864 | 864 | ||
865 | update_vsyscall(&xtime, clock); | ||
866 | |||
865 | write_sequnlock_irqrestore(&xtime_lock, flags); | 867 | write_sequnlock_irqrestore(&xtime_lock, flags); |
866 | 868 | ||
867 | /* signal hrtimers about time change */ | 869 | /* signal hrtimers about time change */ |
@@ -997,6 +999,9 @@ static int timekeeping_resume(struct sys_device *dev) | |||
997 | write_sequnlock_irqrestore(&xtime_lock, flags); | 999 | write_sequnlock_irqrestore(&xtime_lock, flags); |
998 | 1000 | ||
999 | touch_softlockup_watchdog(); | 1001 | touch_softlockup_watchdog(); |
1002 | |||
1003 | clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL); | ||
1004 | |||
1000 | /* Resume hrtimers */ | 1005 | /* Resume hrtimers */ |
1001 | clock_was_set(); | 1006 | clock_was_set(); |
1002 | 1007 | ||
@@ -1011,6 +1016,9 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state) | |||
1011 | timekeeping_suspended = 1; | 1016 | timekeeping_suspended = 1; |
1012 | timekeeping_suspend_time = read_persistent_clock(); | 1017 | timekeeping_suspend_time = read_persistent_clock(); |
1013 | write_sequnlock_irqrestore(&xtime_lock, flags); | 1018 | write_sequnlock_irqrestore(&xtime_lock, flags); |
1019 | |||
1020 | clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); | ||
1021 | |||
1014 | return 0; | 1022 | return 0; |
1015 | } | 1023 | } |
1016 | 1024 | ||