Hello all,
I encountered a problem while resuming from a suspend-to-disk. I'm using
the
2.6.1-rc2 kernel, running on an Athlon XP 2000.
>From a bash shell, I type:
echo 4 > /proc/acpi/sleep
and the system seems to suspend fine. When resuming, the bash seems to get
killed and I get the following output from dmesg (running from another shell):
<snipped dmesg output>
Stopping tasks: =====================|
Freeing memory: ....................|
hdc: start_power_step(step: 0)
hdc: completing PM request, suspend
hda: start_power_step(step: 0)
hda: completing PM request, suspend
resume= option should be used to set suspend device/critical section: Counting
pages to copy[nosave c035b000] (pages needed: 5362+512=5874 free: 174839)
Alloc pagedir
[nosave c035b000]<4>Freeing prev allocated pagedir
bad: scheduling while atomic!
Call Trace:
[<c0119d16>] schedule+0x586/0x590
[<c0124f5c>] __mod_timer+0xfc/0x170
[<c0125ab3>] schedule_timeout+0x63/0xc0
[<c0125a40>] process_timeout+0x0/0x10
[<c01da44b>] pci_set_power_state+0xeb/0x190
[<ec947823>] sis900_resume+0x63/0x130 [sis900]
[<c01dc9a6>] pci_device_resume+0x26/0x30
[<c021edb9>] resume_device+0x29/0x30
[<c021edf4>] dpm_resume+0x34/0x60
[<c021ee39>] device_resume+0x19/0x30
[<c013625c>] drivers_resume+0x3c/0x40
[<c013652d>] do_magic_resume_2+0x5d/0xe0
[<c0136546>] do_magic_resume_2+0x76/0xe0
[<c02653af>] do_magic+0x11f/0x130
[<c013676c>] do_software_suspend+0x6c/0x90
[<c01f67bb>] acpi_system_write_sleep+0xab/0xc9
[<c015470e>] vfs_write+0xbe/0x130
[<c0154832>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
eth0: Media Link Off
hda: Wakeup request inited, waiting for !BSY...
hda: start_power_step(step: 1000)
blk: queue ebd77a00, I/O limit 4095Mb (mask 0xffffffff)
hda: completing PM request, resume
hdc: Wakeup request inited, waiting for !BSY...
hdc: start_power_step(step: 1000)
hdc: completing PM request, resume
Fixing swap signatures... <3>bad: scheduling while atomic!
Call Trace:
[<c0119d16>] schedule+0x586/0x590
[<c023486d>] do_ide_request+0x1d/0x30
[<c0220ff7>] generic_unplug_device+0x77/0x80
[<c022119b>] blk_run_queues+0xab/0xc0
[<c011ac5e>] io_schedule+0xe/0x20
[<c0138721>] wait_on_page_bit+0xb1/0xe0
[<c011b490>] autoremove_wake_function+0x0/0x50
[<c011b490>] autoremove_wake_function+0x0/0x50
[<c014f41b>] swap_readpage+0x5b/0x90
[<c014f511>] rw_swap_page_sync+0xc1/0x100
[<c013595c>] mark_swapfiles+0x7c/0x1b0
[<c0136566>] do_magic_resume_2+0x96/0xe0
[<c02653af>] do_magic+0x11f/0x130
[<c013676c>] do_software_suspend+0x6c/0x90
[<c01f67bb>] acpi_system_write_sleep+0xab/0xc9
[<c015470e>] vfs_write+0xbe/0x130
[<c0154832>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
bad: scheduling while atomic!
Call Trace:
[<c0119d16>] schedule+0x586/0x590
[<c023486d>] do_ide_request+0x1d/0x30
[<c0220ff7>] generic_unplug_device+0x77/0x80
[<c022116f>] blk_run_queues+0x7f/0xc0
[<c011ac5e>] io_schedule+0xe/0x20
[<c0138721>] wait_on_page_bit+0xb1/0xe0
[<c011b490>] autoremove_wake_function+0x0/0x50
[<c011b490>] autoremove_wake_function+0x0/0x50
[<c014f389>] swap_writepage+0x99/0xd0
[<c014f511>] rw_swap_page_sync+0xc1/0x100
[<c01359cf>] mark_swapfiles+0xef/0x1b0
[<c0136566>] do_magic_resume_2+0x96/0xe0
[<c02653af>] do_magic+0x11f/0x130
[<c013676c>] do_software_suspend+0x6c/0x90
[<c01f67bb>] acpi_system_write_sleep+0xab/0xc9
[<c015470e>] vfs_write+0xbe/0x130
[<c0154832>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
ok
Restarting tasks...<3>bad: scheduling while atomic!
Call Trace:
[<c0119d16>] schedule+0x586/0x590
[<c0118efe>] try_to_wake_up+0x9e/0x160
[<c0118fde>] wake_up_process+0x1e/0x20
[<c01353d8>] thaw_processes+0xb8/0x100
[<c013675e>] do_software_suspend+0x5e/0x90
[<c01f67bb>] acpi_system_write_sleep+0xab/0xc9
[<c015470e>] vfs_write+0xbe/0x130
[<c0154832>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
done
bad: scheduling while atomic!
Call Trace:
[<c0119d16>] schedule+0x586/0x590
[<c0154832>] sys_write+0x42/0x70
[<c01094c2>] work_resched+0x5/0x16
bad: scheduling while atomic!
Call Trace:
[<c0119d16>] schedule+0x586/0x590
[<c01187d6>] fixup_exception+0x16/0x40
[<c0117b8e>] __is_prefetch+0x6e/0x220
[<c0117e50>] do_page_fault+0x110/0x512
[<c011abc7>] sys_sched_yield+0x87/0xd0
[<c0160c48>] coredump_wait+0x38/0xa0
[<c0160d9b>] do_coredump+0xeb/0x1ec
[<c0118ffa>] wake_up_state+0x1a/0x20
[<c0126e04>] specific_send_sig_info+0xc4/0x130
[<c0126818>] __dequeue_signal+0xe8/0x190
[<c01268f5>] dequeue_signal+0x35/0xa0
[<c0128dca>] get_signal_to_deliver+0x20a/0x380
[<c0109272>] do_signal+0xe2/0x120
[<c0118d50>] recalc_task_prio+0x90/0x1a0
[<c0119ac4>] schedule+0x334/0x590
[<c0117d40>] do_page_fault+0x0/0x512
[<c0109309>] do_notify_resume+0x59/0x5c
[<c01094e6>] work_notifysig+0x13/0x15
note: bash[3501] exited with preempt_count 1
eth0: Abnormal interrupt,status 0x03008200.
<end of snipped dmesg output>
Does anyone have a clue of what's going on? I have been experiencing the
same problem since early 2.6.0, also with Andrew Morton's patchset.
The problem does not show up when kernel preemption is turned off.
Please CC any answer since I'm not subscribed to the list.
TIA
Mauro Andreolini
__________________________________________________________________
Tiscali ADSL SENZA CANONE:
Attivazione GRATIS, contributo adesione GRATIS, modem GRATIS,
50 ore di navigazione GRATIS. ABBONARTI TI COSTA SOLO UN CLICK!
http://point.tiscali.it/adsl/index.shtml
Hi!
> I encountered a problem while resuming from a suspend-to-disk. I'm using
> the
> 2.6.1-rc2 kernel, running on an Athlon XP 2000.
> >From a bash shell, I type:
SiS900 driver needs to be fixed. Or perhaps... try following patch.
> echo 4 > /proc/acpi/sleep
>
> and the system seems to suspend fine. When resuming, the bash seems to get
> killed and I get the following output from dmesg (running from another shell):
>
> <snipped dmesg output>
> Stopping tasks: =====================|
> Freeing memory: ....................|
> hdc: start_power_step(step: 0)
> hdc: completing PM request, suspend
> hda: start_power_step(step: 0)
> hda: completing PM request, suspend
> resume= option should be used to set suspend device/critical section: Counting
> pages to copy[nosave c035b000] (pages needed: 5362+512=5874 free: 174839)
> Alloc pagedir
> [nosave c035b000]<4>Freeing prev allocated pagedir
> bad: scheduling while atomic!
> Call Trace:
> [<c0119d16>] schedule+0x586/0x590
> [<c0124f5c>] __mod_timer+0xfc/0x170
> [<c0125ab3>] schedule_timeout+0x63/0xc0
> [<c0125a40>] process_timeout+0x0/0x10
> [<c01da44b>] pci_set_power_state+0xeb/0x190
> [<ec947823>] sis900_resume+0x63/0x130 [sis900]
> [<c01dc9a6>] pci_device_resume+0x26/0x30
%patch
Index: linux/Documentation/power/swsusp.txt
===================================================================
--- linux.orig/Documentation/power/swsusp.txt 2004-01-09 20:19:41.000000000 +0100
+++ linux/Documentation/power/swsusp.txt 2004-01-09 20:33:05.000000000 +0100
@@ -17,13 +17,30 @@
You need to append resume=/dev/your_swap_partition to kernel command
line. Then you suspend by echo 4 > /proc/acpi/sleep.
-[Notice. Rest docs is pretty outdated (see date!) It should be safe to
-use swsusp on ext3/reiserfs these days.]
+Pavel's unreliable guide to swsusp mess
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+There are currently two versions of swap suspend in the kernel, the old
+"Pavel's" version in kernel/power/swsusp.c and the new "Patrick's"
+version in kernel/power/pmdisk.c. They provide the same functionality;
+the old version looks ugly but was tested, while the new version looks
+nicer but did not receive so much testing. echo 4 > /proc/acpi/sleep
+calls the old version, echo disk > /sys/power/state calls the new one.
+
+[In the future, when the new version is stable enough, two things can
+happen:
+
+* the new version is moved into swsusp.c, and swsusp is renamed to swap
+ suspend (Pavel prefers this)
+
+* pmdisk is kept as is and swsusp.c is removed from the kernel]
+
Article about goals and implementation of Software Suspend for Linux
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Author: G?bor Kuti
-Last revised: 2002-04-08
+Last revised: 2003-10-20 by Pavel Machek
Idea and goals to achieve
@@ -36,84 +53,23 @@
interrupt our programs so processes that are calculating something for a long
time shouldn't need to be written interruptible.
-On desk machines the power saving function isn't as important as it is in
-laptops but we really may benefit from the second one. Nowadays the number of
-desk machines supporting suspend function in their APM is going up but there
-are (and there will still be for a long time) machines that don't even support
-APM of any kind. On the other hand it is reported that using APM's suspend
-some irqs (e.g. ATA disk irq) is lost and it is annoying for the user until
-the Linux kernel resets the device.
-
-So I started thinking about implementing Software Suspend which doesn't need
-any APM support and - since it uses pretty near only high-level routines - is
-supposed to be architecture independent code.
-
Using the code
-The code is experimental right now - testers, extra eyes are welcome. To
-compile this support into the kernel, you need CONFIG_EXPERIMENTAL,
-and then CONFIG_SOFTWARE_SUSPEND in menu General Setup to be enabled. It
-cannot be used as a module and I don't think it will ever be needed.
-
-You have two ways to use this code. The first one is if you've compiled in
-sysrq support then you may press Sysrq-D to request suspend. The other way
-is with a patched SysVinit (my patch is against 2.76 and available at my
-home page). You might call 'swsusp' or 'shutdown -z <time>'. Next way is to
-echo 4 > /proc/acpi/sleep.
+You have two ways to use this code. The first one is is with a patched
+SysVinit (my patch is against 2.76 and available at my home page). You
+might call 'swsusp' or 'shutdown -z <time>'. Next way is to echo 4 >
+/proc/acpi/sleep.
Either way it saves the state of the machine into active swaps and then
reboots. You must explicitly specify the swap partition to resume from with
``resume='' kernel option. If signature is found it loads and restores saved
state. If the option ``noresume'' is specified as a boot parameter, it skips
-the resuming. Warning! Look at section ``Things to implement'' to see what
-isn't yet implemented. Also I strongly suggest you to list all active swaps
-in /etc/fstab. Firstly because you don't have to specify anything to resume
-and secondly if you have more than one swap area you can't decide which one
-has the 'root' signature.
+the resuming.
In the meantime while the system is suspended you should not touch any of the
hardware!
About the code
-Goals reached
-
-The code can be downloaded from
-http://falcon.sch.bme.hu/~seasons/linux/. It mainly works but there are still
-some of XXXs, TODOs, FIXMEs in the code which seem not to be too important. It
-should work all right except for the problems listed in ``Things to
-implement''. Notes about the code are really welcome.
-
-How the code works
-
-When suspending is triggered it immediately wakes up process bdflush. Bdflush
-checks whether we have anything in our run queue tq_bdflush. Since we queued up
-function do_software_suspend, it is called. Here we shrink everything including
-dcache, inodes, buffers and memory (here mainly processes are swapped out). We
-count how many pages we need to duplicate (we have to be atomical!) then we
-create an appropriate sized page directory. It will point to the original and
-the new (copied) address of the page. We get the free pages by
-__get_free_pages() but since it changes state we have to be able to track it
-later so it also flips in a bit in page's flags (a new Nosave flag). We
-duplicate pages and then mark them as used (so atomicity is ensured). After
-this we write out the image to swaps, do another sync and the machine may
-reboot. We also save registers to stack.
-
-By resuming an ``inverse'' method is executed. The image if exists is loaded,
-loadling is either triggered by ``resume='' kernel option. We
-change our task to bdflush (it is needed because if we don't do this init does
-an oops when it is waken up later) and then pages are copied back to their
-original location. We restore registers, free previously allocated memory,
-activate memory context and task information. Here we should restore hardware
-state but even without this the machine is restored and processes are continued
-to work. I think hardware state should be restored by some list (using
-notify_chain) and probably by some userland program (run-parts?) for users'
-pleasure. Check out my patch at the same location for the sysvinit patch.
-
-WARNINGS!
-- It does not like pcmcia cards. And this is logical: pcmcia cards need
- cardmgr to be initialized. they are not initialized during singleuser boot,
- but "resumed" kernel does expect them to be initialized. That leads to
- armagedon. You should eject any pcmcia cards before suspending.
Things to implement
- SMP support. I've done an SMP support but since I don't have access to a kind
@@ -122,34 +78,14 @@
interrupts AFAIK..
- We should only make a copy of data related to kernel segment, since any
process data won't be changed.
-- Hardware state restoring. Now there's support for notifying via the notify
- chain, event handlers are welcome. Some devices may have microcodes loaded
- into them. We should have event handlers for them as well.
-- We should support other architectures (There are really only some arch
- related functions..)
-- We should also restore original state of swaps if the ``noresume'' kernel
- option is specified.. Or do we need such a feature to save state for some
- other time? Do we need some kind of ``several saved states''? (Linux-HA
- people?). There's been some discussion about checkpointing on linux-future.
- Should make more sanity checks. Or are these enough?
Not so important ideas for implementing
- If a real time process is running then don't suspend the machine.
-- Support for power.conf file as in Solaris, autoshutdown, special
- devicetypes support, maybe in sysctl.
-- Introduce timeout for SMP locking. But first locking ought to work :O
-- Pre-detect if we don't have enough swap space or free it instead of
- calling panic.
- Support for adding/removing hardware while suspended?
- We should not free pages at the beginning so aggressively, most of them
go there anyway..
-- If X is active while suspending then by resuming calling svgatextmode
- corrupts the virtual console of X.. (Maybe this has been fixed AFAIK).
-
-Drivers we support
-- IDE disks are okay
-- vesafb
Drivers that need support
- pc_keyb -- perhaps we can wait for vojtech's input patches
Index: linux/Documentation/power/video.txt
===================================================================
--- linux.orig/Documentation/power/video.txt 2004-01-09 20:33:05.000000000 +0100
+++ linux/Documentation/power/video.txt 2004-01-09 20:33:05.000000000 +0100
@@ -0,0 +1,36 @@
+
+ Video issues with S3 resume
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 2003, Pavel Machek
+
+During S3 resume, hardware needs to be reinitialized. For most
+devices, this is easy, and kernel driver knows how to do
+it. Unfortunately there's one exception: video card. Those are usually
+initialized by BIOS, and kernel does not have enough information to
+boot video card. (Kernel usually does not even contain video card
+driver -- vesafb and vgacon are widely used).
+
+This is not problem for swsusp, because during swsusp resume, BIOS is
+run normally so video card is normally initialized.
+
+There are three types of systems where video works after S3 resume:
+
+* systems where video state is preserved over S3. (HP Omnibook xe3)
+
+* systems that initialize video card into vga text mode and where BIOS
+ works well enough to be able to set video mode. Use
+ acpi_sleep=s3_mode on these. (Toshiba 4030cdt)
+
+* systems where it is possible to call video bios during S3
+ resume. Unfortunately, it is not correct to call video BIOS at that
+ point, but it happens to work on some machines. Use
+ acpi_sleep=s3_bios (Athlon64 desktop system)
+
+Now, if you pass acpi_sleep=something, and it does not work with your
+bios, you'll get hard crash during resume. Be carefull.
+
+You may have system where none of above works. At that point you
+either invent another ugly hack that works, or write proper driver for
+your video card (good luck getting docs :-(). Maybe suspending from X
+(proper X, knowing your hardware, not XF68_FBcon) might have better
+chance of working.
Index: linux/arch/i386/kernel/acpi/wakeup.S
===================================================================
--- linux.orig/arch/i386/kernel/acpi/wakeup.S 2004-01-09 20:19:41.000000000 +0100
+++ linux/arch/i386/kernel/acpi/wakeup.S 2004-01-09 20:33:05.000000000 +0100
@@ -193,11 +193,6 @@
# and restore the stack ... but you need gdt for this to work
movl saved_context_esp, %esp
- movw $0x0e00 + 'W', 0xb8018
- outl %eax, $0x80
- outl %eax, $0x80
- movw $0x0e00 + 'O', 0xb8018
-
movl %cs:saved_magic, %eax
cmpl $0x12345678, %eax
jne bogus_magic
@@ -205,9 +200,6 @@
# jump to place where we left off
movl saved_eip,%eax
movw $0x0e00 + 'x', 0xb8018
- outl %eax, $0x80
- outl %eax, $0x80
- movw $0x0e00 + '!', 0xb801a
jmp *%eax
bogus_magic:
Index: linux/arch/i386/kernel/cpu/mtrr/main.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/mtrr/main.c 2004-01-09 20:19:41.000000000 +0100
+++ linux/arch/i386/kernel/cpu/mtrr/main.c 2004-01-09 20:33:05.000000000 +0100
@@ -588,6 +588,7 @@
{
int i;
+#if 0
for (i = 0; i < num_var_ranges; i++) {
if (mtrr_state[i].lsize)
set_mtrr(i,
@@ -596,6 +597,8 @@
mtrr_state[i].ltype);
}
kfree(mtrr_state);
+#endif
+
return 0;
}
Index: linux/arch/i386/kernel/time.c
===================================================================
--- linux.orig/arch/i386/kernel/time.c 2004-01-09 20:26:08.000000000 +0100
+++ linux/arch/i386/kernel/time.c 2004-01-11 12:12:48.000000000 +0100
@@ -307,7 +307,31 @@
return retval;
}
+static long clock_cmos_diff;
+
+static int pit_suspend(struct sys_device *dev, u32 state)
+{
+ /*
+ * Estimate time zone so that set_time can update the clock
+ */
+ clock_cmos_diff = -get_cmos_time();
+ clock_cmos_diff += get_seconds();
+ return 0;
+}
+
+static int pit_resume(struct sys_device *dev)
+{
+ unsigned long sec = get_cmos_time() + clock_cmos_diff;
+ write_seqlock_irq(&xtime_lock);
+ xtime.tv_sec = sec;
+ xtime.tv_nsec = 0;
+ write_sequnlock_irq(&xtime_lock);
+ return 0;
+}
+
static struct sysdev_class pit_sysclass = {
+ .resume = pit_resume,
+ .suspend = pit_suspend,
set_kset_name("pit"),
};
Index: linux/arch/x86_64/kernel/time.c
===================================================================
--- linux.orig/arch/x86_64/kernel/time.c 2004-01-09 20:26:10.000000000 +0100
+++ linux/arch/x86_64/kernel/time.c 2004-01-09 20:33:05.000000000 +0100
@@ -22,7 +22,7 @@
#include <linux/time.h>
#include <linux/ioport.h>
#include <linux/module.h>
-#include <linux/device.h>
+#include <linux/sysdev.h>
#include <linux/bcd.h>
#include <asm/pgtable.h>
#include <asm/vsyscall.h>
@@ -75,7 +75,7 @@
* timer interrupt has happened already, but vxtime.trigger wasn't updated yet.
* This is not a problem, because jiffies hasn't updated either. They are bound
* together by xtime_lock.
- */
+ */
static inline unsigned int do_gettimeoffset_tsc(void)
{
@@ -642,7 +642,17 @@
return 0;
}
-void __init pit_init(void)
+static struct sysdev_class rtc_sysclass = {
+ set_kset_name("rtc"),
+};
+
+/* XXX this driverfs stuff should probably go elsewhere later -john */
+static struct sys_device device_i8253 = {
+ .id = 0,
+ .cls = &rtc_sysclass,
+};
+
+int __init pit_init(void)
{
unsigned long flags;
@@ -651,8 +661,20 @@
outb_p(LATCH & 0xff, 0x40); /* LSB */
outb_p(LATCH >> 8, 0x40); /* MSB */
spin_unlock_irqrestore(&i8253_lock, flags);
+
+ return 0;
}
+static int pit_devicefs_init(void)
+{
+ int error = sysdev_class_register(&rtc_sysclass);
+ if (!error)
+ error = sys_device_register(&device_i8253);
+ return error;
+}
+
+late_initcall(pit_devicefs_init);
+
int __init time_setup(char *str)
{
report_lost_ticks = 1;
@@ -694,8 +716,8 @@
cpu_khz = hpet_calibrate_tsc();
timename = "HPET";
} else {
- pit_init();
- cpu_khz = pit_calibrate_tsc();
+ pit_init();
+ cpu_khz = pit_calibrate_tsc();
timename = "PIT";
}
Index: linux/drivers/acpi/thermal.c
===================================================================
--- linux.orig/drivers/acpi/thermal.c 2004-01-09 20:19:41.000000000 +0100
+++ linux/drivers/acpi/thermal.c 2004-01-09 20:33:05.000000000 +0100
@@ -223,8 +223,11 @@
tz->last_temperature = tz->temperature;
status = acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature);
- if (ACPI_FAILURE(status))
+ if (ACPI_FAILURE(status)) {
+ if (tz->temperature != tz->last_temperature)
+ printk(KERN_ERR "temperature damaged while processing\n");
return -ENODEV;
+ }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", tz->temperature));
@@ -456,6 +459,10 @@
if (!tz || !tz->trips.critical.flags.valid)
return_VALUE(-EINVAL);
+ if (KELVIN_TO_CELSIUS(tz->temperature) >= 200) {
+ printk(KERN_ALERT "Are you running CPU or nuclear power plant? ACPI claims CPU temp is %ld C. Ignoring.\n", KELVIN_TO_CELSIUS(tz->temperature));
+ return_VALUE(0);
+ }
if (tz->temperature >= tz->trips.critical.temperature) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n"));
tz->trips.critical.flags.enabled = 1;
@@ -467,6 +474,7 @@
if (result)
return_VALUE(result);
+ printk(KERN_EMERG "Critical temperature reached (%ld C), shutting down.\n", KELVIN_TO_CELSIUS(tz->temperature));
acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, tz->trips.critical.flags.enabled);
acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
Index: linux/drivers/input/power.c
===================================================================
--- linux.orig/drivers/input/power.c 2004-01-09 20:19:41.000000000 +0100
+++ linux/drivers/input/power.c 2004-01-09 20:33:05.000000000 +0100
@@ -72,6 +72,18 @@
break;
case KEY_POWER:
/* Hum power down the machine. */
+ {
+ char *argv[2] = {NULL, NULL};
+ char *envp[3] = {NULL, NULL, NULL};
+
+ argv[0] = "/sbin/poweroff";
+
+ /* minimal command environment */
+ envp[0] = "HOME=/";
+ envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+
+ call_usermodehelper(argv[0], argv, envp, 0);
+ }
break;
default:
return;
Index: linux/drivers/scsi/libata-core.c
===================================================================
--- linux.orig/drivers/scsi/libata-core.c 2004-01-09 20:26:14.000000000 +0100
+++ linux/drivers/scsi/libata-core.c 2004-01-09 20:33:05.000000000 +0100
@@ -34,6 +34,7 @@
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
+#include <linux/suspend.h>
#include <scsi/scsi.h>
#include "scsi.h"
#include "hosts.h"
@@ -2564,6 +2565,8 @@
while (1) {
cond_resched();
+ if (current->flags & PF_FREEZE)
+ refrigerator(PF_IOTHREAD);
timeout = ata_thread_iter(ap);
Index: linux/include/linux/suspend.h
===================================================================
--- linux.orig/include/linux/suspend.h 2004-01-09 20:19:41.000000000 +0100
+++ linux/include/linux/suspend.h 2004-01-09 20:33:05.000000000 +0100
@@ -24,7 +24,7 @@
#define SWAP_FILENAME_MAXLENGTH 32
struct suspend_header {
- __u32 version_code;
+ u32 version_code;
unsigned long num_physpages;
char machine[8];
char version[20];
@@ -32,9 +32,6 @@
int page_size;
suspend_pagedir_t *suspend_pagedir;
unsigned int num_pbes;
- struct swap_location {
- char filename[SWAP_FILENAME_MAXLENGTH];
- } swap_location[MAX_SWAPFILES];
};
#define SUSPEND_PD_PAGES(x) (((x)*sizeof(struct pbe))/PAGE_SIZE+1)
@@ -45,31 +42,43 @@
/* mm/page_alloc.c */
extern void drain_local_pages(void);
+/* kernel/power/swsusp.c */
+extern int software_suspend(void);
+
extern unsigned int nr_copy_pages __nosavedata;
extern suspend_pagedir_t *pagedir_nosave __nosavedata;
-#endif /* CONFIG_PM */
-
-#ifdef CONFIG_SOFTWARE_SUSPEND
-
-extern unsigned char software_suspend_enabled;
-extern void software_suspend(void);
#else /* CONFIG_SOFTWARE_SUSPEND */
-static inline void software_suspend(void)
+static inline int software_suspend(void)
{
printk("Warning: fake suspend called\n");
+ return -EPERM;
}
+#define software_resume() do { } while(0)
#endif /* CONFIG_SOFTWARE_SUSPEND */
#ifdef CONFIG_PM
extern void refrigerator(unsigned long);
+extern int freeze_processes(void);
+extern void thaw_processes(void);
+
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
#else
static inline void refrigerator(unsigned long flag)
{
}
+static inline int freeze_processes(void)
+{
+ return 0;
+}
+static inline void thaw_processes(void)
+{
+
+}
#endif /* CONFIG_PM */
#endif /* _LINUX_SWSUSP_H */
Index: linux/kernel/power/process.c
===================================================================
--- linux.orig/kernel/power/process.c 2004-01-09 20:19:41.000000000 +0100
+++ linux/kernel/power/process.c 2004-01-09 20:33:05.000000000 +0100
@@ -49,10 +49,11 @@
pr_debug("%s entered refrigerator\n", current->comm);
printk("=");
current->flags &= ~PF_FREEZE;
- if (flag)
- flush_signals(current); /* We have signaled a kernel thread, which isn't normal behaviour
- and that may lead to 100%CPU sucking because those threads
- just don't manage signals. */
+
+ spin_lock_irq(¤t->sighand->siglock);
+ recalc_sigpending(); /* We sent fake signal, clean it up */
+ spin_unlock_irq(¤t->sighand->siglock);
+
current->flags |= PF_FROZEN;
while (current->flags & PF_FROZEN)
schedule();
Index: linux/kernel/power/swsusp.c
===================================================================
--- linux.orig/kernel/power/swsusp.c 2004-01-09 20:26:18.000000000 +0100
+++ linux/kernel/power/swsusp.c 2004-01-09 20:33:05.000000000 +0100
@@ -227,6 +227,7 @@
static void read_swapfiles(void) /* This is called before saving image */
{
int i, len;
+ char buff[sizeof(resume_file)], *sname;
len=strlen(resume_file);
root_swap = 0xFFFF;
@@ -245,8 +246,11 @@
swapfile_used[i] = SWAPFILE_IGNORED;
} else {
/* we ignore all swap devices that are not the resume_file */
- if (1) {
-// FIXME if(resume_device == swap_info[i].swap_device) {
+ sname = d_path(swap_info[i].swap_file->f_dentry,
+ swap_info[i].swap_file->f_vfsmnt,
+ buff,
+ sizeof(buff));
+ if (!strcmp(sname, resume_file)) {
swapfile_used[i] = SWAPFILE_SUSPEND;
root_swap = i;
} else {
@@ -283,8 +287,8 @@
* would happen on next reboot -- corrupting data.
*
* Note: The buffer we allocate to use to write the suspend header is
- * not freed; its not needed since system is going down anyway
- * (plus it causes oops and I'm lazy^H^H^H^Htoo busy).
+ * not freed; its not needed since the system is going down anyway
+ * (plus it causes an oops and I'm lazy^H^H^H^Htoo busy).
*/
static int write_suspend_image(void)
{
@@ -340,14 +344,14 @@
printk("H");
BUG_ON (sizeof(struct suspend_header) > PAGE_SIZE-sizeof(swp_entry_t));
BUG_ON (sizeof(union diskpage) != PAGE_SIZE);
+ BUG_ON (sizeof(struct link) != PAGE_SIZE);
if (!(entry = get_swap_page()).val)
panic( "\nNot enough swapspace when writing header" );
if (swapfile_used[swp_type(entry)] != SWAPFILE_SUSPEND)
panic("\nNot enough swapspace for header on suspend device" );
cur = (void *) buffer;
- if (fill_suspend_header(&cur->sh))
- panic("\nOut of memory while writing header");
+ BUG_ON (fill_suspend_header(&cur->sh));
cur->link.next = prev;
@@ -488,33 +492,6 @@
printk("|\n");
}
-/* Make disk drivers accept operations, again */
-static void drivers_unsuspend(void)
-{
- device_resume();
-}
-
-/* Called from process context */
-static int drivers_suspend(void)
-{
- return device_suspend(4);
-}
-
-#define RESUME_PHASE1 1 /* Called from interrupts disabled */
-#define RESUME_PHASE2 2 /* Called with interrupts enabled */
-#define RESUME_ALL_PHASES (RESUME_PHASE1 | RESUME_PHASE2)
-static void drivers_resume(int flags)
-{
- if (flags & RESUME_PHASE1) {
- device_resume();
- }
- if (flags & RESUME_PHASE2) {
-#ifdef SUSPEND_CONSOLE
- update_screen(fg_console); /* Hmm, is this the problem? */
-#endif
- }
-}
-
static int suspend_prepare_image(void)
{
struct sysinfo i;
@@ -569,7 +546,7 @@
static void suspend_save_image(void)
{
- drivers_unsuspend();
+ device_resume();
lock_swapdevices();
write_suspend_image();
@@ -615,6 +592,7 @@
mb();
spin_lock_irq(&suspend_pagedir_lock); /* Done to disable interrupts */
+ device_power_down(4);
PRINTK( "Waiting for DMAs to settle down...\n");
mdelay(1000); /* We do not want some readahead with DMA to corrupt our memory, right?
Do it with disabled interrupts for best effect. That way, if some
@@ -630,8 +608,10 @@
PRINTK( "Freeing prev allocated pagedir\n" );
free_suspend_pagedir((unsigned long) pagedir_save);
+ device_power_up();
spin_unlock_irq(&suspend_pagedir_lock);
- drivers_resume(RESUME_ALL_PHASES);
+ device_resume();
+ update_screen(fg_console); /* Hmm, is this the problem? */
PRINTK( "Fixing swap signatures... " );
mark_swapfiles(((swp_entry_t) {0}), MARK_SWAP_RESUME);
@@ -672,7 +652,9 @@
{
int is_problem;
read_swapfiles();
+ device_power_down(4);
is_problem = suspend_prepare_image();
+ device_power_up();
spin_unlock_irq(&suspend_pagedir_lock);
if (!is_problem) {
kernel_fpu_end(); /* save_processor_state() does kernel_fpu_begin, and we need to revert it in order to pass in_atomic() checks */
@@ -694,11 +676,22 @@
mark_swapfiles(((swp_entry_t) {0}), MARK_SWAP_RESUME);
}
-static void do_software_suspend(void)
+/*
+ * This is main interface to the outside world. It needs to be
+ * called from process context.
+ */
+int software_suspend(void)
{
+ int res;
+ if (!software_suspend_enabled)
+ return -EAGAIN;
+
+ software_suspend_enabled = 0;
+ might_sleep();
+
if (arch_prepare_suspend()) {
printk("%sArchitecture failed to prepare\n", name_suspend);
- return;
+ return -EPERM;
}
if (pm_prepare_console())
printk( "%sCan't allocate a console... proceeding\n", name_suspend);
@@ -716,7 +709,7 @@
blk_run_queues();
/* Save state of all device drivers, and stop them. */
- if(drivers_suspend()==0)
+ if ((res = device_suspend(4))==0)
/* If stopping device drivers worked, we proceed basically into
* suspend_save_image.
*
@@ -728,24 +721,12 @@
*/
do_magic(0);
thaw_processes();
- }
+ } else
+ res = -EBUSY;
software_suspend_enabled = 1;
MDELAY(1000);
pm_restore_console();
-}
-
-/*
- * This is main interface to the outside world. It needs to be
- * called from process context.
- */
-void software_suspend(void)
-{
- if(!software_suspend_enabled)
- return;
-
- software_suspend_enabled = 0;
- might_sleep();
- do_software_suspend();
+ return res;
}
/* More restore stuff */
@@ -856,23 +837,23 @@
static int sanity_check_failed(char *reason)
{
- printk(KERN_ERR "%s%s\n",name_resume,reason);
+ printk(KERN_ERR "%s%s\n", name_resume, reason);
return -EPERM;
}
static int sanity_check(struct suspend_header *sh)
{
- if(sh->version_code != LINUX_VERSION_CODE)
+ if (sh->version_code != LINUX_VERSION_CODE)
return sanity_check_failed("Incorrect kernel version");
- if(sh->num_physpages != num_physpages)
+ if (sh->num_physpages != num_physpages)
return sanity_check_failed("Incorrect memory size");
- if(strncmp(sh->machine, system_utsname.machine, 8))
+ if (strncmp(sh->machine, system_utsname.machine, 8))
return sanity_check_failed("Incorrect machine type");
- if(strncmp(sh->version, system_utsname.version, 20))
+ if (strncmp(sh->version, system_utsname.version, 20))
return sanity_check_failed("Incorrect version");
- if(sh->num_cpus != num_online_cpus())
+ if (sh->num_cpus != num_online_cpus())
return sanity_check_failed("Incorrect number of cpus");
- if(sh->page_size != PAGE_SIZE)
+ if (sh->page_size != PAGE_SIZE)
return sanity_check_failed("Incorrect PAGE_SIZE");
return 0;
}
@@ -915,7 +896,7 @@
extern dev_t __init name_to_dev_t(const char *line);
-static int __read_suspend_image(struct block_device *bdev, union diskpage *cur, int noresume)
+static int __init __read_suspend_image(struct block_device *bdev, union diskpage *cur, int noresume)
{
swp_entry_t next;
int i, nr_pgdir_pages;
@@ -1091,6 +1072,7 @@
printk( "resuming from %s\n", resume_file);
if (read_suspend_image(resume_file, 0))
goto read_failure;
+ device_suspend(4);
do_magic(1);
panic("This never returns");
Index: linux/kernel/sys.c
===================================================================
--- linux.orig/kernel/sys.c 2004-01-09 20:26:18.000000000 +0100
+++ linux/kernel/sys.c 2004-01-09 20:33:05.000000000 +0100
@@ -472,13 +472,11 @@
#ifdef CONFIG_SOFTWARE_SUSPEND
case LINUX_REBOOT_CMD_SW_SUSPEND:
- if (!software_suspend_enabled) {
+ {
+ int ret = software_suspend();
unlock_kernel();
- return -EAGAIN;
+ return ret;
}
- software_suspend();
- do_exit(0);
- break;
#endif
default:
%diffstat
Documentation/power/swsusp.txt | 104 +++++++++------------------------------
Documentation/power/video.txt | 36 +++++++++++++
arch/i386/kernel/acpi/wakeup.S | 8 ---
arch/i386/kernel/cpu/mtrr/main.c | 3 +
arch/i386/kernel/time.c | 24 +++++++++
arch/x86_64/kernel/time.c | 32 ++++++++++--
drivers/acpi/thermal.c | 10 +++
drivers/input/power.c | 12 ++++
drivers/scsi/libata-core.c | 3 +
include/linux/suspend.h | 31 +++++++----
kernel/power/process.c | 9 +--
kernel/power/swsusp.c | 104 ++++++++++++++++-----------------------
kernel/sys.c | 8 +--
13 files changed, 210 insertions(+), 174 deletions(-)
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
On Tue, Jan 13, 2004 at 02:18:06PM +0100, Pavel Machek wrote:
> Hi!
>
> > I encountered a problem while resuming from a suspend-to-disk. I'm using
> > the
> > 2.6.1-rc2 kernel, running on an Athlon XP 2000.
> > >From a bash shell, I type:
>
> SiS900 driver needs to be fixed. Or perhaps... try following patch.
I added support for sis900 and the bash was being killed even before the
driver had any support for suspend/resume.
I reported that same problem (shell being killed) some time ago, there was
some follow up, but if I remember right no solution was found at the
time.
> > bad: scheduling while atomic!
> > Call Trace:
> > [<c0119d16>] schedule+0x586/0x590
> > [<c0124f5c>] __mod_timer+0xfc/0x170
> > [<c0125ab3>] schedule_timeout+0x63/0xc0
> > [<c0125a40>] process_timeout+0x0/0x10
> > [<c01da44b>] pci_set_power_state+0xeb/0x190
> > [<ec947823>] sis900_resume+0x63/0x130 [sis900]
> > [<c01dc9a6>] pci_device_resume+0x26/0x30
I'll check this, the card keeps working after resume or not ?
Thanks, bye.
--
-----------------------------
Daniele Venzano
Web: http://teg.homeunix.org
SiS900 driver needs to be fixed. Or perhaps... try following patch.
Hi Pavel,
thanks for your prompt response. I applied your patch to my 2.6.1-rc2 and
the bash
still gets killed during the resume. Here is the output of dmesg:
Linux version 2.6.1-rc2 (andreoli@enea) (gcc version 3.2.3 20030422 (Gentoo
Linux 1.4 3.2.3-r3, propolice)) #1 Tue Jan 13 21:38:14 CET 2004
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000002bfea000 (usable)
BIOS-e820: 000000002bfea000 - 000000002bfef000 (ACPI data)
BIOS-e820: 000000002bfef000 - 000000002bfff000 (reserved)
BIOS-e820: 000000002bfff000 - 000000002c000000 (ACPI NVS)
BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)
703MB LOWMEM available.
On node 0 totalpages: 180202
DMA zone: 4096 pages, LIFO batch:1
Normal zone: 176106 pages, LIFO batch:16
HighMem zone: 0 pages, LIFO batch:1
DMI 2.3 present.
ACPI: RSDP (v000 ASUS ) @ 0x000f6e10
ACPI: RSDT (v001 ASUS L3000D 0x42302e31 MSFT 0x31313031) @ 0x2bfea000
ACPI: FADT (v001 ASUS L3000D 0x42302e31 MSFT 0x31313031) @ 0x2bfea080
ACPI: BOOT (v001 ASUS L3000D 0x42302e31 MSFT 0x31313031) @ 0x2bfea040
ACPI: DSDT (v001 ASUS L3000D 0x00001000 MSFT 0x0100000e) @ 0x00000000
Building zonelist for node : 0
Kernel command line: root=/dev/hda7
Initializing CPU#0
PID hash table entries: 4096 (order 12: 32768 bytes)
Detected 1674.442 MHz processor.
Using tsc for high-res timesource
Console: colour VGA+ 80x25
Memory: 710120k/720808k available (1759k kernel code, 9916k reserved, 657k
data, 120k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode...
Ok.
Calibrating delay loop... 3309.56 BogoMIPS
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: After generic identify, caps: 0383f9ff c1cbf9ff 00000000 00000000
CPU: After vendor identify, caps: 0383f9ff c1cbf9ff 00000000 00000000
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 256K (64 bytes/line)
CPU: After all inits, caps: 0383f9ff c1cbf9ff 00000000 00000020
Intel machine check architecture supported.
Intel machine check reporting enabled on CPU#0.
CPU: AMD mobile AMD Athlon(tm) XP-M 2000+ stepping 01
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Checking 'hlt' instruction... OK.
POSIX conformance testing by UNIFIX
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.10 entry at 0xf1050, last bus=1
mtrr: v2.0 (20020519)
ACPI: Subsystem revision 20031002
ACPI: Interpreter enabled
ACPI: Using PIC for interrupt routing
ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 *11 14 15)
ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 *5 6 7 11 14 15)
ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 11 14 15)
ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 *11 14 15)
ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 *9 11 14 15)
ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 *9 11 14 15)
ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 *9 11 14 15)
ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 *9 11 14 15)
ACPI: PCI Root Bridge [PCI0] (00:00)
PCI: Probing PCI hardware (bus 00)
Uncovering SIS962 that hid as a SIS503 (compatible=0)
Enabling SiS 96x SMBus.
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCI1._PRT]
ACPI: Power Resource [FN0] (on)
Linux Plug and Play Support v0.97 (c) Adam Belay
SCSI subsystem initialized
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 5
ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 9
ACPI: PCI Interrupt Link [LNKE] enabled at IRQ 9
ACPI: PCI Interrupt Link [LNKF] enabled at IRQ 9
ACPI: PCI Interrupt Link [LNKG] enabled at IRQ 9
ACPI: PCI Interrupt Link [LNKH] enabled at IRQ 9
ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11
ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 11
PCI: Using ACPI for IRQ routing
PCI: if you experience problems, try using option 'pci=noacpi' or even 'acpi=off'
SBF: Simple Boot Flag extension found and enabled.
SBF: Setting boot flags 0x1
Machine check exception polling timer started.
devfs: v1.22 (20021013) Richard Gooch ([email protected])
devfs: boot_options: 0x1
udf: registering filesystem
Initializing Cryptographic API
pty: 256 Unix98 ptys configured
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled
ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
Using anticipatory io scheduler
Floppy drive(s): fd0 is 1.44M
FDC 0 is a National Semiconductor PC87306
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
SIS5513: IDE controller at PCI slot 0000:00:02.5
SIS5513: chipset revision 0
SIS5513: not 100% native mode: will probe irqs later
SIS5513: SiS 962/963 MuTIOL IDE UDMA133 controller
ide0: BM-DMA at 0xb800-0xb807, BIOS settings: hda:DMA, hdb:pio
ide1: BM-DMA at 0xb808-0xb80f, BIOS settings: hdc:DMA, hdd:pio
hda: IC25N040ATCS04-0, ATA DISK drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
hdc: TOSHIBA DVD-ROM SD-R2312, ATAPI CD/DVD-ROM drive
ide1 at 0x170-0x177,0x376 on irq 15
hda: max request size: 128KiB
hda: 78140160 sectors (40007 MB) w/1768KiB Cache, CHS=65535/16/63, UDMA(100)
/dev/ide/host0/bus0/target0/lun0: p1 p2 p3 < p5 p6 p7 >
hdc: ATAPI 24X DVD-ROM CD-R/RW drive, 2048kB Cache, UDMA(33)
Uniform CD-ROM driver Revision: 3.12
mice: PS/2 mouse device common for all mice
i8042.c: Detected active multiplexing controller, rev 1.1.
serio: i8042 AUX0 port at 0x60,0x64 irq 12
serio: i8042 AUX1 port at 0x60,0x64 irq 12
serio: i8042 AUX2 port at 0x60,0x64 irq 12
serio: i8042 AUX3 port at 0x60,0x64 irq 12
Synaptics Touchpad, model: 1
Firmware: 4.6
180 degree mounted touchpad
Sensor: 18
new absolute packet format
Touchpad has extended capability bits
-> four buttons
-> multifinger detection
-> palm detection
input: SynPS/2 Synaptics TouchPad on isa0060/serio4
serio: i8042 KBD port at 0x60,0x64 irq 1
input: AT Translated Set 2 keyboard on isa0060/serio0
NET: Registered protocol family 2
IP: routing cache hash table of 8192 buckets, 64Kbytes
TCP: Hash tables configured (established 262144 bind 65536)
NET: Registered protocol family 1
NET: Registered protocol family 17
PM: Reading pmdisk image.
PM: Resume from disk failed.
ACPI: (supports S0 S1 S3 S4 S5)
found reiserfs format "3.6" with standard journal
Reiserfs journal params: device hda7, size 8192, journal first block 18,
max trans len 1024, max batch 900, max commit age 30, max trans age 30
reiserfs: checking transaction log (hda7) for (hda7)
Using r5 hash to sort names
VFS: Mounted root (reiserfs filesystem) readonly.
Mounted devfs on /dev
Freeing unused kernel memory: 120k freed
Adding 987956k swap on /dev/hda6. Priority:-1 extents:1
sis900.c: v1.08.07 11/02/2003
eth0: ICS LAN PHY transceiver found at address 1.
eth0: Using transceiver found at address 1 as default
eth0: SiS 900 PCI Fast Ethernet at 0xa000, IRQ 11, 00:0c:6e:35:69:ed.
ACPI: AC Adapter [AC] (on-line)
ACPI: Battery Slot [BAT0] (battery present)
ACPI: Power Button (FF) [PWRF]
ACPI: Sleep Button (CM) [SLPB]
ACPI: Lid Switch [LID]
ACPI: Fan [FAN0] (on)
ACPI: Processor [CPU0] (supports C1)
ACPI: Thermal Zone [THRM] (61 C)
drivers/usb/core/usb.c: registered new driver usbfs
drivers/usb/core/usb.c: registered new driver hub
Real Time Clock Driver v1.12
eth0: Media Link On 100mbps full-duplex
intel8x0: clocking to 48000
atkbd.c: Unknown key released (translated set 2, code 0x7a on isa0060/serio0).
atkbd.c: Unknown key released (translated set 2, code 0x7a on isa0060/serio0).
Stopping tasks: =====================|
Freeing memory: ..................................|
hdc: start_power_step(step: 0)
hdc: completing PM request, suspend
hda: start_power_step(step: 0)
hda: completing PM request, suspend
resume= option should be used to set suspend device/critical section: Counting
pages to copy[nosave c035a000] (pages needed: 5318+512=5830 free: 174883)
Alloc pagedir
[nosave c035a000]<4>Freeing prev allocated pagedir
NETDEV WATCHDOG: eth0: transmit timed out
eth0: Transmit timeout, status 00000000 03008000
bad: scheduling while atomic!
Call Trace:
[<c0119cf6>] schedule+0x586/0x590
[<c0124f3c>] __mod_timer+0xfc/0x170
[<c0125a93>] schedule_timeout+0x63/0xc0
[<c0125a20>] process_timeout+0x0/0x10
[<c01da0bb>] pci_set_power_state+0xeb/0x190
[<ec947823>] sis900_resume+0x63/0x130 [sis900]
[<c01dc616>] pci_device_resume+0x26/0x30
[<c021e6d9>] resume_device+0x29/0x30
[<c021e714>] dpm_resume+0x34/0x60
[<c021e759>] device_resume+0x19/0x30
[<c0136524>] do_magic_resume_2+0x74/0xf0
[<c0264cbf>] do_magic+0x11f/0x130
[<c01367a6>] software_suspend+0xa6/0xc0
[<c01f5fe3>] acpi_system_write_sleep+0xab/0xc9
[<c015437e>] vfs_write+0xbe/0x130
[<c01544a2>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
hda: Wakeup request inited, waiting for !BSY...
hda: start_power_step(step: 1000)
blk: queue ebd77a00, I/O limit 4095Mb (mask 0xffffffff)
hda: completing PM request, resume
hdc: Wakeup request inited, waiting for !BSY...
hdc: start_power_step(step: 1000)
hdc: completing PM request, resume
Fixing swap signatures... <3>bad: scheduling while atomic!
Call Trace:
[<c0119cf6>] schedule+0x586/0x590
[<c023418d>] do_ide_request+0x1d/0x30
[<c0220917>] generic_unplug_device+0x77/0x80
[<c0220abb>] blk_run_queues+0xab/0xc0
[<c011ac3e>] io_schedule+0xe/0x20
[<c0138391>] wait_on_page_bit+0xb1/0xe0
[<c011b470>] autoremove_wake_function+0x0/0x50
[<c011b470>] autoremove_wake_function+0x0/0x50
[<c014f08b>] swap_readpage+0x5b/0x90
[<c014f181>] rw_swap_page_sync+0xc1/0x100
[<c013594c>] mark_swapfiles+0x7c/0x1b0
[<c0136559>] do_magic_resume_2+0xa9/0xf0
[<c0264cbf>] do_magic+0x11f/0x130
[<c01367a6>] software_suspend+0xa6/0xc0
[<c01f5fe3>] acpi_system_write_sleep+0xab/0xc9
[<c015437e>] vfs_write+0xbe/0x130
[<c01544a2>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
bad: scheduling while atomic!
Call Trace:
[<c0119cf6>] schedule+0x586/0x590
[<c0221f9e>] generic_make_request+0x16e/0x1f0
[<c011ac3e>] io_schedule+0xe/0x20
[<c0138391>] wait_on_page_bit+0xb1/0xe0
[<c011b470>] autoremove_wake_function+0x0/0x50
[<c011b470>] autoremove_wake_function+0x0/0x50
[<c014eff9>] swap_writepage+0x99/0xd0
[<c014f181>] rw_swap_page_sync+0xc1/0x100
[<c01359bf>] mark_swapfiles+0xef/0x1b0
[<c0136559>] do_magic_resume_2+0xa9/0xf0
[<c0264cbf>] do_magic+0x11f/0x130
[<c01367a6>] software_suspend+0xa6/0xc0
[<c01f5fe3>] acpi_system_write_sleep+0xab/0xc9
[<c015437e>] vfs_write+0xbe/0x130
[<c01544a2>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
ok
Restarting tasks...<3>bad: scheduling while atomic!
Call Trace:
[<c0119cf6>] schedule+0x586/0x590
[<c0118ede>] try_to_wake_up+0x9e/0x160
[<c0118fbe>] wake_up_process+0x1e/0x20
[<c01353c8>] thaw_processes+0xb8/0x100
[<c0136798>] software_suspend+0x98/0xc0
[<c01f5fe3>] acpi_system_write_sleep+0xab/0xc9
[<c015437e>] vfs_write+0xbe/0x130
[<c01544a2>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
done
bad: scheduling while atomic!
Call Trace:
[<c0119cf6>] schedule+0x586/0x590
[<c01544a2>] sys_write+0x42/0x70
[<c01094c2>] work_resched+0x5/0x16
bad: scheduling while atomic!
Call Trace:
[<c0119cf6>] schedule+0x586/0x590
[<c01187b6>] fixup_exception+0x16/0x40
[<c0117b6e>] __is_prefetch+0x6e/0x220
[<c0117e30>] do_page_fault+0x110/0x512
[<c011dcfd>] printk+0x11d/0x180
[<c011aba7>] sys_sched_yield+0x87/0xd0
[<c01608b8>] coredump_wait+0x38/0xa0
[<c0160a0b>] do_coredump+0xeb/0x1ec
[<c0118fda>] wake_up_state+0x1a/0x20
[<c0126de4>] specific_send_sig_info+0xc4/0x130
[<c01267f8>] __dequeue_signal+0xe8/0x190
[<c01268d5>] dequeue_signal+0x35/0xa0
[<c0128daa>] get_signal_to_deliver+0x20a/0x380
[<c0109272>] do_signal+0xe2/0x120
[<c0118d30>] recalc_task_prio+0x90/0x1a0
[<c0119aa4>] schedule+0x334/0x590
[<c0117d20>] do_page_fault+0x0/0x512
[<c0109309>] do_notify_resume+0x59/0x5c
[<c01094e6>] work_notifysig+0x13/0x15
note: bash[3649] exited with preempt_count 1
eth0: Media Link On 100mbps full-duplex
Bye
Mauro Andreolini
__________________________________________________________________
Tiscali ADSL SENZA CANONE:
Attivazione GRATIS, contributo adesione GRATIS, modem GRATIS,
50 ore di navigazione GRATIS. ABBONARTI TI COSTA SOLO UN CLICK!
http://point.tiscali.it/adsl/index.shtml
Daniele Venzano wrote:
>
>I added support for sis900 and the bash was being killed even before the
>driver had any support for suspend/resume.
>I reported that same problem (shell being killed) some time ago, there
was
>some follow up, but if I remember right no solution was found at the
>time.
>
>>>bad: scheduling while atomic!
>>>Call Trace:
>>> [<c0119d16>] schedule+0x586/0x590
>>> [<c0124f5c>] __mod_timer+0xfc/0x170
>>> [<c0125ab3>] schedule_timeout+0x63/0xc0
>>> [<c0125a40>] process_timeout+0x0/0x10
>>> [<c01da44b>] pci_set_power_state+0xeb/0x190
>>> [<ec947823>] sis900_resume+0x63/0x130 [sis900]
>>> [<c01dc9a6>] pci_device_resume+0x26/0x30
>
>
>I'll check this, the card keeps working after resume or not ?
>
>Thanks, bye.
>
Hi Daniele,
the card does _not_ work after resume, both on 2.6.1-rc2 vanilla and
with Pavel's patch.
I have to manually
rmmod sis900
modprobe sis900
ifconfig <ip> eth0 up
After that, it starts working again.
Bye
Mauro Andreolini
On Wed, Jan 14, 2004 at 04:47:57PM +0100, Mauro Andreolini wrote:
> Hi Daniele,
>
> the card does _not_ work after resume, both on 2.6.1-rc2 vanilla and
> with Pavel's patch.
> I have to manually
This is quite strange because for me the card works on resume, I
have the driver compiled in, but that should make no difference.
Could you try to plug/unplug the cable and see if it detects media
changes ? Messages like "Media link on/off" should appear.
Also, since probably the problem is that the mac filter is not reset
correctly, could you try tcpdump and see if in promiscous mode it
receives something ?
Thanks.
--
-----------------------------
Daniele Venzano
Web: http://teg.homeunix.org
This is quite strange because for me the card
works on resume, I
have the driver compiled in, but that should make no difference.
Could you try to plug/unplug the cable and see if it detects media
changes ? Messages like "Media link on/off" should appear.
I have verified this, but no msg is displayed. If I reload the sis900 module
manually,
it starts logging those
Media Link Off
Media Link On 100mbps full-duplex
messages whenever I unplug/plug the network cable.
Also, since probably the problem is
that the mac filter is not reset
correctly, could you try tcpdump and see if in promiscous mode it
receives something ?
I can't even 'tcpdump eth0' since the eth0 interface is not brought up correctly
on resume:
ifconfig yields only the loopback entry.
Bye
Mauro Andreolini
__________________________________________________________________
Tiscali ADSL SENZA CANONE:
Attivazione GRATIS, contributo adesione GRATIS, modem GRATIS,
50 ore di navigazione GRATIS. ABBONARTI TI COSTA SOLO UN CLICK!
http://point.tiscali.it/adsl/index.shtml
On Wed, Jan 14, 2004 at 06:59:36PM +0100, [email protected] wrote:
> I can't even 'tcpdump eth0' since the eth0 interface is not brought up correctly
> on resume:
> ifconfig yields only the loopback entry.
If the card isn't even brought up it means that you're lacking power
management completely for that device.
I'm using pmdisk, perhaps swsusp is using different calls to device drivers,
and no one has ever written them for sis900.
I searched documentation on swsusp interface, but found nothing,
as a matter of fact I assumed that what's in Documentation/power would
apply to both pmdisk and swsusp, since they're similar implementations.
Check that the patch at:
http://teg.homeunix.org/kernel_patches.html is in your tree.
If you have time try to match my configuration (2.6.1, pmdisk and sis900
compiled in) and see if that way it works.
Bye
--
-----------------------------
Daniele Venzano
Web: http://teg.homeunix.org
Hi.
I think you'll find that the 'bad: scheduling while atomic' reports are
completely unrelated to whether the drivers works after suspend or not;
they simply reflect that drivers_resume is being called with
preempt_count > 0 (IRQs/preempt not reenabled after copying the image or
fpu not released).
Regards,
Nigel
On Thu, 2004-01-15 at 04:47, Mauro Andreolini wrote:
> Daniele Venzano wrote:
>
> >
> >I added support for sis900 and the bash was being killed even before the
> >driver had any support for suspend/resume.
> >I reported that same problem (shell being killed) some time ago, there
> was
> >some follow up, but if I remember right no solution was found at the
> >time.
> >
> >>>bad: scheduling while atomic!
> >>>Call Trace:
> >>> [<c0119d16>] schedule+0x586/0x590
> >>> [<c0124f5c>] __mod_timer+0xfc/0x170
> >>> [<c0125ab3>] schedule_timeout+0x63/0xc0
> >>> [<c0125a40>] process_timeout+0x0/0x10
> >>> [<c01da44b>] pci_set_power_state+0xeb/0x190
> >>> [<ec947823>] sis900_resume+0x63/0x130 [sis900]
> >>> [<c01dc9a6>] pci_device_resume+0x26/0x30
> >
> >
> >I'll check this, the card keeps working after resume or not ?
> >
> >Thanks, bye.
> >
> Hi Daniele,
>
> the card does _not_ work after resume, both on 2.6.1-rc2 vanilla and
> with Pavel's patch.
> I have to manually
>
> rmmod sis900
> modprobe sis900
> ifconfig <ip> eth0 up
>
> After that, it starts working again.
>
> Bye
> Mauro Andreolini
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
My work on Software Suspend is graciously brought to you by
LinuxFund.org.
Daniele Venzano wrote:
>On Wed, Jan 14, 2004 at 06:59:36PM +0100, [email protected] wrote:
>
>
>>I can't even 'tcpdump eth0' since the eth0 interface is not brought up correctly
>>on resume:
>>ifconfig yields only the loopback entry.
>>
>>
>
>If the card isn't even brought up it means that you're lacking power
>management completely for that device.
>
>I'm using pmdisk, perhaps swsusp is using different calls to device drivers,
>and no one has ever written them for sis900.
>I searched documentation on swsusp interface, but found nothing,
>as a matter of fact I assumed that what's in Documentation/power would
>apply to both pmdisk and swsusp, since they're similar implementations.
>
>Check that the patch at:
>http://teg.homeunix.org/kernel_patches.html is in your tree.
>
>If you have time try to match my configuration (2.6.1, pmdisk and sis900
>compiled in) and see if that way it works.
>
>Bye
>
>
>
Hi Daniele,
I've ricompiled 2.6.1 (sis900.diff was already there) and used the
pmdisk implementation. The bash still crashes
during resume, but the network card is working. The dmesg output is as
follows:
<snip>
Stopping tasks: =====================|
Freeing memory: ....................|
hdc: start_power_step(step: 0)
hdc: completing PM request, suspend
hda: start_power_step(step: 0)
hda: start_power_step(step: 1)
hda: complete_power_step(step: 1, stat: 50, err: 0)
hda: completing PM request, suspend
PM: Attempting to suspend to disk.
PM: snapshotting memory.
PM: Image restored successfully.
bad: scheduling while atomic!
Call Trace:
[<c0119d36>] schedule+0x586/0x590
[<c0124f7c>] __mod_timer+0xfc/0x170
[<c0125ad3>] schedule_timeout+0x63/0xc0
[<c0125a60>] process_timeout+0x0/0x10
[<c01da6ab>] pci_set_power_state+0xeb/0x190
[<c02338f3>] sis900_resume+0x63/0x130
[<c01dcc06>] pci_device_resume+0x26/0x30
[<c021ecc9>] resume_device+0x29/0x30
[<c021ed04>] dpm_resume+0x34/0x60
[<c021ed49>] device_resume+0x19/0x30
[<c0137228>] finish+0x8/0x40
[<c0138195>] pmdisk_free+0x5/0x10
[<c013738e>] pm_suspend_disk+0x7e/0xc0
[<c0135025>] enter_state+0xa5/0xb0
[<c013511c>] state_store+0x6c/0x76
[<c01889aa>] subsys_attr_store+0x3a/0x40
[<c0188c7b>] flush_write_buffer+0x3b/0x50
[<c0188cf0>] sysfs_write_file+0x60/0x70
[<c015477e>] vfs_write+0xbe/0x130
[<c01548a2>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
hda: Wakeup request inited, waiting for !BSY...
hda: start_power_step(step: 1000)
blk: queue ebd6ca00, I/O limit 4095Mb (mask 0xffffffff)
hda: completing PM request, resume
hdc: Wakeup request inited, waiting for !BSY...
hdc: start_power_step(step: 1000)
hdc: completing PM request, resume
Restarting tasks...<3>bad: scheduling while atomic!
Call Trace:
[<c0119d36>] schedule+0x586/0x590
[<c0118efe>] try_to_wake_up+0x9e/0x160
[<c0118fde>] wake_up_process+0x1e/0x20
[<c0135438>] thaw_processes+0xb8/0x100
[<c01f63f9>] acpi_pm_finish+0x14/0x38
[<c0137236>] finish+0x16/0x40
[<c013738e>] pm_suspend_disk+0x7e/0xc0
[<c0135025>] enter_state+0xa5/0xb0
[<c013511c>] state_store+0x6c/0x76
[<c01889aa>] subsys_attr_store+0x3a/0x40
[<c0188c7b>] flush_write_buffer+0x3b/0x50
[<c0188cf0>] sysfs_write_file+0x60/0x70
[<c015477e>] vfs_write+0xbe/0x130
[<c01548a2>] sys_write+0x42/0x70
[<c010949b>] syscall_call+0x7/0xb
done
bad: scheduling while atomic!
Call Trace:
[<c0119d36>] schedule+0x586/0x590
[<c01548a2>] sys_write+0x42/0x70
[<c01094c2>] work_resched+0x5/0x16
bad: scheduling while atomic!
Call Trace:
[<c0119d36>] schedule+0x586/0x590
[<c01187d6>] fixup_exception+0x16/0x40
[<c0117b8e>] __is_prefetch+0x6e/0x220
[<c0117e50>] do_page_fault+0x110/0x512
[<c011dd3d>] printk+0x11d/0x180
[<c011abe7>] sys_sched_yield+0x87/0xd0
[<c0160cb8>] coredump_wait+0x38/0xa0
[<c0160e0b>] do_coredump+0xeb/0x1ec
[<c0118ffa>] wake_up_state+0x1a/0x20
[<c0126e24>] specific_send_sig_info+0xc4/0x130
[<c0126838>] __dequeue_signal+0xe8/0x190
[<c0126915>] dequeue_signal+0x35/0xa0
[<c0128dea>] get_signal_to_deliver+0x20a/0x380
[<c0109272>] do_signal+0xe2/0x120
[<c0118d50>] recalc_task_prio+0x90/0x1a0
[<c0119ae4>] schedule+0x334/0x590
[<c0117d40>] do_page_fault+0x0/0x512
[<c0109309>] do_notify_resume+0x59/0x5c
[<c01094e6>] work_notifysig+0x13/0x15
note: bash[3588] exited with preempt_count 1
eth0: Abnormal interrupt,status 0x03008001.
eth0: Media Link On 100mbps full-duplex
<end of snip>
Thanks for the help.
Bye
Mauro Andreolini
Nigel Cunningham wrote:
>Hi.
>
>I think you'll find that the 'bad: scheduling while atomic' reports are
>completely unrelated to whether the drivers works after suspend or not;
>they simply reflect that drivers_resume is being called with
>preempt_count > 0 (IRQs/preempt not reenabled after copying the image or
>fpu not released).
>
>Regards,
>
>Nigel
>
>
Thanks for the hint, Nigel. I'll try to take a deeper look into that.
Bye
Mauro Andreolini