[PATCH v2 10/11] PM / Hibernate: clean cached pages on architectures that require it

Lorenzo Pieralisi lorenzo.pieralisi at arm.com
Thu Nov 12 03:52:33 PST 2015

On Thu, Nov 12, 2015 at 02:53:35AM +0000, Chen, Yu C wrote:


> > > static inline void do_copy_page(long *dst, long *src)  {
> > >  	int n;
> > > +	unsigned long __maybe_unused start = (unsigned long)dst;
> > >
> > >  	for (n = PAGE_SIZE / sizeof(long); n; n--)
> > >  		*dst++ = *src++;
> > > +
> > > +	flush_icache_range(start, start+PAGE_SIZE);
> > >  }
> How about invalid all icache lines before doing do_copy_page, since
> do_copy_page might deal with both data pages and execute pages, that might be
> redundant to do it for every page?

The point here is to make sure I-cache and D-cache are in sync, because
the page we are copying can be executable code, so flush_icache_range is
there to make sure that the code is cleaned from the D-cache to a cache
level that is visible to the I-cache (yes, the I-cache range is
invalidate too in the process).

I agree it is redundant for data pages, the point is, you do not really
know what you are copying at this stage, we can extend the snapshot
code to flag the pages accordingly, but it might well be overkill, so
we posted this patch to get consensus before proceeding.


More information about the linux-arm-kernel mailing list