Skip to content

Commit a4da3d8

Browse files
author
Ingo Molnar
committed
Revert "x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops"
This reverts commit 494b516. See this commit for details about the revert: e769742 ("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>
1 parent 81a6845 commit a4da3d8

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

arch/x86/include/asm/paravirt_types.h

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,23 @@ extern struct paravirt_patch_template pv_ops;
348348
#define paravirt_clobber(clobber) \
349349
[paravirt_clobber] "i" (clobber)
350350

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+
351365
/* 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]")
356368

357369
/* Simple instruction patching code. */
358370
#define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t"
@@ -372,6 +384,16 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len);
372384

373385
int paravirt_disable_iospace(void);
374386

387+
/*
388+
* This generates an indirect call based on the operation type number.
389+
* The type number, computed in PARAVIRT_PATCH, is derived from the
390+
* offset into the paravirt_patch_template structure, and can therefore be
391+
* freely converted back into a structure offset.
392+
*/
393+
#define PARAVIRT_CALL \
394+
ANNOTATE_RETPOLINE_SAFE \
395+
"call *%c[paravirt_opptr];"
396+
375397
/*
376398
* These macros are intended to wrap calls through one of the paravirt
377399
* ops structs, so that they can be later identified and patched at
@@ -509,7 +531,7 @@ int paravirt_disable_iospace(void);
509531
/* since this condition will never hold */ \
510532
if (sizeof(rettype) > sizeof(unsigned long)) { \
511533
asm volatile(pre \
512-
paravirt_call \
534+
paravirt_alt(PARAVIRT_CALL) \
513535
post \
514536
: call_clbr, ASM_CALL_CONSTRAINT \
515537
: paravirt_type(op), \
@@ -519,7 +541,7 @@ int paravirt_disable_iospace(void);
519541
__ret = (rettype)((((u64)__edx) << 32) | __eax); \
520542
} else { \
521543
asm volatile(pre \
522-
paravirt_call \
544+
paravirt_alt(PARAVIRT_CALL) \
523545
post \
524546
: call_clbr, ASM_CALL_CONSTRAINT \
525547
: paravirt_type(op), \
@@ -546,7 +568,7 @@ int paravirt_disable_iospace(void);
546568
PVOP_VCALL_ARGS; \
547569
PVOP_TEST_NULL(op); \
548570
asm volatile(pre \
549-
paravirt_call \
571+
paravirt_alt(PARAVIRT_CALL) \
550572
post \
551573
: call_clbr, ASM_CALL_CONSTRAINT \
552574
: paravirt_type(op), \
@@ -664,26 +686,6 @@ struct paravirt_patch_site {
664686
extern struct paravirt_patch_site __parainstructions[],
665687
__parainstructions_end[];
666688

667-
#else /* __ASSEMBLY__ */
668-
669-
/*
670-
* This generates an indirect call based on the operation type number.
671-
* The type number, computed in PARAVIRT_PATCH, is derived from the
672-
* offset into the paravirt_patch_template structure, and can therefore be
673-
* freely converted back into a structure offset.
674-
*/
675-
.macro PARAVIRT_CALL type:req clobber:req pv_opptr:req
676-
771: ANNOTATE_RETPOLINE_SAFE
677-
call *\pv_opptr
678-
772: .pushsection .parainstructions,"a"
679-
_ASM_ALIGN
680-
_ASM_PTR 771b
681-
.byte \type
682-
.byte 772b-771b
683-
.short \clobber
684-
.popsection
685-
.endm
686-
687689
#endif /* __ASSEMBLY__ */
688690

689691
#endif /* _ASM_X86_PARAVIRT_TYPES_H */

arch/x86/kernel/macros.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@
1010
#include <asm/refcount.h>
1111
#include <asm/alternative-asm.h>
1212
#include <asm/bug.h>
13-
#include <asm/paravirt.h>

0 commit comments

Comments
 (0)