From: Nigel Cunningham <nigel@tuxonice.net>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Linux PM <linux-pm@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
TuxOnIce-devel <tuxonice-devel@tuxonice.net>
Subject: Re: [PATCH 02/23] Record & display i/o speed post resume.
Date: Tue, 28 Sep 2010 07:05:45 +1000 [thread overview]
Message-ID: <4CA10729.5010001@tuxonice.net> (raw)
In-Reply-To: <201009272249.59966.rjw@sisk.pl>
Hi.
On 28/09/10 06:49, Rafael J. Wysocki wrote:
> On Monday, September 27, 2010, Nigel Cunningham wrote:
>> Hi.
>>
>> On 28/09/10 06:06, Rafael J. Wysocki wrote:
>>> On Monday, September 27, 2010, Nigel Cunningham wrote:
>>>> Record the speed at which the image is written and read, and
>>>> display it to the user post-resume.
>>>>
>>>> Signed-off-by: Nigel Cunningham<nigel@tuxonice.net>
>>>> ---
>>>> kernel/power/hibernate.c | 11 ++++++++++-
>>>> kernel/power/power.h | 3 ++-
>>>> kernel/power/swap.c | 14 +++++++++++---
>>>> 3 files changed, 23 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
>>>> index 6c9c9dc..0cd1f05 100644
>>>> --- a/kernel/power/hibernate.c
>>>> +++ b/kernel/power/hibernate.c
>>>> @@ -212,7 +212,7 @@ static void platform_recover(int platform_mode)
>>>> * @msg - introductory message to print
>>>> */
>>>>
>>>> -void swsusp_show_speed(struct timeval *start, struct timeval *stop,
>>>> +int swsusp_show_speed(struct timeval *start, struct timeval *stop,
>>>> unsigned nr_pages, char *msg)
>>>> {
>>>> s64 elapsed_centisecs64;
>>>> @@ -231,6 +231,7 @@ void swsusp_show_speed(struct timeval *start, struct timeval *stop,
>>>> msg, k,
>>>> centisecs / 100, centisecs % 100,
>>>> kps / 1000, (kps % 1000) / 10);
>>>> + return kps / 1000;
>>>> }
>>>>
>>>> /**
>>>> @@ -648,6 +649,14 @@ int hibernate(void)
>>>> power_down();
>>>> } else {
>>>> pr_debug("PM: Image restored successfully.\n");
>>>> + if (write_speed)
>>>> + pr_debug("PM: Image written at %u MB/s.\n",
>>>> + (u8) write_speed);
>>>> + write_speed = 0;
>>>> + if (read_speed)
>>>> + pr_debug("PM: Image read at %u MB/s.\n",
>>>> + (u8) read_speed);
>>>> + read_speed = 0;
>>>> }
>>>>
>>>> Thaw:
>>>> diff --git a/kernel/power/power.h b/kernel/power/power.h
>>>> index 03634be..22f8607 100644
>>>> --- a/kernel/power/power.h
>>>> +++ b/kernel/power/power.h
>>>> @@ -53,6 +53,7 @@ extern int hibernation_snapshot(int platform_mode);
>>>> extern int hibernation_restore(int platform_mode);
>>>> extern int hibernation_platform_enter(void);
>>>>
>>>> +extern char __nosavedata write_speed, read_speed;
>>>> #else /* !CONFIG_HIBERNATION */
>>>>
>>>> static inline void hibernate_image_size_init(void) {}
>>>> @@ -161,7 +162,7 @@ extern int hib_wait_on_bio_chain(struct bio **bio_chain);
>>>>
>>>> struct timeval;
>>>> /* kernel/power/swsusp.c */
>>>> -extern void swsusp_show_speed(struct timeval *, struct timeval *,
>>>> +extern int swsusp_show_speed(struct timeval *, struct timeval *,
>>>> unsigned int, char *);
>>>>
>>>> #ifdef CONFIG_SUSPEND
>>>> diff --git a/kernel/power/swap.c b/kernel/power/swap.c
>>>> index 3c01105..caf4db8 100644
>>>> --- a/kernel/power/swap.c
>>>> +++ b/kernel/power/swap.c
>>>> @@ -45,7 +45,8 @@ struct swap_map_page {
>>>> };
>>>>
>>>> struct swsusp_header {
>>>> - char reserved[PAGE_SIZE - 20 - sizeof(sector_t) - sizeof(int)];
>>>> + char reserved[PAGE_SIZE - 21 - sizeof(sector_t) - sizeof(int)];
>>>> + char write_speed;
>>>> sector_t image;
>>>> unsigned int flags; /* Flags to pass to the "boot" kernel */
>>>> char orig_sig[10];
>>>> @@ -161,6 +162,7 @@ int swsusp_swap_in_use(void)
>>>>
>>>> static unsigned short root_swap = 0xffff;
>>>> struct block_device *hib_resume_bdev;
>>>> +char __nosavedata write_speed, read_speed;
>>>
>>> I really should have noticed that earlier, but I don't really like __nosavedata
>>> being used here. In fact, it shouldn't be used at all any more, because it's
>>> meaningless on x86_64.
>>
>> Really? Okay. When did that change?
>
> Well, some time ago, looks like in 2007, but the files changed and were moving
> around, so it's hard to say exactly.
Hmm. Really failed to notice that one, didn't I? :)
>>> I'm not sure how to implement that without __nosavedata, but please don't
>>> use it. Sorry aboiut that.
>>
>> Well then, for now, let's drop that patch then. At least it's got us the
>> numbers we needed to see these patches are useful. Longer term, I'll do
>> what I do in TuxOnIce and allocate a page while writing the image, store
>> it's location in the image header and use it the transfer information
>> from the boot kernel to the resumed kernel. (Essentially the same thing,
>> except without the special section).
>
> The problem is that on x86_64 the boot kernel may be completely different
> from the image kernel (different version, different configuration), so there is
> no guarantee that your page frame allocated while writing the image would be
> available to the boot kernel (it may contain the kernel code, for example).
>
> You'd really need to replace one of the image pages with something prepared
> while the image was being read. For that, you'd need to allocate a page before
> creating the image and pass its PFN in the image header.
Yes - that's what I'm doing. Maybe that's why the __nosavedata changes
you mentioned above haven't bitten me.
Regards,
Nigel
next prev parent reply other threads:[~2010-09-27 21:05 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-27 5:43 Swsusp patches applied to suspend-2.6#linux-next Nigel Cunningham
2010-09-27 5:43 ` [PATCH 01/23] Hibernation: Split compression support out Nigel Cunningham
2010-09-27 20:27 ` Rafael J. Wysocki
2010-09-27 20:32 ` Nigel Cunningham
2010-10-01 21:28 ` Rafael J. Wysocki
2010-10-01 21:45 ` Nigel Cunningham
2010-10-01 22:15 ` Rafael J. Wysocki
2010-09-27 5:43 ` [PATCH 02/23] Record & display i/o speed post resume Nigel Cunningham
2010-09-27 20:06 ` Rafael J. Wysocki
2010-09-27 20:26 ` Nigel Cunningham
2010-09-27 20:49 ` Rafael J. Wysocki
2010-09-27 21:05 ` Nigel Cunningham [this message]
2010-09-27 21:16 ` Rafael J. Wysocki
2010-09-27 5:43 ` [PATCH 03/23] Hibernation: Swap iteration functions Nigel Cunningham
2010-10-04 17:54 ` [linux-pm] " Pavel Machek
2010-10-06 1:22 ` Nigel Cunningham
2010-09-27 5:43 ` [PATCH 04/23] Hibernation: Move root_swap declaration Nigel Cunningham
2010-09-27 5:43 ` [PATCH 05/23] Hibernation: Add mass swap allocation routine Nigel Cunningham
2010-09-27 5:43 ` [PATCH 06/23] Hibernation: Switch to preallocating swap Nigel Cunningham
2010-09-27 5:43 ` [PATCH 07/23] Hiberation: Fix speed display Nigel Cunningham
2010-10-04 17:51 ` [linux-pm] " Pavel Machek
2010-09-27 5:43 ` [PATCH 08/23] Hibernation: Generic extents support Nigel Cunningham
2010-10-04 17:51 ` [linux-pm] " Pavel Machek
2010-10-06 1:21 ` Nigel Cunningham
2010-09-27 5:43 ` [PATCH 09/23] Hibernation: Iterate over sectors not swap entries Nigel Cunningham
2010-09-27 5:43 ` [PATCH 10/23] Hibernation: Stop passing swap_map_handle struct Nigel Cunningham
2010-09-27 5:43 ` [PATCH 11/23] Hibernation: Stop passing bio_chain around Nigel Cunningham
2010-09-27 5:43 ` [PATCH 12/23] Hibernation: Move block i/o fns to block_io.c Nigel Cunningham
2010-09-27 5:43 ` [PATCH 13/23] Hibernation: Partial page I/O support Nigel Cunningham
2010-10-13 7:10 ` Pavel Machek
2010-10-13 20:28 ` Rafael J. Wysocki
2010-10-13 21:17 ` Nigel Cunningham
2010-09-27 5:43 ` [PATCH 14/23] Hibernation: Store block extents at start of image Nigel Cunningham
2010-09-27 5:43 ` [PATCH 15/23] Hibernation: Use block extents for reading image Nigel Cunningham
2010-09-27 5:43 ` [PATCH 16/23] Remove first_sector from swap_map_handle Nigel Cunningham
2010-09-27 5:43 ` [PATCH 17/23] Hibernation: Replace bio chain Nigel Cunningham
2010-09-27 5:43 ` [PATCH 18/23] Hibernation: Remove swap_map_pages Nigel Cunningham
2010-09-27 5:43 ` [PATCH 19/23] Hibernation: Remove wait_on_bio_chain result Nigel Cunningham
2010-09-27 5:43 ` [PATCH 20/23] Hibernation: Prepare for handle.cur removal Nigel Cunningham
2010-09-27 5:43 ` [PATCH 21/23] Hibernation: Remove swap_map structure Nigel Cunningham
2010-09-27 5:43 ` [PATCH 22/23] Hibernation: Remove now-empty routines Nigel Cunningham
2010-09-27 5:43 ` [PATCH 23/23] Hibernate: Implement readahead when resuming Nigel Cunningham
2010-09-27 6:59 ` [TuxOnIce-devel] Swsusp patches applied to suspend-2.6#linux-next Andrey Rahmatullin
2010-09-27 8:28 ` Nigel Cunningham
2010-09-27 8:00 ` Andrey Rahmatullin
2010-09-27 8:29 ` Nigel Cunningham
2010-09-27 9:38 ` Andrey Rahmatullin
2010-09-27 9:57 ` Nigel Cunningham
2010-09-27 11:16 ` Andrey Rahmatullin
2010-09-27 11:39 ` Nigel Cunningham
2010-10-02 16:49 ` [linux-pm] " Martin Steigerwald
2010-10-04 8:00 ` Martin Steigerwald
2010-10-04 8:31 ` Nigel Cunningham
2010-10-04 8:55 ` Martin Steigerwald
2010-10-04 8:47 ` Martin Steigerwald
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CA10729.5010001@tuxonice.net \
--to=nigel@tuxonice.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rjw@sisk.pl \
--cc=tuxonice-devel@tuxonice.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox