Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1442282 > unrolled thread
| Started by | Pavel Machek <pavel@ucw.cz> |
|---|---|
| First post | 2016-07-13 12:00 +0200 |
| Last post | 2016-07-14 12:40 +0200 |
| Articles | 12 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Pavel Machek <pavel@ucw.cz> - 2016-07-13 12:00 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Chen Yu <yu.c.chen@intel.com> - 2016-07-13 12:20 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Pavel Machek <pavel@ucw.cz> - 2016-07-13 12:30 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Chen Yu <yu.c.chen@intel.com> - 2016-07-13 12:40 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Pavel Machek <pavel@ucw.cz> - 2016-07-13 19:10 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation "Rafael J. Wysocki" <rafael@kernel.org> - 2016-07-13 22:10 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Pavel Machek <pavel@ucw.cz> - 2016-07-13 22:30 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation "Rafael J. Wysocki" <rafael@kernel.org> - 2016-07-13 22:50 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Pavel Machek <pavel@ucw.cz> - 2016-07-13 23:50 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation "Rafael J. Wysocki" <rafael@kernel.org> - 2016-07-14 00:10 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation "Rafael J. Wysocki" <rafael@kernel.org> - 2016-07-14 00:20 +0200
Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Chen Yu <yu.c.chen@intel.com> - 2016-07-14 12:40 +0200
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-07-13 12:00 +0200 |
| Subject | Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation |
| Message-ID | <rUp7s-1hq-17@gated-at.bofh.it> |
On Thu 2016-07-07 14:40:58, Chen Yu wrote: > This mode is to verify if the snapshot data written to > swap device can be successfully restored to memory. It > is useful to ease the debugging process on hibernation, > since this mode can not only bypass the BIOSen/bootloader, > but also the system re-initialization. > > For example: > $ sudo echo snapshot > /sys/power/disk > $ sudo echo disk > /sys/power/state > > /* manual resume.*/ > $ sudo echo 8:3 > /sys/power/resume Your examples will not work, will they? This is also quite tricky/dangerous. If you do this with filesystems mounted R/W, it is "good bye, filesystems". I guess updating documentation would be welcome from my side, otherwise it should be ok. Acked-by: Pavel Machek <pavel@ucw.cz> Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [next] | [standalone]
| From | Chen Yu <yu.c.chen@intel.com> |
|---|---|
| Date | 2016-07-13 12:20 +0200 |
| Message-ID | <rUpqN-1JD-5@gated-at.bofh.it> |
| In reply to | #1442282 |
Hi Pavel, thanks for your reply, On 2016年07月13日 17:50, Pavel Machek wrote: > On Thu 2016-07-07 14:40:58, Chen Yu wrote: >> This mode is to verify if the snapshot data written to >> swap device can be successfully restored to memory. It >> is useful to ease the debugging process on hibernation, >> since this mode can not only bypass the BIOSen/bootloader, >> but also the system re-initialization. >> >> For example: >> $ sudo echo snapshot > /sys/power/disk >> $ sudo echo disk > /sys/power/state >> >> /* manual resume.*/ >> $ sudo echo 8:3 > /sys/power/resume > Your examples will not work, will they? It works on my platform, although I did not tested it for too many rounds. And here's a revised version of v2, which introduced a new test mode in pm_test, thus users do not need to run a manual resume. https://patchwork.kernel.org/patch/9226837/ > > This is also quite tricky/dangerous. If you do this with filesystems > mounted R/W, it is "good bye, filesystems". Ah, yes, this is quite tricky, maybe we can use this option as a debug method, for example, boot with rootfs = initrd, without mounting any disks, and then swapon the swap device, and do a testing. This should be safer? > > I guess updating documentation would be welcome from my side, > otherwise it should be ok. OK, I'll update the documents. > > Acked-by: Pavel Machek <pavel@ucw.cz> thanks. > > Best regards, > Pavel >
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-07-13 12:30 +0200 |
| Message-ID | <rUpAv-1Nt-61@gated-at.bofh.it> |
| In reply to | #1442294 |
Hi! > On 2016???07???13??? 17:50, Pavel Machek wrote: > >On Thu 2016-07-07 14:40:58, Chen Yu wrote: > >>This mode is to verify if the snapshot data written to > >>swap device can be successfully restored to memory. It > >>is useful to ease the debugging process on hibernation, > >>since this mode can not only bypass the BIOSen/bootloader, > >>but also the system re-initialization. > >> > >>For example: > >>$ sudo echo snapshot > /sys/power/disk > >>$ sudo echo disk > /sys/power/state > >> > >>/* manual resume.*/ > >>$ sudo echo 8:3 > /sys/power/resume > >Your examples will not work, will they? > It works on my platform, although I did not tested it for too many > rounds. Please check again: sudo echo disk > /sys/power/state -bash: /sys/power/state: Permission denied ...because bash does the open, not echo. > >This is also quite tricky/dangerous. If you do this with filesystems > >mounted R/W, it is "good bye, filesystems". > Ah, yes, this is quite tricky, maybe we can use this option as a > debug method, > for example, boot with rootfs = initrd, without mounting any disks, > and then swapon the swap device, and do a testing. This should be safer? Yeah, that's the way. Read-only root is other option. > >I guess updating documentation would be welcome from my side, > >otherwise it should be ok. > OK, I'll update the documents. Just add fat warning into the documentation. Thanks, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | Chen Yu <yu.c.chen@intel.com> |
|---|---|
| Date | 2016-07-13 12:40 +0200 |
| Message-ID | <rUpKa-1QV-25@gated-at.bofh.it> |
| In reply to | #1442311 |
On 2016年07月13日 18:21, Pavel Machek wrote: > Hi! > >> On 2016???07???13??? 17:50, Pavel Machek wrote: >>> On Thu 2016-07-07 14:40:58, Chen Yu wrote: >>>> This mode is to verify if the snapshot data written to >>>> swap device can be successfully restored to memory. It >>>> is useful to ease the debugging process on hibernation, >>>> since this mode can not only bypass the BIOSen/bootloader, >>>> but also the system re-initialization. >>>> >>>> For example: >>>> $ sudo echo snapshot > /sys/power/disk >>>> $ sudo echo disk > /sys/power/state >>>> >>>> /* manual resume.*/ >>>> $ sudo echo 8:3 > /sys/power/resume >>> Your examples will not work, will they? >> It works on my platform, although I did not tested it for too many >> rounds. > Please check again: > > sudo echo disk > /sys/power/state > -bash: /sys/power/state: Permission denied > > ...because bash does the open, not echo. Sorry, my bad, I logined as root:P I'll rewrite the commit log. >>> This is also quite tricky/dangerous. If you do this with filesystems >>> mounted R/W, it is "good bye, filesystems". >> Ah, yes, this is quite tricky, maybe we can use this option as a >> debug method, >> for example, boot with rootfs = initrd, without mounting any disks, >> and then swapon the swap device, and do a testing. This should be safer? > Yeah, that's the way. Read-only root is other option. > >>> I guess updating documentation would be welcome from my side, >>> otherwise it should be ok. >> OK, I'll update the documents. > Just add fat warning into the documentation. OK. > Thanks, > Pavel
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-07-13 19:10 +0200 |
| Message-ID | <rUvPz-5Zr-11@gated-at.bofh.it> |
| In reply to | #1442319 |
Hi! > >>and then swapon the swap device, and do a testing. This should be safer? > >Yeah, that's the way. Read-only root is other option. > > > >>>I guess updating documentation would be welcome from my side, > >>>otherwise it should be ok. > >>OK, I'll update the documents. > >Just add fat warning into the documentation. > OK. Actually... If you could add printk(KERN_ALERT "Hibernation image written. If you have any filesystems mounted read-write and attempt to resume, you'll corrupt your data. To prevent that, remove the hibernation image.\n") ...I guess that would save someone's filesystem. (Yes, very high loglevel. If you attempt to do this from anything else then singleuser or initrd, you are asking for problems, so... lets make sure user sees it.) Thanks, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-07-13 22:10 +0200 |
| Subject | Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation |
| Message-ID | <rUyDM-7RI-31@gated-at.bofh.it> |
| In reply to | #1442637 |
On Wed, Jul 13, 2016 at 7:01 PM, Pavel Machek <pavel@ucw.cz> wrote: > Hi! > >> >>and then swapon the swap device, and do a testing. This should be safer? >> >Yeah, that's the way. Read-only root is other option. >> > >> >>>I guess updating documentation would be welcome from my side, >> >>>otherwise it should be ok. >> >>OK, I'll update the documents. >> >Just add fat warning into the documentation. >> OK. > > Actually... If you could add > > printk(KERN_ALERT "Hibernation image written. If you have any > filesystems mounted read-write and attempt to resume, you'll corrupt > your data. To prevent that, remove the hibernation image.\n") > > ...I guess that would save someone's filesystem. (Yes, very high > loglevel. If you attempt to do this from anything else then singleuser > or initrd, you are asking for problems, so... lets make sure user sees > it.) Please see the new version of this patch: https://patchwork.kernel.org/patch/9226837/ Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-07-13 22:30 +0200 |
| Message-ID | <rUyX7-7ZC-11@gated-at.bofh.it> |
| In reply to | #1442805 |
On Wed 2016-07-13 22:04:27, Rafael J. Wysocki wrote: > On Wed, Jul 13, 2016 at 7:01 PM, Pavel Machek <pavel@ucw.cz> wrote: > > Hi! > > > >> >>and then swapon the swap device, and do a testing. This should be safer? > >> >Yeah, that's the way. Read-only root is other option. > >> > > >> >>>I guess updating documentation would be welcome from my side, > >> >>>otherwise it should be ok. > >> >>OK, I'll update the documents. > >> >Just add fat warning into the documentation. > >> OK. > > > > Actually... If you could add > > > > printk(KERN_ALERT "Hibernation image written. If you have any > > filesystems mounted read-write and attempt to resume, you'll corrupt > > your data. To prevent that, remove the hibernation image.\n") > > > > ...I guess that would save someone's filesystem. (Yes, very high > > loglevel. If you attempt to do this from anything else then singleuser > > or initrd, you are asking for problems, so... lets make sure user sees > > it.) > > Please see the new version of this patch: > https://patchwork.kernel.org/patch/9226837/ New version changes nothing, right? You still need to be sure filesystems are not mounted r/w. So I would still like to see printk() with warning. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-07-13 22:50 +0200 |
| Subject | Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation |
| Message-ID | <rUzgu-87F-31@gated-at.bofh.it> |
| In reply to | #1442819 |
On Wed, Jul 13, 2016 at 10:26 PM, Pavel Machek <pavel@ucw.cz> wrote: > On Wed 2016-07-13 22:04:27, Rafael J. Wysocki wrote: >> On Wed, Jul 13, 2016 at 7:01 PM, Pavel Machek <pavel@ucw.cz> wrote: >> > Hi! >> > >> >> >>and then swapon the swap device, and do a testing. This should be safer? >> >> >Yeah, that's the way. Read-only root is other option. >> >> > >> >> >>>I guess updating documentation would be welcome from my side, >> >> >>>otherwise it should be ok. >> >> >>OK, I'll update the documents. >> >> >Just add fat warning into the documentation. >> >> OK. >> > >> > Actually... If you could add >> > >> > printk(KERN_ALERT "Hibernation image written. If you have any >> > filesystems mounted read-write and attempt to resume, you'll corrupt >> > your data. To prevent that, remove the hibernation image.\n") >> > >> > ...I guess that would save someone's filesystem. (Yes, very high >> > loglevel. If you attempt to do this from anything else then singleuser >> > or initrd, you are asking for problems, so... lets make sure user sees >> > it.) >> >> Please see the new version of this patch: >> https://patchwork.kernel.org/patch/9226837/ > > New version changes nothing, right? You still need to be sure > filesystems are not mounted r/w. So I would still like to see printk() > with warning. It shouldn't matter how they are mounted, because the contents of persistent storage don't change. Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-07-13 23:50 +0200 |
| Message-ID | <rUAcx-ja-1@gated-at.bofh.it> |
| In reply to | #1442837 |
On Wed 2016-07-13 22:44:24, Rafael J. Wysocki wrote:
> On Wed, Jul 13, 2016 at 10:26 PM, Pavel Machek <pavel@ucw.cz> wrote:
> > On Wed 2016-07-13 22:04:27, Rafael J. Wysocki wrote:
> >> On Wed, Jul 13, 2016 at 7:01 PM, Pavel Machek <pavel@ucw.cz> wrote:
> >> > Hi!
> >> >
> >> >> >>and then swapon the swap device, and do a testing. This should be safer?
> >> >> >Yeah, that's the way. Read-only root is other option.
> >> >> >
> >> >> >>>I guess updating documentation would be welcome from my side,
> >> >> >>>otherwise it should be ok.
> >> >> >>OK, I'll update the documents.
> >> >> >Just add fat warning into the documentation.
> >> >> OK.
> >> >
> >> > Actually... If you could add
> >> >
> >> > printk(KERN_ALERT "Hibernation image written. If you have any
> >> > filesystems mounted read-write and attempt to resume, you'll corrupt
> >> > your data. To prevent that, remove the hibernation image.\n")
> >> >
> >> > ...I guess that would save someone's filesystem. (Yes, very high
> >> > loglevel. If you attempt to do this from anything else then singleuser
> >> > or initrd, you are asking for problems, so... lets make sure user sees
> >> > it.)
> >>
> >> Please see the new version of this patch:
> >> https://patchwork.kernel.org/patch/9226837/
> >
> > New version changes nothing, right? You still need to be sure
> > filesystems are not mounted r/w. So I would still like to see printk()
> > with warning.
>
> It shouldn't matter how they are mounted, because the contents of
> persistent storage don't change.
@@ -721,6 +724,9 @@ int hibernate(void)
atomic_inc(&snapshot_device_available);
Unlock:
unlock_system_sleep();
+ if (snapshot_test)
+ software_resume();
+
return error;
}
Aha, I see, immediate wakeup here. Makes sense. ... ...
No.
AFAICT, freezer is used in hibernation_snapshot, which means at
Unlock:, kernel threads are running; software_resume() freezes them
again, but they had chance to run and potentially corrupt the
persistent storage... right?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-07-14 00:10 +0200 |
| Subject | Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation |
| Message-ID | <rUAvT-Hu-13@gated-at.bofh.it> |
| In reply to | #1442881 |
On Wed, Jul 13, 2016 at 11:45 PM, Pavel Machek <pavel@ucw.cz> wrote: > On Wed 2016-07-13 22:44:24, Rafael J. Wysocki wrote: >> On Wed, Jul 13, 2016 at 10:26 PM, Pavel Machek <pavel@ucw.cz> wrote: >> > On Wed 2016-07-13 22:04:27, Rafael J. Wysocki wrote: >> >> On Wed, Jul 13, 2016 at 7:01 PM, Pavel Machek <pavel@ucw.cz> wrote: >> >> > Hi! >> >> > >> >> >> >>and then swapon the swap device, and do a testing. This should be safer? >> >> >> >Yeah, that's the way. Read-only root is other option. >> >> >> > >> >> >> >>>I guess updating documentation would be welcome from my side, >> >> >> >>>otherwise it should be ok. >> >> >> >>OK, I'll update the documents. >> >> >> >Just add fat warning into the documentation. >> >> >> OK. >> >> > >> >> > Actually... If you could add >> >> > >> >> > printk(KERN_ALERT "Hibernation image written. If you have any >> >> > filesystems mounted read-write and attempt to resume, you'll corrupt >> >> > your data. To prevent that, remove the hibernation image.\n") >> >> > >> >> > ...I guess that would save someone's filesystem. (Yes, very high >> >> > loglevel. If you attempt to do this from anything else then singleuser >> >> > or initrd, you are asking for problems, so... lets make sure user sees >> >> > it.) >> >> >> >> Please see the new version of this patch: >> >> https://patchwork.kernel.org/patch/9226837/ >> > >> > New version changes nothing, right? You still need to be sure >> > filesystems are not mounted r/w. So I would still like to see printk() >> > with warning. >> >> It shouldn't matter how they are mounted, because the contents of >> persistent storage don't change. > > @@ -721,6 +724,9 @@ int hibernate(void) > atomic_inc(&snapshot_device_available); > Unlock: > unlock_system_sleep(); > + if (snapshot_test) > + software_resume(); > + > return error; > } > > Aha, I see, immediate wakeup here. Makes sense. ... ... > > No. > > AFAICT, freezer is used in hibernation_snapshot, which means at > Unlock:, kernel threads are running; software_resume() freezes them > again, but they had chance to run and potentially corrupt the > persistent storage... right? OK, there is a bug. The thawing of user space is potentially dangerous, so in the "snapshot" test mode hibernate() should just call free_basic_memory_bitmaps() and from there invoke the code below the Check_image label in software_resume(), roughly. Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-07-14 00:20 +0200 |
| Subject | Re: [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation |
| Message-ID | <rUAFz-Ll-5@gated-at.bofh.it> |
| In reply to | #1442907 |
On Thu, Jul 14, 2016 at 12:00 AM, Rafael J. Wysocki <rafael@kernel.org> wrote: > On Wed, Jul 13, 2016 at 11:45 PM, Pavel Machek <pavel@ucw.cz> wrote: >> On Wed 2016-07-13 22:44:24, Rafael J. Wysocki wrote: >>> On Wed, Jul 13, 2016 at 10:26 PM, Pavel Machek <pavel@ucw.cz> wrote: >>> > On Wed 2016-07-13 22:04:27, Rafael J. Wysocki wrote: >>> >> On Wed, Jul 13, 2016 at 7:01 PM, Pavel Machek <pavel@ucw.cz> wrote: >>> >> > Hi! >>> >> > >>> >> >> >>and then swapon the swap device, and do a testing. This should be safer? >>> >> >> >Yeah, that's the way. Read-only root is other option. >>> >> >> > >>> >> >> >>>I guess updating documentation would be welcome from my side, >>> >> >> >>>otherwise it should be ok. >>> >> >> >>OK, I'll update the documents. >>> >> >> >Just add fat warning into the documentation. >>> >> >> OK. >>> >> > >>> >> > Actually... If you could add >>> >> > >>> >> > printk(KERN_ALERT "Hibernation image written. If you have any >>> >> > filesystems mounted read-write and attempt to resume, you'll corrupt >>> >> > your data. To prevent that, remove the hibernation image.\n") >>> >> > >>> >> > ...I guess that would save someone's filesystem. (Yes, very high >>> >> > loglevel. If you attempt to do this from anything else then singleuser >>> >> > or initrd, you are asking for problems, so... lets make sure user sees >>> >> > it.) >>> >> >>> >> Please see the new version of this patch: >>> >> https://patchwork.kernel.org/patch/9226837/ >>> > >>> > New version changes nothing, right? You still need to be sure >>> > filesystems are not mounted r/w. So I would still like to see printk() >>> > with warning. >>> >>> It shouldn't matter how they are mounted, because the contents of >>> persistent storage don't change. >> >> @@ -721,6 +724,9 @@ int hibernate(void) >> atomic_inc(&snapshot_device_available); >> Unlock: >> unlock_system_sleep(); >> + if (snapshot_test) >> + software_resume(); >> + >> return error; >> } >> >> Aha, I see, immediate wakeup here. Makes sense. ... ... >> >> No. >> >> AFAICT, freezer is used in hibernation_snapshot, which means at >> Unlock:, kernel threads are running; software_resume() freezes them >> again, but they had chance to run and potentially corrupt the >> persistent storage... right? > > OK, there is a bug. > > The thawing of user space is potentially dangerous, so in the > "snapshot" test mode hibernate() should just call > free_basic_memory_bitmaps() and from there invoke the code below the > Check_image label in software_resume(), roughly. Or rather call free_basic_memory_bitmaps() and unlock_device_hotplug(), then do swsusp_check() and invoke the code starting with the "PM: Loading hibernation image.\n" message in software_resume(). Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | Chen Yu <yu.c.chen@intel.com> |
|---|---|
| Date | 2016-07-14 12:40 +0200 |
| Message-ID | <rUMdI-8va-35@gated-at.bofh.it> |
| In reply to | #1442911 |
Hi, On 2016年07月14日 06:18, Rafael J. Wysocki wrote: > On Thu, Jul 14, 2016 at 12:00 AM, Rafael J. Wysocki <rafael@kernel.org> wrote: >> On Wed, Jul 13, 2016 at 11:45 PM, Pavel Machek <pavel@ucw.cz> wrote: >>> On Wed 2016-07-13 22:44:24, Rafael J. Wysocki wrote: >>>> On Wed, Jul 13, 2016 at 10:26 PM, Pavel Machek <pavel@ucw.cz> wrote: >>>>> On Wed 2016-07-13 22:04:27, Rafael J. Wysocki wrote: >>>>>> On Wed, Jul 13, 2016 at 7:01 PM, Pavel Machek <pavel@ucw.cz> wrote: >>>>>>> Hi! >>>>>>> >>>>>>>>>> and then swapon the swap device, and do a testing. This should be safer? >>>>>>>>> Yeah, that's the way. Read-only root is other option. >>>>>>>>> >>>>>>>>>>> I guess updating documentation would be welcome from my side, >>>>>>>>>>> otherwise it should be ok. >>>>>>>>>> OK, I'll update the documents. >>>>>>>>> Just add fat warning into the documentation. >>>>>>>> OK. >>>>>>> Actually... If you could add >>>>>>> >>>>>>> printk(KERN_ALERT "Hibernation image written. If you have any >>>>>>> filesystems mounted read-write and attempt to resume, you'll corrupt >>>>>>> your data. To prevent that, remove the hibernation image.\n") >>>>>>> >>>>>>> ...I guess that would save someone's filesystem. (Yes, very high >>>>>>> loglevel. If you attempt to do this from anything else then singleuser >>>>>>> or initrd, you are asking for problems, so... lets make sure user sees >>>>>>> it.) >>>>>> Please see the new version of this patch: >>>>>> https://patchwork.kernel.org/patch/9226837/ >>>>> New version changes nothing, right? You still need to be sure >>>>> filesystems are not mounted r/w. So I would still like to see printk() >>>>> with warning. >>>> It shouldn't matter how they are mounted, because the contents of >>>> persistent storage don't change. >>> @@ -721,6 +724,9 @@ int hibernate(void) >>> atomic_inc(&snapshot_device_available); >>> Unlock: >>> unlock_system_sleep(); >>> + if (snapshot_test) >>> + software_resume(); >>> + >>> return error; >>> } >>> >>> Aha, I see, immediate wakeup here. Makes sense. ... ... >>> >>> No. >>> >>> AFAICT, freezer is used in hibernation_snapshot, which means at >>> Unlock:, kernel threads are running; software_resume() freezes them >>> again, but they had chance to run and potentially corrupt the >>> persistent storage... right? >> OK, there is a bug. >> >> The thawing of user space is potentially dangerous, so in the >> "snapshot" test mode hibernate() should just call >> free_basic_memory_bitmaps() and from there invoke the code below the >> Check_image label in software_resume(), roughly. > Or rather call free_basic_memory_bitmaps() and > unlock_device_hotplug(), then do swsusp_check() and invoke the code > starting with the "PM: Loading hibernation image.\n" message in > software_resume(). OK, I've used this solution and sent a v3 out. thanks! > > Thanks, > Rafael
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web