Skip to content

x86/entry: Entry/exception code rework, syscall and KVM changes

Thomas Gleixner lkml 1 version Applied

Status from this message: The following commit has been merged into the x86/entry branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v4 Latest18 patches 36 repliesApplied

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/18x86/entry/64: Move non entry code into .text sectionarch/x86/entry/entry_64.S arch/x86/kernel/ftrace_64.S+11 -14 replies
2/18x86/entry/32: Move non entry code into .text sectionarch/x86/entry/entry_32.S+10 -12 replies
3/18x86/entry: Mark enter_from_user_mode() noinstrarch/x86/entry/common.c+1 -11 reply
4/18x86/entry/common: Protect against instrumentationarch/x86/entry/common.c+90 -452 replies
5/18x86/entry: Move irq tracing on syscall entry to C-codearch/x86/entry/common.c arch/x86/entry/entry_32.S arch/x86/entry/entry_64.S +1 more+19 -344 replies
6/18x86/entry: Move irq flags tracing to prepare_exit_to_usermode()arch/x86/entry/common.c arch/x86/entry/entry_32.S arch/x86/entry/entry_64.S +1 more+27 -222 replies
7/18context_tracking: Ensure that the critical path cannot be instrumentedinclude/linux/context_tracking.h include/linux/context_tracking_state.h kernel/context_tracking.c+14 -121 reply
8/18lib/smp_processor_id: Move it into noinstr sectionlib/smp_processor_id.c+5 -50 replies
9/18x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inlinearch/x86/include/asm/nospec-branch.h+2 -20 replies
10/18x86/entry/64: Check IF in __preempt_enable_notrace() thunkarch/x86/entry/thunk_64.S arch/x86/include/asm/irqflags.h arch/x86/include/asm/paravirt.h+25 -88 replies
11/18x86/entry/64: Mark ___preempt_schedule_notrace() thunk noinstrarch/x86/entry/thunk_64.S+16 -20 replies
12/18x86,objtool: Make entry_64_compat.S objtool cleanarch/x86/entry/Makefile arch/x86/entry/entry_64_compat.S+20 -72 replies
13/18x86/kvm: Move context tracking where it belongsarch/x86/kvm/svm/svm.c arch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c+26 -23 replies
14/18x86/kvm/vmx: Add hardirq tracing to guest enter/exitarch/x86/kvm/vmx/vmx.c+23 -21 reply
15/18x86/kvm/svm: Handle hardirqs proper on guest enter/exitarch/x86/kvm/svm/svm.c+25 -56 replies
16/18context_tracking: Make guest_enter/exit() .noinstr readyinclude/linux/context_tracking.h+16 -50 replies
17/18x86/kvm/vmx: Move guest enter/exit into .noinstr.textarch/x86/include/asm/hardirq.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/ops.h +3 more+79 -491 reply
18/18x86/kvm/svm: Move guest enter/exit into .noinstr.textarch/x86/kvm/svm/svm.c arch/x86/kvm/svm/vmenter.S+57 -472 replies

Reviews trailers per patch

9 of 18 patches have a Reviewed-by or Acked-by.

PatchPaolo BonziniAlexandre ChartreSteven Rostedt (VMware)Masami HiramatsuAndy Lutomirski
1/18R-b
2/18
3/18R-b
4/18
5/18
6/18A-b
7/18R-b
8/18
9/18
10/18
11/18
12/18A-b
13/18A-b
14/18A-b
15/18
16/18
17/18A-b
18/18A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v4 thread

Cover letter [patch V4 part 2 00/18] x86/entry: Entry/exception code rework, syscall and KVM changes

Folks!

This is the second part of the rework series. Part 1 can be found here:

https://lore.kernel.org/r/[email protected]

The series has a total of 138 patches and is split into 5 parts. The base for this series is:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry-v4-part-1

The full series with all parts applied is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry-v4-part-5

The second part, i.e. this series is available from:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry-v4-part-2

This part contains the modifications for the syscall entry code and the adjustment of the KVM code:

- Move the non entry related ASM code into the regular text section so it is not part of the protected section

- Move the low level entry C code into the .noinstr.text section

- Make the interaction with lockdep, RCU and tracing correct

- Move the KVM guest_enter/exit() handling strict vs. RCU and instrumentation protection. It's more or less the same problem as the syscall entry/exit and needs to be equally restrictive so that the rules can be enforced with objtool.

The objtool check for the noinstr.text correctness is not yet added to the build machinery and has to be invoked manually for now:

objtool check -fal vmlinux.o

The checking only works for builtin code as objtool cannot do a combined analysis of vmlinux.o and a module.o

Thanks,

tglx

8<----------

 arch/x86/entry/Makefile                |    2 
 arch/x86/entry/common.c                |  173 ++++++++++++++++++++++++---------
 arch/x86/entry/entry_32.S              |   35 ++----
 arch/x86/entry/entry_64.S              |   16 +--
 arch/x86/entry/entry_64_compat.S       |   55 ++++------
 arch/x86/entry/thunk_64.S              |   45 +++++++-
 arch/x86/include/asm/hardirq.h         |    4 
 arch/x86/include/asm/irqflags.h        |    3 
 arch/x86/include/asm/kvm_host.h        |    8 +
 arch/x86/include/asm/nospec-branch.h   |    4 
 arch/x86/include/asm/paravirt.h        |    3 
 arch/x86/kernel/ftrace_64.S            |    2 
 arch/x86/kvm/svm/svm.c                 |   66 ++++++++++--
 arch/x86/kvm/svm/vmenter.S             |    2 
 arch/x86/kvm/vmx/ops.h                 |    4 
 arch/x86/kvm/vmx/vmenter.S             |    5 
 arch/x86/kvm/vmx/vmx.c                 |   78 +++++++++++---
 arch/x86/kvm/x86.c                     |    4 
 include/linux/context_tracking.h       |   27 +++--
 include/linux/context_tracking_state.h |    6 -
 kernel/context_tracking.c              |   14 +-
 lib/smp_processor_id.c                 |   10 -
 22 files changed, 391 insertions(+), 175 deletions(-)