• Linus Torvalds's avatar
    Merge tag 'x86-entry-2024-03-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 86833aec
    Linus Torvalds authored
    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
    86833aec
entry_64.S 41.5 KB