Skip to contentSkip to conversation

userland swsusp

RFC Stefan Rompf 4 participants 6 messages Nov 16, 2005 – Nov 21, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines · Pavel Machek

This is prototype of userland swsusp. I'd like kernel parts to go in, probably for 2.6.16. Now, I'm not sure about the interface, ioctls are slightly ugly, OTOH it would be probably overkill to introduce syscalls just for this. (I'll need to add an ioctl for freeing memory in future).

I'm curious on the restrictions the userspace part would have to accept. Can /usr/swsusp.c write to a file? Currently, you allow it, but I doubt whether it would be wise to write to a file after you've snapshotted kernel's filesystem state. OTOH, I don't want to reserve a partition just for the image. Can userspace allocate memory after ioctl(SYS_FREEZE)?

I have userspace supported encryption of the image in mind.

Stefan

#1 lore raw

Hi!

Quoted 8 lines
Quoted 5 lines

This is prototype of userland swsusp. I'd like kernel parts to go in, probably for 2.6.16. Now, I'm not sure about the interface, ioctls are slightly ugly, OTOH it would be probably overkill to introduce syscalls just for this. (I'll need to add an ioctl for freeing memory in future).

I'm curious on the restrictions the userspace part would have to accept. Can /usr/swsusp.c write to a file? Currently, you allow it, but I doubt

No. Writing to file would trash the filesystem. But you can bmap the file, then write to the block device.

Quoted 3 lines

whether it would be wise to write to a file after you've snapshotted kernel's filesystem state. OTOH, I don't want to reserve a partition just for the image. Can userspace allocate memory after ioctl(SYS_FREEZE)?

Better avoid memory allocation.

Quoted 1 line

I have userspace supported encryption of the image in mind.

Yes, that should be feasible.
Pavel

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         
#2 lore raw

Am Mittwoch 16 November 2005 20:07 schrieb Pavel Machek:

Quoted 2 lines

No. Writing to file would trash the filesystem. But you can bmap the file, then write to the block device.

And for reading, I could used a device mapper enforced read only mount or filesystem code from grub.

Hmm, how about a possibility to ask the kernel for a list of free pages on a swap device? This way, userspace could write the image to swap as the kernel currently does, avoiding possible trouble with filesystems.

Quoted 1 line

Better avoid memory allocation.

And all memory allocated and mapped in advance would be part of the image. But this is totally acceptable for a "suspend helper".

Stefan

#3 lore raw

Hi!

Quoted 5 lines
Quoted 2 lines

No. Writing to file would trash the filesystem. But you can bmap the file, then write to the block device.

And for reading, I could used a device mapper enforced read only mount or filesystem code from grub.

Or use a filesystem that honours read-only option, like ext2...

Quoted 3 lines

Hmm, how about a possibility to ask the kernel for a list of free pages on a swap device? This way, userspace could write the image to swap as the kernel currently does, avoiding possible trouble with filesystems.

Yes, that is the plan.

Quoted 4 lines
Quoted 1 line

Better avoid memory allocation.

And all memory allocated and mapped in advance would be part of the image. But this is totally acceptable for a "suspend helper".

Yes.
Pavel

Signature · 1 line
Thanks, Sharp!
#4 lore raw
In reply to Pavel Machek
Quoted 5 lines · Pavel Machek
Quoted 2 lines

I'm curious on the restrictions the userspace part would have to accept. Can /usr/swsusp.c write to a file? Currently, you allow it, but I doubt

No. Writing to file would trash the filesystem. But you can bmap the file, then write to the block device.

Do/should all the filesystems get remounted read-only as a precaution? Or is that overkill?

Rob

#5 lore raw

Hi!

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm curious on the restrictions the userspace part would have to accept. Can /usr/swsusp.c write to a file? Currently, you allow it, but I doubt

No. Writing to file would trash the filesystem. But you can bmap the file, then write to the block device.

Do/should all the filesystems get remounted read-only as a precaution? Or is that overkill?

You may not do that. remounting the filesystem writes to it... and that's no-no.
Pavel

Signature · 1 line
Thanks, Sharp!