| Age | Commit message (Collapse) | Author | Lines |
|
This kills swsusp_resume; it should be arch-neutral but some i386 code
sneaked in. And arch-specific code is better done in assembly anyway.
Plus it fixes memory leaks in error paths.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This kills unused macro and write-only variable, and adds messages where
something goes wrong with suspending devices.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Allow admin to enable only some of the Magic-Sysrq functions. This allows
admin to disable sysrq functions he considers dangerous (e.g. sending kill
signal, remounting fs RO) while keeping the possibility to use the others
(e.g. debug deadlocks by dumps of processes etc.).
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
In platform swsusp mode, we were forgetting to spin disks down, leading to
ugly emergency shutdown. This synchronizes platform method with other
methods and actually helps.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
From: <mjg59@scrf.ucam.org>
When using a fully modularized kernel it is necessary to activate resume
manually as the device node might not be available during kernel init.
This patch implements a new sysfs attribute '/sys/power/resume' which allows
for manual activation of software resume. When read from it prints the
configured resume device in 'major:minor' format. When written to it expects
a device in 'major:minor' format. This device is then checked for a suspended
image and resume is started if a valid image is found. The original
functionality is left in place.
It should be used from initramfs, or with care.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
The following patch is designed to fix a problem in the current implementation
of swsusp in mainline kernels. Namely, swsusp uses an array of page backup
entries (aka pagedir) to store pointers to memory pages that must be saved
during suspend and restored during resume.
Unfortunately, the pagedir has to be located in a contiguous chunk of memory
and it sometimes turns out that an 8-order or even 9-order allocation is
needed for this purpose. It sometimes is impossible to get such an allocation
and swsusp may fail during either suspend or resume due to the lack of memory,
although theoretically there is enough free memory for it to succeed.
Moreover, swsusp is more likely to fail for this reason during resume, which
means that it may fail during resume after a successful suspend (this actually
has happened for some people, including me :-)) and this, potentially, may
lead to the loss of data.
The problem is fixed by replacing the pagedir with a linklist so that
high-order memory allocations are avoided (the patches make swsusp use only
0-order allocations). Unfortunately this means that it's necessary to change
assembly routines used to restore the image after it's been loaded from swap
so that they walk the list instead of walking the array.
This patch makes swsusp allocate only individual pages during resume. it
contains the necessary changes to the assembly routines etc. for i386 and
x86-64.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This is a megarollup of ~60 patches which give various things static scope.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This patch removes the redundant compiler barrier. As Linus ever said "The
mb() should make sure that gcc cannot move things around...".
Signed-off-by: Coywolf Qi Hunt <coywolf@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This is patch from Rafael, it eliminates order-5 (or worse) allocations
during suspend. I did few style/whitespace modifications. It was tested
by me, Rafael, and Stefan from SuSE.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This enables swsusp on SMP machines. It should be working in 2.6.10,
already (but you may need noapic in 2.6.10).
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This removes another O(n^2) algorithm from page relocation in swsusp.
Relocation took as long as reading pages from disk on my machine, and it
took minutes for some poor testers.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Here are some Kconfig fixes:
- typo fixes
- unused token removes (empty or duplicated 'help')
- non ASCII characters replaces
- e-mail address and URL format corrections
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This almost changes no code (constant is still "3"), but at least it uses
right constants for device_suspend() and fixes types at few points. Also
puts explanation of constants to the Documentation.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This adds few missing statics to swsusp.c, prints errors even when
non-debugging and fixes last "pmdisk: " message. Fixed few comments.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
During resume, my previous patch switches over to the saved swsusp image
without suspending all devices first. This patch fixes that oversight, so
that the state of the hardware upon resume more closely matches the state
it had at suspend time.
While my previous patch alone seemed to work fine in my testing, it is
not fully correct without this as well.
Signed-off-by: Barry K. Nathan <barryn@pobox.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Since at least kernel 2.6.9, if not earlier, swsusp fails to properly
suspend and resume all devices.
The most notable effect is that resuming fails to properly reconfigure
interrupt routers. In 2.6.9 this was obscured by other kernel code, but in
2.6.10 this often causes post-resume APIC errors and near-total failure of
some PCI devices (e.g. network, sound and USB controllers).
Even in cases where interrupt routing is unaffected, this bug causes other
problems. For instance, on one of my systems I have to run "ifdown
eth0;ifup eth0" after resume in order to have functional networking, if I
do not apply this patch.
By itself, this patch is not theoretically complete; my next patch fixes
that. However, this patch is the critical one for fixing swsusp's behavior
in the real world.
Signed-off-by: Barry K. Nathan <barryn@pobox.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
The attached patch fixes a number of problems in the VM routines:
(1) Some inline funcs don't compile if CONFIG_MMU is not set.
(2) swapper_pml4 needn't exist if CONFIG_MMU is not set.
(3) __free_pages_ok() doesn't counter set_page_refs() different behaviour if
CONFIG_MMU is not set.
(4) swsusp.c invokes TLB flushing functions without including the header file
that declares them.
CONFIG_SHMEM semantics:
- If MMU: Always enabled if !EMBEDDED
- If MMU && EMBEDDED: configurable
- If !MMU: disabled
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
The attached patch makes it possible to support gp-rel addressing for small
variables. Since the FR-V cpu's have fixed-length instructions and plenty of
general-purpose registers, one register is nominated as a base for the small
data area. This makes it possible to use single-insn accesses to access
global and static variables instead of having to use multiple instructions.
This, however, causes problems with small variables used to pinpoint the
beginning and end of sections. The compiler assumes it can use gp-rel
addressing for these, but the linker then complains because the displacement
is out of range.
By declaring certain variables as arrays or by forcing them into named
sections, the compiler is persuaded to access them as if they can be outside
the displacement range. Declaring the variables as "const void" type also
works.
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Some machines are spending minutes of CPU time during suspend in stupid O(n^2)
algorithm. This patch replaces it with O(n) algorithm, making swsusp usable
to some people.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This adds statics at few places and fixes stale references to pmdisk.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
swsusp contains few one-line helpers that only make reading/understanding code
more difficult. Also warn the user when something goes wrong, instead of
waking machine with corrupt data.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Variable used only for writing is bad idea.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
At few points we still reference to swsusp as "pmdisk"... it might confuse
someone not knowing full history.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This fixes types so that sparse has less stuff to complain about.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Fixes typo in header, please apply,
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This fixes confusing printk.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This fixes memory leak when we are low on memory during suspend. Ouch and
nr_needed_pages is only used twice, and only written :-(. I guess that can
wait for 2.6.10.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This prevents oops when not enough memory is available during resume.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Vadim says:
I was reading through the kernel/power/Kconfig file, and noticed that
the wording was slightly unclear. I poked at it a bit, hopefully making
the description a tad more straightforward, but you be the judge. :)
Diffed against 2.6.10-rc2.
From: Vadim Lobanov <vlobanov@speakeasy.net>
Signed-off-by: Vadim Lobanov <vlobanov@speakeasy.net>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This adds typechecking to suspend types and powerdown types. This should
solve at least part of suspend type confusion. There should be no code
changes generated by this one.
Acked-by: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
__handle_sysrq already prints a newline, so the action_msg string doesnt
need yet another newline.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This patch gives some clues to the user when swapping is not enabled during
swsusp. Please apply.
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Some small fixes for the SOFTWARE_SUSPEND help text.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
power_down may never ever fail, so it does not really need to return
anything. Kill obsolete code and fixup old comments.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
cutting back some unused legacy PM code
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This patch fixes all the preempt-after-task->state-is-TASK_DEAD problems we
had. Right now, the moment procfs does a down() that sleeps in
proc_pid_flush() [it could] our TASK_DEAD state is zapped and we might be
back to TASK_RUNNING to and we trigger this assert:
schedule();
BUG();
/* Avoid "noreturn function does return". */
for (;;) ;
I have split out TASK_ZOMBIE and TASK_DEAD into a separate p->exit_state
field, to allow the detaching of exit-signal/parent/wait-handling from
descheduling a dead task. Dead-task freeing is done via PF_DEAD.
Tested the patch on x86 SMP and UP, but all architectures should work
fine.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
swsusp currently has very poor progress indication. Thanks to Erik Rigtorp
<erik@rigtorp.com>, we have percentages there, so people know how long wait
to expect. Please apply,
From: Erik Rigtorp <erik@rigtorp.com>
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Fix warnings in kernel/power/console.c by only declaring orig_fgconsole
and orig_kmsg when required by SUSPEND_CONSOLE. Restore kmsg_redirect on
resume.
Signed-off-by: Ian Campbell <icampbell@arcom.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
From: Pavel Machek <pavel@ucw.cz>
This actually calls highmem_resume(), so swsusp has chance to work on
highmem machines. It also adds comments about code flow, which is quite
interesting at that point.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Changes the PM_SUSPEND_MEM (and PM_SUSPEND_DISK) enum values so that
they make sense as PCI device power states.
(a) Fixes bugs whereby PCI drivers are being given bogus values.
This should resolve OSDL bugid 2886 without changing the PCI
API (its PM calls still act as on 2.4 kernels).
(b) Doesn't change the awkward assumption in the 2.6 PMcore that
the /sys/bus/*/devices/power/state, /proc/acpi/sleep,
dev->power.power_state, and dev->detach_state files share
the same numeric codes ... even for busses very unlike PCI,
or systems with several "on" policies as well as STD and STR,
or with device-PM transtions with no system-wide equivalent.
Really we need to move away from "u32" codes that are easily confused
with each other, towards typed values (probably struct pointers), but
that's a long-term change and we need the PCI issue fixed sooner.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
|
|
From: Pavel Machek <pavel@ucw.cz>
If too much memory is free, swsusp dies in quite a ugly way. Even when it
is not neccessary to relocate pagedir, it is proably still neccessary to
relocate individual pages. Thanks to Kurt Garloff and Stefan Seyfried.
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
From: Pavel Machek <pavel@ucw.cz>
verify is not really descriptive name of function. Fortunately its insides
are self-documenting which makes it easy to fix.
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
From: Pavel Machek <pavel@ucw.cz>
Here are some small cleanups: whitespace fixes, added severity level,
shuffle messages and kill unneccessary strings, add some statics and fixed
misleading comments.
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
From: Pavel Machek <pavel@ucw.cz>
This checks error return from swsusp_alloc, preventing oops when memory can
not be allocated.
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
From: Pavel Machek <pavel@ucw.cz>
I'd like new swsusp to default to powerdown mode (as it did before) before
it goes up.
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
From: Pavel Machek <pavel@ucw.cz>
This is my fault from long time ago: copy_page can't be used for copying
task struct, therefore we can't use it in swsusp.
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
on disk
From: Pavel Machek <pavel@ucw.cz>
When image is already on the disk, returning back to user is dangerous.
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
into digitalimplant.org:/home/mochel/src/linux-2.6-power
|
|
This adds a new state TASK_TRACED that is used in place of TASK_STOPPED
when a thread stops because it is ptraced. Now ptrace operations are only
permitted when the target is in TASK_TRACED state, not in TASK_STOPPED.
This means that if a process is stopped normally by a job control signal
and then you PTRACE_ATTACH to it, you will have to send it a SIGCONT before
you can do any ptrace operations on it. (The SIGCONT will be reported to
ptrace and then you can discard it instead of passing it through when you
call PTRACE_CONT et al.)
If a traced child gets orphaned while in TASK_TRACED state, it morphs into
TASK_STOPPED state. This makes it again possible to resume or destroy the
process with SIGCONT or SIGKILL.
All non-signal tracing stops should now be done via ptrace_notify. I've
updated the syscall tracing code in several architectures to do this
instead of replicating the work by hand. I also fixed several that were
unnecessarily repeating some of the checks in ptrace_check_attach. Calling
ptrace_check_attach alone is sufficient, and the old checks repeated before
are now incorrect, not just superfluous.
I've closed a race in ptrace_check_attach. With this, we should have a
robust guarantee that when ptrace starts operating, the task will be in
TASK_TRACED state and won't come out of it. This is because the only way
to resume from TASK_TRACED is via ptrace operations, and only the one
parent thread attached as the tracer can do those.
This patch also cleans up the do_notify_parent and do_notify_parent_cldstop
code so that the dead and stopped cases are completely disjoint. The
notify_parent function is gone.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|