Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops"

This reverts commit 494b5168f2de009eb80f198f668da374295098dd.

See this commit for details about the revert:

e769742d3584 ("Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs"")

Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Borislav Petkov <bp@alien8.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Richard Biener <rguenther@suse.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

+29 -28
+29 -27
arch/x86/include/asm/paravirt_types.h
··· 348 348 #define paravirt_clobber(clobber) \ 349 349 [paravirt_clobber] "i" (clobber) 350 350 351 + /* 352 + * Generate some code, and mark it as patchable by the 353 + * apply_paravirt() alternate instruction patcher. 354 + */ 355 + #define _paravirt_alt(insn_string, type, clobber) \ 356 + "771:\n\t" insn_string "\n" "772:\n" \ 357 + ".pushsection .parainstructions,\"a\"\n" \ 358 + _ASM_ALIGN "\n" \ 359 + _ASM_PTR " 771b\n" \ 360 + " .byte " type "\n" \ 361 + " .byte 772b-771b\n" \ 362 + " .short " clobber "\n" \ 363 + ".popsection\n" 364 + 351 365 /* Generate patchable code, with the default asm parameters. */ 352 - #define paravirt_call \ 353 - "PARAVIRT_CALL type=\"%c[paravirt_typenum]\"" \ 354 - " clobber=\"%c[paravirt_clobber]\"" \ 355 - " pv_opptr=\"%c[paravirt_opptr]\";" 366 + #define paravirt_alt(insn_string) \ 367 + _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]") 356 368 357 369 /* Simple instruction patching code. */ 358 370 #define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t" ··· 383 371 unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len); 384 372 385 373 int paravirt_disable_iospace(void); 374 + 375 + /* 376 + * This generates an indirect call based on the operation type number. 377 + * The type number, computed in PARAVIRT_PATCH, is derived from the 378 + * offset into the paravirt_patch_template structure, and can therefore be 379 + * freely converted back into a structure offset. 380 + */ 381 + #define PARAVIRT_CALL \ 382 + ANNOTATE_RETPOLINE_SAFE \ 383 + "call *%c[paravirt_opptr];" 386 384 387 385 /* 388 386 * These macros are intended to wrap calls through one of the paravirt ··· 531 509 /* since this condition will never hold */ \ 532 510 if (sizeof(rettype) > sizeof(unsigned long)) { \ 533 511 asm volatile(pre \ 534 - paravirt_call \ 512 + paravirt_alt(PARAVIRT_CALL) \ 535 513 post \ 536 514 : call_clbr, ASM_CALL_CONSTRAINT \ 537 515 : paravirt_type(op), \ ··· 541 519 __ret = (rettype)((((u64)__edx) << 32) | __eax); \ 542 520 } else { \ 543 521 asm volatile(pre \ 544 - paravirt_call \ 522 + paravirt_alt(PARAVIRT_CALL) \ 545 523 post \ 546 524 : call_clbr, ASM_CALL_CONSTRAINT \ 547 525 : paravirt_type(op), \ ··· 568 546 PVOP_VCALL_ARGS; \ 569 547 PVOP_TEST_NULL(op); \ 570 548 asm volatile(pre \ 571 - paravirt_call \ 549 + paravirt_alt(PARAVIRT_CALL) \ 572 550 post \ 573 551 : call_clbr, ASM_CALL_CONSTRAINT \ 574 552 : paravirt_type(op), \ ··· 685 663 686 664 extern struct paravirt_patch_site __parainstructions[], 687 665 __parainstructions_end[]; 688 - 689 - #else /* __ASSEMBLY__ */ 690 - 691 - /* 692 - * This generates an indirect call based on the operation type number. 693 - * The type number, computed in PARAVIRT_PATCH, is derived from the 694 - * offset into the paravirt_patch_template structure, and can therefore be 695 - * freely converted back into a structure offset. 696 - */ 697 - .macro PARAVIRT_CALL type:req clobber:req pv_opptr:req 698 - 771: ANNOTATE_RETPOLINE_SAFE 699 - call *\pv_opptr 700 - 772: .pushsection .parainstructions,"a" 701 - _ASM_ALIGN 702 - _ASM_PTR 771b 703 - .byte \type 704 - .byte 772b-771b 705 - .short \clobber 706 - .popsection 707 - .endm 708 666 709 667 #endif /* __ASSEMBLY__ */ 710 668
-1
arch/x86/kernel/macros.S
··· 10 10 #include <asm/refcount.h> 11 11 #include <asm/alternative-asm.h> 12 12 #include <asm/bug.h> 13 - #include <asm/paravirt.h>