From: Guenter Roeck <linux@roeck-us.net>
To: Jianpeng Chang <jianpeng.chang.cn@windriver.com>
Cc: catalin.marinas@arm.com, will@kernel.org,
ying.huang@linux.alibaba.com, ardb@kernel.org,
anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [v3 PATCH] arm64: mm: Fix kexec failure after pte_mkwrite_novma() change
Date: Thu, 12 Feb 2026 10:51:45 -0800 [thread overview]
Message-ID: <73e9c019-abd8-4914-a70a-277142e4f306@roeck-us.net> (raw)
In-Reply-To: <20251204062722.3367201-1-jianpeng.chang.cn@windriver.com>
Hi,
On Thu, Dec 04, 2025 at 02:27:22PM +0800, Jianpeng Chang wrote:
> Commit 143937ca51cc ("arm64, mm: avoid always making PTE dirty in
> pte_mkwrite()") modified pte_mkwrite_novma() to only clear PTE_RDONLY
> when the page is already dirty (PTE_DIRTY is set). While this optimization
> prevents unnecessary dirty page marking in normal memory management paths,
> it breaks kexec on some platforms like NXP LS1043.
>
> The issue occurs in the kexec code path:
> 1. machine_kexec_post_load() calls trans_pgd_create_copy() to create a
> writable copy of the linear mapping
> 2. _copy_pte() calls pte_mkwrite_novma() to ensure all pages in the copy
> are writable for the new kernel image copying
> 3. With the new logic, clean pages (without PTE_DIRTY) remain read-only
> 4. When kexec tries to copy the new kernel image through the linear
> mapping, it fails on read-only pages, causing the system to hang
> after "Bye!"
>
> The same issue affects hibernation which uses the same trans_pgd code path.
>
> Fix this by marking pages dirty with pte_mkdirty() in _copy_pte(), which
> ensures pte_mkwrite_novma() clears PTE_RDONLY for both kexec and
> hibernation, making all pages in the temporary mapping writable regardless
> of their dirty state. This preserves the original commit's optimization
> for normal memory management while fixing the kexec/hibernation regression.
>
> Using pte_mkdirty() causes redundant bit operations when the page is
> already writable (redundant PTE_RDONLY clearing), but this is acceptable
> since it's not a hot path and only affects kexec/hibernation scenarios.
>
> Fixes: 143937ca51cc ("arm64, mm: avoid always making PTE dirty in pte_mkwrite()")
> Signed-off-by: Jianpeng Chang <jianpeng.chang.cn@windriver.com>
> Reviewed-by: Huang Ying <ying.huang@linux.alibaba.com>
We (Google) experience this problem with servers utilizing the Ampere Siryn
CPU. It now bubbled down all the way to v6.6.y (and maybe further),
essentially making kexec unusable on affected systems unless the backport
of commit 143937ca51cc is dropped.
What is the status of this patch ?
Thanks,
Guenter
next prev parent reply other threads:[~2026-02-12 18:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 6:27 Jianpeng Chang
2025-12-04 8:07 ` Anshuman Khandual
2025-12-04 8:16 ` Chang, Jianpeng (CN)
2025-12-10 7:31 ` Jianpeng Chang
2026-01-02 18:53 ` Catalin Marinas
2026-01-06 13:30 ` Huang, Ying
2026-01-09 11:51 ` Will Deacon
2026-02-12 18:51 ` Guenter Roeck [this message]
2026-02-13 11:56 ` Will Deacon
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=73e9c019-abd8-4914-a70a-277142e4f306@roeck-us.net \
--to=linux@roeck-us.net \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jianpeng.chang.cn@windriver.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
--cc=ying.huang@linux.alibaba.com \
/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®