Re: [RFC][PATCH] kexec: Teach indirect pages how to live in high memory

From: Joonsoo Kim
Date: Thu Oct 08 2020 - 21:35:39 EST


On Tue, May 05, 2020 at 01:39:16PM -0500, Eric W. Biederman wrote:
> Hari Bathini <hbathini@xxxxxxxxxxxxx> writes:
>
> > On 05/05/20 3:29 am, Eric W. Biederman wrote:
> >>
> >> Recently a patch was proposed to kimage_alloc_page to slightly alter
> >> the logic of how pages allocated with incompatible flags were
> >> detected. The logic was being altered because the semantics of the
> >> page alloctor were changing yet again.
> >>
> >> Looking at that case I realized that there is no reason for it to even
> >> exist. Either the indirect page allocations and the source page
> >> allocations could be separated out, or I could do as I am doing now
> >> and simply teach the indirect pages to live in high memory.
> >>
> >> This patch replaced pointers of type kimage_entry_t * with a new type
> >> kimage_entry_pos_t. This new type holds the physical address of the
> >> indirect page and the offset within that page of the next indirect
> >> entry to write. A special constant KIMAGE_ENTRY_POS_INVALID is added
> >> that kimage_image_pos_t variables that don't currently have a valid
> >> may be set to.
> >>
> >> Two new functions kimage_read_entry and kimage_write_entry have been
> >> provided to write entries in way that works if they live in high
> >> memory.
> >>
> >> The now unnecessary checks to see if a destination entry is non-zero
> >> and to increment it if so have been removed. For safety new indrect
> >> pages are now cleared so we have a guarantee everything that has not
> >> been used yet is zero. Along with this writing an extra trailing 0
> >> entry has been removed, as it is known all trailing entries are now 0.
> >>
> >> With highmem support implemented for indirect pages
> >> kimage_image_alloc_page has been updated to always allocate
> >> GFP_HIGHUSER pages, and handling of pages with different
> >> gfp flags has been removed.
> >>
> >> Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
> >
> > Eric, the patch failed with data access exception on ppc64. Using the below patch on top
> > got me going...
>
> Doh! Somehow I thought I had put that logic or something equivalent
> into kimage_write_entry and it appears I did not. I will see if I can
> respin the patch.
>
> Thank you very much for testing.

Hello, Eric.

It seems that this patch isn't upstreamed.
Could you respin the patch?
I've tested this one on x86_32 (highmem enabled) and it works well.

Thanks.