mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: catalin.marinas@arm.com, will@kernel.org, rafael@kernel.org,
	mark.rutland@arm.com, lenb@kernel.org, pavel@kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, thierry.reding@kernel.org
Subject: Re: [PATCH v1 1/4] PM: hibernate: Add arch specific hooks for hibernate_map/unmap_page
Date: Tue, 22 Sep 2026 08:55:03 +0300	[thread overview]
Message-ID: <arIYNzM7kiKlr21r@kernel.org> (raw)
In-Reply-To: <20260918131656.3710047-2-vdonnefort@google.com>

Hi Vincent,

On Fri, Sep 18, 2026 at 02:16:53PM +0100, Vincent Donnefort wrote:
> hibernate_map_page() is called from an atomic context. This is
> problematic for Arm BBML3 systems where the linear map may contain
> blocks and is allowed to split as splitting is a sleepable operation.
> 
> Add arch hook so arm64 can define its own implementation without relying
> on the direct map.

I posted patches that remove set_direct_map usage from hibernation:

https://lore.kernel.org/all/20260917-hibernation-v1-0-7f7dfae3dbe0@kernel.org
 
So I really hope this patch won't be needed :)

> Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
> ---
>  include/linux/suspend.h |  2 ++
>  kernel/power/snapshot.c | 10 ++++++----
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index b02876f1ae38..10fe2298d94e 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -401,6 +401,8 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data);
>  int hibernate_resume_nonboot_cpu_disable(void);
>  int arch_hibernation_header_save(void *addr, unsigned int max_size);
>  int arch_hibernation_header_restore(void *addr);
> +void *hibernate_map_page(struct page *page);
> +void hibernate_unmap_page(struct page *page);
>  
>  #else /* CONFIG_HIBERNATION */
>  static inline void register_nosave_region(unsigned long b, unsigned long e) {}
> diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
> index b209712cb2c3..b41952f1de2a 100644
> --- a/kernel/power/snapshot.c
> +++ b/kernel/power/snapshot.c
> @@ -85,7 +85,7 @@ static inline int hibernate_restore_unprotect_page(void *page_address) {return 0
>   * It is still worth to have a warning here if something changes and this
>   * will no longer be the case.
>   */
> -static inline void hibernate_map_page(struct page *page)
> +void * __weak hibernate_map_page(struct page *page)
>  {
>  	if (IS_ENABLED(CONFIG_ARCH_HAS_SET_DIRECT_MAP)) {
>  		int ret = set_direct_map_default_noflush(page);
> @@ -95,9 +95,10 @@ static inline void hibernate_map_page(struct page *page)
>  	} else {
>  		debug_pagealloc_map_pages(page, 1);
>  	}
> +	return page_address(page);
>  }
>  
> -static inline void hibernate_unmap_page(struct page *page)
> +void __weak hibernate_unmap_page(struct page *page)
>  {
>  	if (IS_ENABLED(CONFIG_ARCH_HAS_SET_DIRECT_MAP)) {
>  		unsigned long addr = (unsigned long)page_address(page);
> @@ -1456,8 +1457,9 @@ static bool safe_copy_page(void *dst, struct page *s_page)
>  	if (kernel_page_present(s_page)) {
>  		zeros_only = do_copy_page(dst, page_address(s_page));
>  	} else {
> -		hibernate_map_page(s_page);
> -		zeros_only = do_copy_page(dst, page_address(s_page));
> +		void *src = hibernate_map_page(s_page);
> +
> +		zeros_only = do_copy_page(dst, src);
>  		hibernate_unmap_page(s_page);
>  	}
>  	return zeros_only;
> -- 
> 2.55.0.1082.g2b9226bbc0-goog
> 

-- 
Sincerely yours,
Mike.

  reply	other threads:[~2026-09-22  5:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 13:16 [PATCH v1 0/4] arm64: mm: Allow set_direct_map functions on BBML3 systems Vincent Donnefort
2026-09-18 13:16 ` [PATCH v1 1/4] PM: hibernate: Add arch specific hooks for hibernate_map/unmap_page Vincent Donnefort
2026-09-22  5:55   ` Mike Rapoport [this message]
2026-09-18 13:16 ` [PATCH v1 2/4] arm64: hibernate: Use fixmap " Vincent Donnefort
2026-09-18 13:16 ` [PATCH v1 3/4] arm64: mm: Introduce linear_map_needs_set() helper Vincent Donnefort
2026-09-18 13:16 ` [PATCH v1 4/4] arm64: mm: Allow can_set_direct_map() on BBML3 systems Vincent Donnefort

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=arIYNzM7kiKlr21r@kernel.org \
    --to=rppt@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=thierry.reding@kernel.org \
    --cc=vdonnefort@google.com \
    --cc=will@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

all inboxes | Powered by JetHome®