linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [INFO] : Hibernation and Resume between 2 similar devices
@ 2012-03-13  4:53 PINTU KUMAR
  2012-03-13 20:36 ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: PINTU KUMAR @ 2012-03-13  4:53 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=windows-1252, Size: 1026 bytes --]

Dear All,

I am just curious to know if it is possible to "Hibernate in one device" and "Resume the hibernated image from another similar device".

Suppose, I have 2 exactly similar device (Laptop or mobile phone) with me.
At one time I will be working on only one device at a time.
Suppose I started my work on "Device 1"  with few opened application and later I wanted to switch to "Device 2" which is exactly similar to Device 1.
I thought to hibernate (suspend to disk) the Device 1 and store the hibernated image as a swap file and later transfer to sd card.
Then take of the sd card from Device 1 and put it into Device 2.
Copy the swap file from sd card to Device 2 in some swap partition.
Then reboot the Device 2 to Resume from this swap file.
I will get back my Device 1 content in Device 2.

Hope this is possible ?

Any comments.....

Regards,
Pintu




ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [INFO] : Hibernation and Resume between 2 similar devices
  2012-03-13  4:53 [INFO] : Hibernation and Resume between 2 similar devices PINTU KUMAR
@ 2012-03-13 20:36 ` Rafael J. Wysocki
  2012-03-14 10:21   ` PINTU KUMAR
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2012-03-13 20:36 UTC (permalink / raw)
  To: pintu.k; +Cc: linux-kernel, linux-arm-kernel

On Tuesday, March 13, 2012, PINTU KUMAR wrote:
> Dear All,
> 
> I am just curious to know if it is possible to "Hibernate in one device" and "Resume the hibernated image from another similar device".

Not out of the box (you'd need to hack the kernel for that to work I think,
at least on x86) and the devices would need to be _exactly_ identical.
Moreover, if there is read-write mass storage in them, the filesystems on
both would have to be exactly identical as well (including metadata and data
layout etc.).

> Suppose, I have 2 exactly similar device (Laptop or mobile phone) with me.
> At one time I will be working on only one device at a time.
> Suppose I started my work on "Device 1"  with few opened application and later I wanted to switch to "Device 2" which is exactly similar to Device 1.
> I thought to hibernate (suspend to disk) the Device 1 and store the hibernated image as a swap file and later transfer to sd card.
> Then take of the sd card from Device 1 and put it into Device 2.
> Copy the swap file from sd card to Device 2 in some swap partition.
> Then reboot the Device 2 to Resume from this swap file.
> I will get back my Device 1 content in Device 2.
> 
> Hope this is possible ?

