Re: [PATCH] PM: hibernate: flush icache for restored pages from task context

Will Deacon <[email protected]>
Newsgroups org.kernel.vger.linux-pm
Message-ID <anRsSeUlxP0-I3tG@willie-the-truck>
On Thu, Aug 06, 2026 at 08:56:18AM +0800, Xiong Xin wrote:
> > On Mon, Aug 03, 2026 at 01:54:12PM +0800, Xiong Xin wrote:
> > > When resuming from hibernation with `hibernate=nocompress`, the kernel
> > > loads the image via load_image(), which submits read bios asynchronously
> > > and waits on them with hib_wait_io(). The bio completion callback
> > > hib_end_io() runs from the block IRQ/softirq path.
> > > 
> > > Commit f6cf0545ec69 ("PM / Hibernate: Call flush_icache_range() on pages
> > > restored in-place") added a flush_icache_range() call inside hib_end_io()
> > > (under clean_pages_on_read). On architectures such as ARM64,
> > > flush_icache_range() ends with kick_all_cpus_sync() -> smp_call_function()
> > > (wait=1), which contains:
> > > 
> > >      WARN_ON_ONCE(!in_task());
> > > 
> > > Because hib_end_io() executes in hardirq/softirq context, in_task() is
> > > always false there, and the WARN fires which happens while the resume
> > > task is asleep in hib_wait_io() and the CPU is idle, the warning log as
> > > follows:
> > 
> > Hmm, do we have any secondary CPUs online at this point? I wonder if
> > either smp_call_function() could push the WARN() down into the branch
> > where it knows it is going to call remotely or whether we could elide
> > the call to kick_all_cpus_sync() altogether in that case?
> 
> Thanks for the review.
> 
> Q1: Do we have any secondary CPUs online at this point?
> 
> Yes, the secondary CPUs are online, but they are all (almost) in the idle
> loop state. 

Ah, nevermind then. I don't think we can elide the cross-call in the
low-level code in that case. Sorry for the bad suggestion!

Will
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.