linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Sukrit.Bhatnagar@sony.com" <Sukrit.Bhatnagar@sony.com>
To: Chris Li <chrisl@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>,
	Christian Brauner <brauner@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>
Subject: RE: [PATCH 1/2] iomap: swap: print warning for unaligned swapfile
Date: Mon, 27 May 2024 10:54:52 +0000	[thread overview]
Message-ID: <TYAPR01MB4048777DF18179228A7A786BF6F02@TYAPR01MB4048.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CANeU7Qn5KmdA2bVmEMjFtxcP+WnE174VgtkXZEHX82fc-gxXhg@mail.gmail.com>

Hi Chris,

On 2024-05-23 03:02, Chris Li wrote:
> Hi Sukrit,
> 
> It seems that you need the swap file block start address to read the
> swap file headers.
> This warning still requires the user to read the dmesg. The kernel
> still does not have the swapfile header at resume. In other words, it
> does not fix the issue.

This was not intended to be a fix.

I had created this patch thinking that adding an actual fix for this might
be non-trivial and may not be desirable to everyone, especially when
swapfile+hibernation is not commonly used.

> I don't know the suspend/resume code enough, will adding recording the
> physical start address of the swapfile in swap_info_struct help you
> address this problem? The suspend code can write that value to
> "somewhere* for resume to pick it up.
> 
> Let's find a proper way to fix this issue rather than just warning on it.
 
Adding a new member in swap_info_struct for the physical block offset
will help in the fix, I think. It can even be enclosed in #ifdef HIBERNATION
if nothing else needs that value.
This value can be checked by hibernate[1] as:
    sis->start_offset == first_se(sis)->start_block

Another possible solution might be to add a new swap flag like SWP_SUSP
or SWP_HIBERNATE and set it only when we don't have this rounding up
issue.

Since we will boot the kernel normally first and later switch to our
pre-hibernate kernel after image load from swap, the value cannot be
set inside the kernel memory.
We pass the start block address in kernel commandline parameter
(resume_offset) for next boot.

[1]: The hibernate swapfile checking code is the function
    swap_type_of() in mm/swapfile.c

--
Sukrit


  reply	other threads:[~2024-05-27 10:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22  7:46 [PATCH 0/2] Improve dmesg output for swapfile+hibernation Sukrit Bhatnagar
2024-05-22  7:46 ` [PATCH 1/2] iomap: swap: print warning for unaligned swapfile Sukrit Bhatnagar
2024-05-22 18:02   ` Chris Li
2024-05-27 10:54     ` Sukrit.Bhatnagar [this message]
2024-05-22  7:46 ` [PATCH 2/2] mm: swap: print starting physical block offset in swapon Sukrit Bhatnagar
2024-05-22 14:56   ` Darrick J. Wong
2024-05-22 14:59     ` Christoph Hellwig
2024-05-27 11:02     ` Sukrit.Bhatnagar
2024-05-23 19:45 ` [PATCH 0/2] Improve dmesg output for swapfile+hibernation Pavel Machek
2024-05-27 11:06   ` Sukrit.Bhatnagar
2024-05-27 11:20     ` Christoph Hellwig
2024-05-27 12:51       ` Sukrit.Bhatnagar
2024-05-27 12:58         ` Christoph Hellwig
2024-05-31 14:15           ` Sukrit.Bhatnagar

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=TYAPR01MB4048777DF18179228A7A786BF6F02@TYAPR01MB4048.jpnprd01.prod.outlook.com \
    --to=sukrit.bhatnagar@sony.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=chrisl@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    /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