It may be possible to make it kind of work, but I wouldn't recommend it to
anyone.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [INFO] : Hibernation and Resume between 2 similar devices
  2012-03-13 20:36 ` Rafael J. Wysocki
@ 2012-03-14 10:21   ` PINTU KUMAR
  2012-03-14 17:33     ` Valdis.Kletnieks
  0 siblings, 1 reply; 6+ messages in thread
From: PINTU KUMAR @ 2012-03-14 10:21 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-kernel, linux-arm-kernel


>________________________________
>From: Rafael J. Wysocki <rjw@sisk.pl>
>To: pintu.k@samsung.com 
>Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org 
>Sent: Wednesday, 14 March 2012 2:06 AM
>Subject: Re: [INFO] : Hibernation and Resume between 2 similar devices
>
>On Tuesday, March 13, 2012, PINTU KUMAR wrote:
>> Dear All,
>> 
>> I am just curious to know if it is possible to "Hibernate in one device" and "Resume the hibernated image from another similar device".
>
>Not out of the box (you'd need to hack the kernel for that to work I think,
>at least on x86) and the devices would need to be _exactly_ identical.
>Moreover, if there is read-write mass storage in them, the filesystems on
>both would have to be exactly identical as well (including metadata and data
>layout etc.).
 
[Pintu]
I wanted to try this on arm based Linux mobile phone.
I have 2 exactly similar mobile phone.
Here exactly means: 
hardware is same, kernel version is same, platform is same, filesystem is same.
The only difference could be some user space application state.
Hmmm.....the metadata and data layout within file system....this is were the confusion is.
Suppose in "Device 1" during hibernation, I have a file say "file1.txt" opened whose inode number is say "123456".
This opened state of file1.txt will be captured in hibernation image.
Now assume that same "file1.txt" is also present (not opened) in "Device2" but whose inode number is say "567890".
Now if I reboot "Device 2" and try to resume from hibernated image of "Device 1", what would happen to "file1.txt" ??
And similarly other senarios.......
Will resume work, at least partially. Like discard whatever is not relevant to "Device 2" and continue to load others.


>
>> Suppose, I have 2 exactly similar device (Laptop or mobile phone) with me.
>> At one time I will be working on only one device at a time.
>> Suppose I started my work on "Device 1"  with few opened application and later I wanted to switch to "Device 2" which is exactly similar to Device 1.
>> I thought to hibernate (suspend to disk) the Device 1 and store the hibernated image as a swap file and later transfer to sd card.
>> Then take of the sd card from Device 1 and put it into Device 2.
>> Copy the swap file from sd card to Device 2 in some swap partition.
>> Then reboot the Device 2 to Resume from this swap file.
>> I will get back my Device 1 content in Device 2.
>> 
>> Hope this is possible ?
>
>It may be possible to make it kind of work, but I wouldn't recommend it to
>anyone.
 
[Pintu]
if this can be possible we can derive many use cases.
Till now we heard about hibernating and resuming from same device. And also people uses it rarely.
With the Tizen coming up (supporting multiple devices) we can think about it.
Also if "cloud" is integrated with kernel in _future_ we can save all our work from one device in cloud and restore our work from cloud in another device.
I think that make sense.


 
>
>Thanks,
>Rafael
>
>_______________________________________________
>linux-arm-kernel mailing list
>linux-arm-kernel@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [INFO] : Hibernation and Resume between 2 similar devices
  2012-03-14 10:21   ` PINTU KUMAR
@ 2012-03-14 17:33     ` Valdis.Kletnieks
  2012-03-15 14:53       ` PINTU KUMAR
  0 siblings, 1 reply; 6+ messages in thread
From: Valdis.Kletnieks @ 2012-03-14 17:33 UTC (permalink / raw)
  To: PINTU KUMAR; +Cc: Rafael J. Wysocki, linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

On Wed, 14 Mar 2012 03:21:58 PDT, PINTU KUMAR said:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > Not out of the box (you'd need to hack the kernel for that to work I think,
> > at least on x86) and the devices would need to be _exactly_ identical.
> > Moreover, if there is read-write mass storage in them, the filesystems on
> > both would have to be exactly identical as well (including metadata and data
> > layout etc.).

> Suppose in "Device 1" during hibernation, I have a file say "file1.txt" opened whose inode number is say "123456".
> This opened state of file1.txt will be captured in hibernation image.
> Now assume that same "file1.txt" is also present (not opened) in "Device2" but whose inode number is say "567890".
> Now if I reboot "Device 2" and try to resume from hibernated image of "Device 1", what would happen to "file1.txt" ??

Rafael was quite clear - the mass storage has to be *identical*.  You reboot
with the image of "Device 1", that had file1.txt open, what will happen when
you close (or write, or sync) the file is this:

1) You'll write data out to disk into whatever blocks were owned by inode
12345, no matter who actually owns them on Device2's storage.

2) You'll write out inode 12345 to disk, no matter what used to be there.

Note that you'll do this same thing for *every single* file that was open when
you hibernated, which means you'll corrupt every file that was opened *and*
every file that was closed but was using the same blocks on the new disk as the
open file was using on the original disk.

In short, you just completely corrupted the file system. 

[-- Attachment #2: Type: application/pgp-signature, Size: 865 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [INFO] : Hibernation and Resume between 2 similar devices
  2012-03-14 17:33     ` Valdis.Kletnieks
@ 2012-03-15 14:53       ` PINTU KUMAR
  0 siblings, 0 replies; 6+ messages in thread
From: PINTU KUMAR @ 2012-03-15 14:53 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Rafael J. Wysocki, linux-kernel, linux-arm-kernel



----- Original Message -----
> From: "Valdis.Kletnieks@vt.edu" <Valdis.Kletnieks@vt.edu>
> To: PINTU KUMAR <pintu_agarwal@yahoo.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>; "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>; "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>
> Sent: Wednesday, 14 March 2012 11:03 PM
> Subject: Re: [INFO] : Hibernation and Resume between 2 similar devices
> 
> On Wed, 14 Mar 2012 03:21:58 PDT, PINTU KUMAR said:
>> > From: Rafael J. Wysocki <rjw@sisk.pl>
>> > Not out of the box (you'd need to hack the kernel for that to work 
> I think,
>> > at least on x86) and the devices would need to be _exactly_ identical.
>> > Moreover, if there is read-write mass storage in them, the filesystems 
> on
>> > both would have to be exactly identical as well (including metadata 
> and data
>> > layout etc.).
> 
>> Suppose in "Device 1" during hibernation, I have a file say 
> "file1.txt" opened whose inode number is say "123456".
>> This opened state of file1.txt will be captured in hibernation image.
>> Now assume that same "file1.txt" is also present (not opened) in 
> "Device2" but whose inode number is say "567890".
>> Now if I reboot "Device 2" and try to resume from hibernated 
> image of "Device 1", what would happen to "file1.txt" ??
> 
> Rafael was quite clear - the mass storage has to be *identical*.  You reboot
> with the image of "Device 1", that had file1.txt open, what will 
> happen when
> you close (or write, or sync) the file is this:
> 
> 1) You'll write data out to disk into whatever blocks were owned by inode
> 12345, no matter who actually owns them on Device2's storage.
> 
> 2) You'll write out inode 12345 to disk, no matter what used to be there.
> 
> Note that you'll do this same thing for *every single* file that was open 
> when
> you hibernated, which means you'll corrupt every file that was opened *and*
> every file that was closed but was using the same blocks on the new disk as the
> open file was using on the original disk.
> 
> In short, you just completely corrupted the file system. 

Yes, consider that 2 devices are identical in all respect.
ok lets discard the file (write, save) scenario after the resume. My doubt was, will I get the snapshot of file in RAM after I resume ?
Ok leave the file case.

Consider the case of few application (which is already present in both the devices) , 
lets say : In Device 1 we opened : Browser, calculator, a photo (already existing).
Then I captured the hibernated image in a swap file.
My I want to restore/resume this hibernated image from another _similar_ device.
After I resume, will I able to restore the same applications in Device 2 ????

Ok, if something cannot be resumed, we can throw it away.
I mean, during hibernation, if we opened 10 apps, and during resume we get only 5, that should be ok.
We can discard which ever is not relevant for Device 2.
 

> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [INFO] : Hibernation and Resume between 2 similar devices
@ 2012-03-14  3:15 David Feuer
  0 siblings, 0 replies; 6+ messages in thread
From: David Feuer @ 2012-03-14  3:15 UTC (permalink / raw)
  To: linux-kernel

> I am just curious to know if it is possible to "Hibernate in one device" and "Resume the hibernated image from another similar device".

This is a fairly terrible idea, for various reasons. It might be
better for you to raise this question elsewhere, with basic info like
/why you want to do this/, but my vague guess is that whatever you're
trying to do, you might want to try doing it with virtualization
software (Virtualbox, Xen, KVM, VMWare, etc.) that is actually
designed for doing vaguely similar things. My recollection is that Xen
is specifically optimized to allow for nearly-seamless migration, so
if you actually need this sort of thing (on a phone? a laptop?
whyyyyyyy?) you might try that.

David Feuer

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-15 14:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13  4:53 [INFO] : Hibernation and Resume between 2 similar devices PINTU KUMAR
2012-03-13 20:36 ` Rafael J. Wysocki
2012-03-14 10:21   ` PINTU KUMAR
2012-03-14 17:33     ` Valdis.Kletnieks
2012-03-15 14:53       ` PINTU KUMAR
2012-03-14  3:15 David Feuer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).