• Chen Yu's avatar
    x86/boot/e820: Introduce the bootloader provided e820_table_firmware[] table · 12df216c
    Chen Yu authored
    Add the real e820_tabel_firmware[] that will not be modified by the kernel
    or the EFI boot stub under any circumstance.
    
    In addition to that modify the code so that e820_table_firmwarep[] is
    exposed via sysfs to represent the real firmware memory layout,
    rather than exposing the e820_table_kexec[] table.
    
    This fixes a hibernation bug/warning, which uses e820_table_kexec[] to check
    RAM layout consistency across hibernation/resume:
    
      The suspend kernel:
      [    0.000000] e820: update [mem 0x76671018-0x76679457] usable ==> usable
    
      The resume kernel:
      [    0.000000] e820: update [mem 0x7666f018-0x76677457] usable ==> usable
      ...
      [   15.752088] PM: Using 3 thread(s) for decompression.
      [   15.752088] PM: Loading and decompressing image data (471870 pages)...
      [   15.764971] Hibernate inconsistent memory map detected!
      [   15.770833] PM: Image mismatch: architecture specific data
    
    Actually it is safe to restore these pages because E820_TYPE_RAM and
    E820_TYPE_RESERVED_KERN are treated the same during hibernation, so
    the original e820 table provided by the bootloader is used for
    hibernation MD5 fingerprint checking.
    
    The side effect is that, this newly introduced variable might increase the
    kernel size at compile time.
    Suggested-by: default avatarIngo Molnar <mingo@redhat.com>
    Signed-off-by: default avatarChen Yu <yu.c.chen@intel.com>
    Cc: Dave Young <dyoung@redhat.com>
    Cc: Len Brown <lenb@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Xunlei Pang <xlpang@redhat.com>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    12df216c
e820.c 34.3 KB