Patch "x86/asm: Reorder early variables" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/asm: Reorder early variables

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-asm-reorder-early-variables.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 412ac67de3c22418683b90fb02c0926a1789278c
Author: Jiri Slaby <jirislaby@xxxxxxxxxx>
Date:   Thu Oct 3 11:52:37 2019 +0200

    x86/asm: Reorder early variables
    
    [ Upstream commit 1a8770b746bd05ef68217989cd723b2c24d2208d ]
    
    Moving early_recursion_flag (4 bytes) after early_level4_pgt (4k) and
    early_dynamic_pgts (256k) saves 4k which are used for alignment of
    early_level4_pgt after early_recursion_flag.
    
    The real improvement is merely on the source code side. Previously it
    was:
    * __INITDATA + .balign
    * early_recursion_flag variable
    * a ton of CPP MACROS
    * __INITDATA (again)
    * early_top_pgt and early_recursion_flag variables
    * .data
    
    Now, it is a bit simpler:
    * a ton of CPP MACROS
    * __INITDATA + .balign
    * early_top_pgt and early_recursion_flag variables
    * early_recursion_flag variable
    * .data
    
    On the binary level the change looks like this:
    Before:
     (sections)
      12 .init.data    00042000  0000000000000000  0000000000000000 00008000  2**12
     (symbols)
      000000       4 OBJECT  GLOBAL DEFAULT   22 early_recursion_flag
      001000    4096 OBJECT  GLOBAL DEFAULT   22 early_top_pgt
      002000 0x40000 OBJECT  GLOBAL DEFAULT   22 early_dynamic_pgts
    
    After:
     (sections)
      12 .init.data    00041004  0000000000000000  0000000000000000 00008000  2**12
     (symbols)
      000000    4096 OBJECT  GLOBAL DEFAULT   22 early_top_pgt
      001000 0x40000 OBJECT  GLOBAL DEFAULT   22 early_dynamic_pgts
      041000       4 OBJECT  GLOBAL DEFAULT   22 early_recursion_flag
    
    So the resulting vmlinux is smaller by 4k with my toolchain as many
    other variables can be placed after early_recursion_flag to fill the
    rest of the page. Note that this is only .init data, so it is freed
    right after being booted anyway. Savings on-disk are none -- compression
    of zeros is easy, so the size of bzImage is the same pre and post the
    change.
    
    Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
    Signed-off-by: Borislav Petkov <bp@xxxxxxx>
    Cc: Andy Lutomirski <luto@xxxxxxxxxx>
    Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
    Cc: Juergen Gross <jgross@xxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Cc: x86-ml <x86@xxxxxxxxxx>
    Link: https://lkml.kernel.org/r/20191003095238.29831-1-jslaby@xxxxxxx
    Stable-dep-of: 3b2f2d22fb42 ("crypto: x86/aegis128 - access 32-bit arguments as 32-bit")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index f3d3e9646a99b..f00d7c0c1c86b 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -335,12 +335,6 @@ early_idt_handler_common:
 	jmp restore_regs_and_return_to_kernel
 END(early_idt_handler_common)
 
-	__INITDATA
-
-	.balign 4
-GLOBAL(early_recursion_flag)
-	.long 0
-
 #define NEXT_PAGE(name) \
 	.balign	PAGE_SIZE; \
 GLOBAL(name)
@@ -375,6 +369,8 @@ GLOBAL(name)
 	.endr
 
 	__INITDATA
+	.balign 4
+
 NEXT_PGD_PAGE(early_top_pgt)
 	.fill	512,8,0
 	.fill	PTI_USER_PGD_FILL,8,0
@@ -382,6 +378,9 @@ NEXT_PGD_PAGE(early_top_pgt)
 NEXT_PAGE(early_dynamic_pgts)
 	.fill	512*EARLY_DYNAMIC_PAGE_TABLES,8,0
 
+GLOBAL(early_recursion_flag)
+	.long 0
+
 	.data
 
 #if defined(CONFIG_XEN_PV) || defined(CONFIG_PVH)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux