Skip to content

x86/paravirt: Make pv ops code generation more closely match reality

Josh Poimboeuf lkml virtualization xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 111 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13x86/paravirt: remove wbinvd() paravirt interfacearch/x86/include/asm/paravirt.h arch/x86/include/asm/paravirt_types.h arch/x86/include/asm/special_insns.h +3 more+1 -170 replies
1/13x86/paravirt: remove wbinvd() paravirt interfacearch/x86/include/asm/paravirt.h arch/x86/include/asm/paravirt_types.h arch/x86/include/asm/special_insns.h +3 more+1 -176 replies
2/13x86/paravirt: Fix output constraint macro namesarch/x86/include/asm/paravirt_types.h+12 -120 replies
2/13x86/paravirt: Fix output constraint macro namesarch/x86/include/asm/paravirt_types.h+12 -127 replies
2/13x86/paravirt: Fix output constraint macro namesarch/x86/include/asm/paravirt_types.h+12 -120 replies
3/13x86/paravirt: Convert native patch assembly code strings to macrosarch/x86/include/asm/special_insns.h arch/x86/kernel/paravirt_patch_32.c arch/x86/kernel/paravirt_patch_64.c+50 -240 replies
3/13x86/paravirt: Convert native patch assembly code strings to macrosarch/x86/include/asm/special_insns.h arch/x86/kernel/paravirt_patch_32.c arch/x86/kernel/paravirt_patch_64.c+50 -2415 replies
4/13x86/paravirt: Convert DEF_NATIVE macro to GCC extended asm syntaxarch/x86/include/asm/paravirt_types.h arch/x86/include/asm/special_insns.h+14 -100 replies
4/13x86/paravirt: Convert DEF_NATIVE macro to GCC extended asm syntaxarch/x86/include/asm/paravirt_types.h arch/x86/include/asm/special_insns.h+14 -100 replies
4/13x86/paravirt: Convert DEF_NATIVE macro to GCC extended asm syntaxarch/x86/include/asm/paravirt_types.h arch/x86/include/asm/special_insns.h+14 -103 replies
5/13x86/paravirt: Move paravirt asm macros to paravirt-asm.harch/x86/entry/entry_32.S arch/x86/entry/entry_64.S arch/x86/entry/entry_64_compat.S +3 more+138 -1260 replies
5/13x86/paravirt: Move paravirt asm macros to paravirt-asm.harch/x86/entry/entry_32.S arch/x86/entry/entry_64.S arch/x86/entry/entry_64_compat.S +3 more+138 -1263 replies
6/13x86/paravirt: Clean up paravirt-asm.harch/x86/include/asm/paravirt-asm.h+49 -460 replies
6/13x86/paravirt: Clean up paravirt-asm.harch/x86/include/asm/paravirt-asm.h+49 -463 replies
6/13x86/paravirt: Clean up paravirt-asm.harch/x86/include/asm/paravirt-asm.h+49 -460 replies
7/13x86/paravirt: Simplify ____PVOP_CALL()arch/x86/include/asm/paravirt_types.h+13 -230 replies
7/13x86/paravirt: Simplify ____PVOP_CALL()arch/x86/include/asm/paravirt_types.h+13 -236 replies
8/13x86/paravirt: Clean up paravirt_types.harch/x86/include/asm/paravirt_types.h+54 -500 replies
8/13x86/paravirt: Clean up paravirt_types.harch/x86/include/asm/paravirt_types.h+54 -505 replies
8/13x86/paravirt: Clean up paravirt_types.harch/x86/include/asm/paravirt_types.h+54 -500 replies
9/13x86/asm: Convert ALTERNATIVE*() assembler macros to preprocessor macrosarch/x86/entry/entry_32.S arch/x86/entry/entry_64.S arch/x86/entry/entry_64_compat.S +7 more+59 -660 replies
9/13x86/asm: Convert ALTERNATIVE*() assembler macros to preprocessor macrosarch/x86/entry/entry_32.S arch/x86/entry/entry_64.S arch/x86/entry/entry_64_compat.S +7 more+59 -662 replies
10/13x86/alternative: Support indirect call replacementarch/x86/kernel/alternative.c+15 -70 replies
10/13x86/alternative: Support indirect call replacementarch/x86/kernel/alternative.c+15 -70 replies
10/13x86/alternative: Support indirect call replacementarch/x86/kernel/alternative.c+15 -79 replies
11/13x86/paravirt: Add paravirt alternatives infrastructurearch/x86/include/asm/alternative-asm.h arch/x86/include/asm/alternative.h arch/x86/include/asm/cpufeatures.h +7 more+141 -80 replies
11/13x86/paravirt: Add paravirt alternatives infrastructurearch/x86/include/asm/alternative-asm.h arch/x86/include/asm/alternative.h arch/x86/include/asm/cpufeatures.h +7 more+141 -80 replies
11/13x86/paravirt: Add paravirt alternatives infrastructurearch/x86/include/asm/alternative-asm.h arch/x86/include/asm/alternative.h arch/x86/include/asm/cpufeatures.h +7 more+141 -846 replies
12/13objtool: Add support for new .pv_altinstructions sectiontools/objtool/special.c+10 -00 replies
12/13objtool: Add support for new .pv_altinstructions sectiontools/objtool/special.c+10 -00 replies
12/13objtool: Add support for new .pv_altinstructions sectiontools/objtool/special.c+10 -00 replies
13/13x86/paravirt: Convert natively patched pv ops to use paravirt alternativesarch/x86/include/asm/paravirt-asm.h arch/x86/include/asm/paravirt.h+34 -260 replies
13/13x86/paravirt: Convert natively patched pv ops to use paravirt alternativesarch/x86/include/asm/paravirt-asm.h arch/x86/include/asm/paravirt.h+34 -260 replies
13/13x86/paravirt: Convert natively patched pv ops to use paravirt alternativesarch/x86/include/asm/paravirt-asm.h arch/x86/include/asm/paravirt.h+34 -260 replies

