Re: [PATCH RFC v2 08/54] x86/mm/pat: fail a split at an unexpected level with -EINVAL

From: Rik van Riel

Date: Thu Dec 03 2026 - 12:04:49 EST


On Thu, 2026-11-26 at 13:14 +0200, Mike Rapoport (Microsoft) wrote:
> __split_large_page() returns 1 when it encounters an unexpected
> level, or
> when another CPU split the large page first.
>
> split_large_page() frees the page table and returns 0 in both cases,
> and
> __change_page_attr() looks the address up and tries again. For an
> unexpected level it tries forever.
>
> Getting there would be a bug, because no mappings ever use P4D
> leaves.
> Still, a level CPA cannot split should fail the request rather than
> loop.
>
> Return -EINVAL for an unexpected level and pass it up to the caller.
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
>
Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>

--
All Rights Reversed.