]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/paravirt: Make the struct paravirt_patch_site packed
authorHou Wenlong <houwenlong.hwl@antgroup.com>
Fri, 9 Jun 2023 09:45:32 +0000 (17:45 +0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 13 Nov 2023 11:43:50 +0000 (12:43 +0100)
Similar to struct alt_instr, make the struct paravirt_patch_site packed
and get rid of all the .align directives and save 2 bytes for one
PARA_SITE entry on X86_64.

  [ bp: Massage commit message. ]

Suggested-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/6dcb20159ded36586c5f7f2ae159e4e030256627.1686301237.git.houwenlong.hwl@antgroup.com
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/paravirt_types.h

index d9384e9d97f6284e9dde27ec127bf9677548d903..693c61dbdd9c3f93d916282adb94752c6707852f 100644 (file)
@@ -748,11 +748,9 @@ void native_pv_lock_init(void) __init;
        ops;                                    \
 772:;                                          \
        .pushsection .parainstructions,"a";     \
-        .align 4;                              \
         .long 771b-.;                          \
         .byte ptype;                           \
         .byte 772b-771b;                       \
-        .align 4;                              \
        .popsection
 
 
index e1bfb719fca339175f39acd0f1dda51a53a30ca6..f4fb2e3ec7b8a4b09d1e3c559698cdea27e1ce3a 100644 (file)
@@ -8,7 +8,7 @@ struct paravirt_patch_site {
        s32 instr_offset;       /* original instructions */
        u8 type;                /* type of this instruction */
        u8 len;                 /* length of original instruction */
-};
+} __packed;
 #endif
 
 #ifdef CONFIG_PARAVIRT
@@ -263,11 +263,9 @@ extern struct paravirt_patch_template pv_ops;
 #define _paravirt_alt(insn_string, type)               \
        "771:\n\t" insn_string "\n" "772:\n"            \
        ".pushsection .parainstructions,\"a\"\n"        \
-       "  .align 4\n"                                  \
        "  .long 771b-.\n"                              \
        "  .byte " type "\n"                            \
        "  .byte 772b-771b\n"                           \
-       "  .align 4\n"                                  \
        ".popsection\n"
 
 /* Generate patchable code, with the default asm parameters. */