Reviews trailers per patch

19 of 34 patches have a Reviewed-by or Acked-by.

PatchJuergen GrossBorislav Petkov
1/13R-b R-b R-b R-b R-b R-b
1/13R-b R-b R-b R-b R-b R-b
2/13
2/13
2/13
3/13R-b R-b R-b
3/13R-b R-b R-b
4/13R-b R-b R-b
4/13R-b R-b R-b
4/13R-b R-b R-b
5/13R-b R-b R-b
5/13R-b R-b R-b
6/13R-b R-b R-b
6/13R-b R-b R-b
6/13R-b R-b R-b
7/13R-b R-b R-b
7/13R-b R-b R-b
8/13R-b R-b
8/13R-b R-b
8/13R-b R-b
9/13R-b R-b
9/13R-b R-b
10/13
10/13
10/13
11/13
11/13
11/13
12/13
12/13
12/13
13/13
13/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/13] x86/paravirt: Make pv ops code generation more closely match reality

This changes the pv ops code generation to more closely match reality.

For example, instead of:

callq *0xffffffff81e3a400 (pv_irq_ops.save_fl)

vmlinux will now show:

pushfq
pop %rax
nop
nop
nop
nop
nop

which is what the runtime version of the code will show in most cases.

This idea was suggested by Andy Lutomirski.

The benefits are:

- For the most common runtime cases (everything except Xen and vSMP), vmlinux disassembly now matches what the actual runtime code looks like. This improves debuggability and kernel developer sanity (a precious resource).

- It fixes a KASAN warning in the ORC unwinder due to objtool not understanding the .parainstructions stuff.

- It's hopefully a first step in simplifying paravirt patching by getting rid of .parainstructions, pv ops, and apply_paravirt() completely. (I think Xen can be changed to set CPU feature bits to specify which ops it needs during early boot, then those ops can be patched in using early alternatives.)

For more details, see the commit log in patch 11/13.

Josh Poimboeuf (13):
x86/paravirt: remove wbinvd() paravirt interface x86/paravirt: Fix output constraint macro names x86/paravirt: Convert native patch assembly code strings to macros x86/paravirt: Convert DEF_NATIVE macro to GCC extended asm syntax x86/paravirt: Move paravirt asm macros to paravirt-asm.h x86/paravirt: Clean up paravirt-asm.h
x86/paravirt: Simplify ____PVOP_CALL()
x86/paravirt: Clean up paravirt_types.h
x86/asm: Convert ALTERNATIVE*() assembler macros to preprocessor
macros
x86/alternative: Support indirect call replacement x86/paravirt: Add paravirt alternatives infrastructure
objtool: Add support for new .pv_altinstructions section x86/paravirt: Convert natively patched pv ops to use paravirt
alternatives

 arch/x86/entry/entry_32.S                |  13 +-
 arch/x86/entry/entry_64.S                |  12 +-
 arch/x86/entry/entry_64_compat.S         |   9 +-
 arch/x86/entry/vdso/vdso32/system_call.S |  10 +-
 arch/x86/include/asm/alternative-asm.h   |  71 ++++-----
 arch/x86/include/asm/alternative.h       |  12 +-
 arch/x86/include/asm/cpufeatures.h       |   1 +
 arch/x86/include/asm/paravirt-asm.h      | 142 ++++++++++++++++++
 arch/x86/include/asm/paravirt.h          | 174 ++++------------------
 arch/x86/include/asm/paravirt_types.h    | 243 ++++++++++++++++++++-----------
 arch/x86/include/asm/smap.h              |   4 +-
 arch/x86/include/asm/special_insns.h     |  31 +++-
 arch/x86/kernel/alternative.c            |  35 ++++-
 arch/x86/kernel/cpu/hypervisor.c         |   2 +
 arch/x86/kernel/head_64.S                |   2 +-
 arch/x86/kernel/module.c                 |  11 +-
 arch/x86/kernel/paravirt.c               |   1 -
 arch/x86/kernel/paravirt_patch_32.c      |  21 +--
 arch/x86/kernel/paravirt_patch_64.c      |  31 ++--
 arch/x86/kernel/vmlinux.lds.S            |   6 +
 arch/x86/lib/copy_page_64.S              |   2 +-
 arch/x86/lib/memcpy_64.S                 |   4 +-
 arch/x86/lib/memmove_64.S                |   3 +-
 arch/x86/lib/memset_64.S                 |   4 +-
 arch/x86/xen/enlighten_pv.c              |   3 +-
 tools/objtool/special.c                  |  10 ++
 26 files changed, 516 insertions(+), 341 deletions(-)
 create mode 100644 arch/x86/include/asm/paravirt-asm.h
Signature · 1 line
2.13.6