mbox series

[v3,0/2] Resolve problems with kexec identity mapping

Message ID 20240717213121.3064030-1-steve.wahl@hpe.com
Headers show
Series Resolve problems with kexec identity mapping | expand

Message

Steve Wahl July 17, 2024, 9:31 p.m. UTC
Creating kexec identity maps using only GB pages can include a lot of
extra address space past that requested, including areas marked
reserved by the BIOS, which on UV systems can cause system halts.

The previous attempt to fix this problem,

       7143c5f4cf20 ("x86/mm/ident_map: Use gbpages only where full GB page should be mapped.")

caused a regression on a small number of AMD systems, and was later reverted.

The cause of this regression was that the EFI Config Table Array was
not explicitly included in the kexec identity map. While this array was
often included in the identity map by luck, when it was not, code that
checks whether the AMD SEV feature should be enabled takes a page
fault due to the array's address not being mapped.  This happens before
the new kernel is able to set up a page fault handler, so it is fatal.

The patch that was reverted greatly reduced the chance that the EFI
Config Table Array got mapped by luck, which is why this problem
appeared.  The kernel command line option "nogbpages" also causes the
problem to show, and was used for debugging and illustrative purposes.

The first patch in this series explicitly adds the EFI Config Table
array to the kexec identity map so this problem will not occur.

The second patch in the series re-instates the previously reverted
patch that reduces usage of gbpages in creating the identity map.

All three of the people who reported regression with my earlier patch
have retested with this patch series and found it to work where my
single patch previously did not.  With current kernels, all fail to
kexec when "nogbpages" is on the command line, but all succeed with
"nogbpages" after the series is applied.

Series version 3:
  * In patch 1, do not change name of map_efi_systab, and fix comment.

Series version 2:

  * Removed a patch (formerly #2) that also added the CC blob to the
    identity map, as this was proactive, but not proved necessary.

  * Rewrote this cover letter and patch commit messages to include
    discussion on previous version.

V1: https://lore.kernel.org/all/20240520183633.1457687-1-steve.wahl@hpe.com/

Steve Wahl (1):
  x86/mm/ident_map: Use gbpages only where full GB page should be
    mapped.

Tao Liu (1):
  x86/kexec: Add EFI config table identity mapping for kexec kernel

 arch/x86/kernel/machine_kexec_64.c | 27 +++++++++++++++++++++++++++
 arch/x86/mm/ident_map.c            | 23 ++++++++++++++++++-----
 2 files changed, 45 insertions(+), 5 deletions(-)