mbox series

[PATCHv4,REBASED,0/4] x86: Reduce code duplication on page table initialization

Message ID 20241016111458.846228-1-kirill.shutemov@linux.intel.com (mailing list archive)
Headers show
Series x86: Reduce code duplication on page table initialization | expand

Message

Kirill A. Shutemov Oct. 16, 2024, 11:14 a.m. UTC
Use kernel_ident_mapping_init() to initialize kernel page tables where
possible, replacing manual initialization, reducing code duplication.

v4:
 - Reviewed-bys from Kai;
 - Fix comment in acpi_mp_setup_reset() (Rafael);
v3:
 - Reviewed-bys from Tom;
 - Improve commit messages;
v2:
 - A separate patch to change what PA is mapped at relocate_kernel() VA.
 - Improve commit messages;
 - Add Reveiwed-by from Kai;

Kirill A. Shutemov (4):
  x86/mm/ident_map: Fix virtual address wrap to zero
  x86/acpi: Replace manual page table initialization with
    kernel_ident_mapping_init()
  x86/64/kexec: Map original relocate_kernel() in
    init_transition_pgtable()
  x86/64/kexec: Rewrite init_transition_pgtable() with
    kernel_ident_mapping_init()

 arch/x86/include/asm/kexec.h       |  5 +-
 arch/x86/kernel/acpi/madt_wakeup.c | 73 +++++-------------------
 arch/x86/kernel/machine_kexec_64.c | 89 +++++++++++-------------------
 arch/x86/mm/ident_map.c            | 14 +----
 4 files changed, 50 insertions(+), 131 deletions(-)

Comments

Kirill A. Shutemov Oct. 29, 2024, 3:09 p.m. UTC | #1
On Wed, Oct 16, 2024 at 02:14:54PM +0300, Kirill A. Shutemov wrote:
> Use kernel_ident_mapping_init() to initialize kernel page tables where
> possible, replacing manual initialization, reducing code duplication.
> 
> v4:
>  - Reviewed-bys from Kai;
>  - Fix comment in acpi_mp_setup_reset() (Rafael);
> v3:
>  - Reviewed-bys from Tom;
>  - Improve commit messages;
> v2:
>  - A separate patch to change what PA is mapped at relocate_kernel() VA.
>  - Improve commit messages;
>  - Add Reveiwed-by from Kai;
> 
> Kirill A. Shutemov (4):
>   x86/mm/ident_map: Fix virtual address wrap to zero
>   x86/acpi: Replace manual page table initialization with
>     kernel_ident_mapping_init()
>   x86/64/kexec: Map original relocate_kernel() in
>     init_transition_pgtable()
>   x86/64/kexec: Rewrite init_transition_pgtable() with
>     kernel_ident_mapping_init()
> 
>  arch/x86/include/asm/kexec.h       |  5 +-
>  arch/x86/kernel/acpi/madt_wakeup.c | 73 +++++-------------------
>  arch/x86/kernel/machine_kexec_64.c | 89 +++++++++++-------------------
>  arch/x86/mm/ident_map.c            | 14 +----
>  4 files changed, 50 insertions(+), 131 deletions(-)

Any feedback on this series?
Dave Hansen Oct. 31, 2024, 4:21 p.m. UTC | #2
On 10/29/24 08:09, Kirill A. Shutemov wrote:
> Any feedback on this series?

It's tempting because it removes so much code, but it's also worrying
because these code paths are notoriously hard to test.

I'd be much happier if you'd send this after 6.13-rc1 drops and we give
it as much testing time as possible.
Ingo Molnar March 10, 2025, 7:45 p.m. UTC | #3
* Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote:

> Use kernel_ident_mapping_init() to initialize kernel page tables where
> possible, replacing manual initialization, reducing code duplication.
> 
> v4:
>  - Reviewed-bys from Kai;
>  - Fix comment in acpi_mp_setup_reset() (Rafael);
> v3:
>  - Reviewed-bys from Tom;
>  - Improve commit messages;
> v2:
>  - A separate patch to change what PA is mapped at relocate_kernel() VA.
>  - Improve commit messages;
>  - Add Reveiwed-by from Kai;
> 
> Kirill A. Shutemov (4):
>   x86/mm/ident_map: Fix virtual address wrap to zero
>   x86/acpi: Replace manual page table initialization with kernel_ident_mapping_init()
>   x86/64/kexec: Map original relocate_kernel() in init_transition_pgtable()
>   x86/64/kexec: Rewrite init_transition_pgtable() with kernel_ident_mapping_init()
> 
>  arch/x86/include/asm/kexec.h       |  5 +-
>  arch/x86/kernel/acpi/madt_wakeup.c | 73 +++++-------------------
>  arch/x86/kernel/machine_kexec_64.c | 89 +++++++++++-------------------
>  arch/x86/mm/ident_map.c            | 14 +----
>  4 files changed, 50 insertions(+), 131 deletions(-)

So looks like this series feel between the cracks during the holiday 
season.

To help move them along, I've fixed up the first patch with the review 
feedback clarification requests, and applied patch #1 and #2 to 
tip:x86/mm:

  4f10ec03fe1e ("x86/mm/ident_map: Fix theoretical virtual address overflow to zero")
  376daf20eda4 ("x86/acpi: Replace manual page table initialization with kernel_ident_mapping_init()")

Patches #3 and #4 don't apply anymore, due to interference by other 
work with commits like:

  4b5bc2ec9a23 ("x86/kexec: Allocate PGD for x86_64 transition page tables separately")

If the remaining patches are still relevant, mind porting them to 
latest -tip?

Thanks,

	Ingo