Merge tag 'x86-entry-2024-03-11' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 11 Mar 2024 23:15:43 +0000 (16:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 11 Mar 2024 23:15:43 +0000 (16:15 -0700)
commit86833aec447939a886a13bbdbdf21c9628c5c8c5
tree012fcbe7a89ae6fe1b3fee89f037051dffd3637c
parent720c857907530e6cdc86c9bc1102ea6b372fbfb6
parentbb998361999e79bc87dae1ebe0f5bf317f632585
Merge tag 'x86-entry-2024-03-11' of git://git./linux/kernel/git/tip/tip

Pull x86 entry update from Thomas Gleixner:
 "A single update for the x86 entry code:

  The current CR3 handling for kernel page table isolation in the
  paranoid return paths which are relevant for #NMI, #MCE, #VC, #DB and
  #DF is unconditionally writing CR3 with the value retrieved on
  exception entry.

  In the vast majority of cases when returning to the kernel this is a
  pointless exercise because CR3 was not modified on exception entry.
  The only situation where this is necessary is when the exception
  interrupts a entry from user before switching to kernel CR3 or
  interrupts an exit to user after switching back to user CR3.

  As CR3 writes can be expensive on some systems this becomes measurable
  overhead with high frequency #NMIs such as perf.

  Avoid this overhead by checking the CR3 value, which was saved on
  entry, and write it back to CR3 only when it is a user CR3"

* tag 'x86-entry-2024-03-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/entry: Avoid redundant CR3 write on paranoid returns
arch/x86/entry/calling.h
arch/x86/entry/entry_64.S