public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: Brian Geffon <bgeffon@google.com>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH] PM: hibernate: Drain trailing zero pages on userspace restore
Date: Mon, 9 Mar 2026 16:57:56 +0100	[thread overview]
Message-ID: <aa7uBMrSII5l-Ofl@igalia.com> (raw)
In-Reply-To: <CADyq12z_mhjY9S1_jawX8UuviyYf-ozXn6Q6yB4dHxopD7JmTg@mail.gmail.com>

On Mon, Mar 09, 2026 at 11:01:15AM -0400, Brian Geffon wrote:
> > An alternative solution would be to do it at the beginning of
> > snapshot_write_finalize() if handle->cur > nr_meta_pages + 1.
> 
> I think this makes sense, but if snapshot_write_next() returns
> PAGE_SIZE then we need to indicate some error (eg. -ENODATA) in that
> the kernel was still expecting another copy page.

This would fail anyway in snapshot_image_loaded() because of this
condition:

   handle->cur <= nr_meta_pages + nr_copy_pages + nr_zero_pages

But I think it make sense to return an error directly from
snapshot_write_finalize() as you suggest, I can use -ENODATA.

> Also it appears that the kernel restore path and the userspace restore
> path return two different error codes for !snapshot_image_loaded(),
> the former does -ENODATA and the latter -EPERM.

Yes, -EPERM is the one that I hit in my tests.

Does this need to be corrected?

Berto

  reply	other threads:[~2026-03-09 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  0:12 [PATCH] PM: hibernate: Drain trailing zero pages on userspace restore Alberto Garcia
2026-03-09 11:26 ` Alberto Garcia
2026-03-09 15:01   ` Brian Geffon
2026-03-09 15:57     ` Alberto Garcia [this message]
2026-03-09 16:08       ` Brian Geffon

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=aa7uBMrSII5l-Ofl@igalia.com \
    --to=berto@igalia.com \
    --cc=bgeffon@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --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