Re: [PATCH v3] x86: mm: Do not use set_{pud,pmd}_safe when splitting the large page

From: Dave Hansen
Date: Wed Apr 17 2019 - 13:24:27 EST


On 4/17/19 8:41 AM, Singh, Brijesh wrote:
> Changes since v2:
> - rename variable safe->init
> - rename __set_* -> set_*_init()
> - remame __*_populate -> *_populate_init()

"init" in this context really means "setting non-present PTEs is OK, but
changing present ones is not". It still doesn't do a great job of
conveying that because both the init=0 and init=1 variants are used
during init-time.

> +/*
> + * Create page table mapping for the physical memory for specific physical
> + * addresses. The virtual and physical addresses have to be aligned on PMD level
> + * down. It returns the last physical address mapped.
> + */
> +unsigned long __meminit
> +kernel_physical_mapping_init(unsigned long paddr_start,
> + unsigned long paddr_end,
> + unsigned long page_size_mask)
> +{
> + return __kernel_physical_mapping_init(paddr_start, paddr_end,
> + page_size_mask, true);
> +}

The comment here is missing one key point:
kernel_physical_mapping_init() can only be used to populate non-present
entries. It kinda infers that from "Create...", but I really think we
need to be explicit.

Anyway, it's better than it was, and it does fix a bug, so:

Reviewed-by: Dave Hansen <dave.hansen@xxxxxxxxx>

But please flesh out that comment if you do another version for some reason.