Bug 7057
Summary: | S4: fails when swap is mounted with loop device. | ||
---|---|---|---|
Product: | ACPI | Reporter: | Thomas Steudten (tomri) |
Component: | Power-Sleep-Wake | Assignee: | Pavel Machek (pavel) |
Status: | REJECTED INVALID | ||
Severity: | low | CC: | acpi-bugzilla, rjwysocki |
Priority: | P2 | ||
Hardware: | i386 | ||
OS: | Linux | ||
Kernel Version: | 2.6.17.7 | Subsystem: | |
Regression: | --- | Bisected commit-id: |
Description
Thomas Steudten
2006-08-25 08:43:25 UTC
And why do you think it could work? What does your /proc/cmdline look like? Are you resuming from kernel, or from initrd? Well, with /dev/hda (normal IDE block device) STD works. Running the system with a loop device (/dev/loopX) as swap works too. Trying to STD (swsusp) with platform methode and loop-device as only active swap, gives: swap.c:printk(KERN_ERR "swsusp: Cannot find swap device, try swapon -a.\n"); This check is done in: swap_type_of(). swsusp writes to the swap device, if there's enough space. So it doesn't matter, what data is written there, it writes to the free space on the swap device. So why can't the kernel do this, when there's only a loop device as active swap? losetup -a gives the block device info (/dev/hda5) which matches to the active swap device (/dev/loop5). So the kernel has the information which block device to use for swap. On the other hand a cmd-line "resume=/dev/hda5" is given. So the kernel can do this: 1) query swap device 2) find a loop device as a active swap device 3) find out the matching block device for this loop device 4) [check this with resume=.. block device] 5) Use the block device for swsusp. 6) STD 7) resume from resume=.. 8) .. Why shouldn't this work? I can do this by script, but the kernel should do this work. I can write a patch for this, if you can't do this. Hi! > Well, with /dev/hda (normal IDE block device) STD works. Running the system with > a loop device (/dev/loopX) as swap works too. Trying to STD (swsusp) with > platform methode and loop-device as only active swap, gives: > swap.c:printk(KERN_ERR "swsusp: Cannot find swap device, try swapon -a.\n"); > > This check is done in: > swap_type_of(). > > swsusp writes to the swap device, if there's enough space. So it doesn't matter, > what data is written there, it writes to the free space on the swap device. > So why can't the kernel do this, when there's only a loop device as active swap? Because that would be layering violation. > losetup -a gives the block device info (/dev/hda5) which matches to the active > swap device (/dev/loop5). So the kernel has the information which block device > to use for swap. On the other hand a cmd-line "resume=/dev/hda5" is > given. That's wrong, you suspended to loop5, and you want to resume from hda5. > So the kernel can do this: > 1) query swap device > 2) find a loop device as a active swap device Yes, kernel _can_ do this, but this would be layering violation. > I can do this by script, but the kernel should do this work. > > I can write a patch for this, if you can't do this. Lets see what a patch looks like... Anyway right solution is to use uswsusp (see uswsusp.sf.net), and only attempt resume after loopbacks are set up. Pavel > Because that would be layering violation. That could be a reason ;-) > That's wrong, you suspended to loop5, and you want to resume from hda5. I tried to STD with running swap, because running swap device is a loop device, the swsusp complains, that there's no swap device: swap.c:printk(KERN_ERR "swsusp: Cannot find swap device, try swapon -a.\n"); The user thinks, or well I find a swap device, see swapon -s - it's there.. I give the resume= cmd-line every time in the grub.conf file, so the kernel complains too, that there's no resume device. There's no STD magic, that's maybe true, so why complaining? Does the kernel compare the resume= and the running swap device? >Anyway right solution is to use uswsusp (see uswsusp.sf.net), and only >attempt resume after loopbacks are set up. This is overhead - I swapoff the loop, swapon the hda5, STD, swapoff -a and swapon -a. That's ok, but I think the kernel could do this for me. This works, if there's enough swap space available for STD. There could be a flag (/proc/../use_resume) that means, use the block device given from resume=.. cmdline for STD, no matter what swap is running. > > That's wrong, you suspended to loop5, and you want to resume from hda5. > I tried to STD with running swap, because running swap device is a loop > device, the swsusp complains, that there's no swap device: > swap.c:printk(KERN_ERR "swsusp: Cannot find swap device, try swapon -a.\n"); > The user thinks, or well I find a swap device, see swapon -s - it's there.. > I give the resume= cmd-line every time in the grub.conf file, so the kernel > complains too, that there's no resume device. There's no STD magic, that's > maybe true, so why complaining? > Does the kernel compare the resume= and the running swap device? Yes. Feel free to improve the messages or the documentation. > >Anyway right solution is to use uswsusp (see uswsusp.sf.net), and only > >attempt resume after loopbacks are set up. > > This is overhead - I swapoff the loop, swapon the hda5, STD, swapoff -a and > swapon -a. That's ok, but I think the kernel could do this for me. > This works, if there's enough swap space available for STD. No, kernel will not do this for you. > There could be a flag (/proc/../use_resume) that means, use the block device > given from resume=.. cmdline for STD, no matter what swap is running. No. Kernel will not second-guess the users. |