Announcement

Collapse
No announcement yet.

Linux Developers Are Once Again Trying To Enable Intel FSGSBASE For Better Performance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    Originally posted by Vorpal View Post

    If I remember correctly (from when I was coding x86 assembly many years ago), the FS and GS registers are used to offset memory access, by user space. However the value stored in them can not be directly accessed by user space, needing a kernel helper for that. At least one of them (I forget which), is normally used by glibc to point to the base address for thread local storage. I also seem to remember that wine might need the other one for some windows emulation trickery in 32-bit mode.

    So this patch would simply dispense with the need of going through the kernel to read/write these registers.
    iirc both are used for thread local storage, %fs is used in x86-64 Sys V ABI and x86 Windows, %gs is used by x64 Windows and (possible) macOS.

    Comment


    • #12
      How much can you spit polish the turd again?

      Comment


      • #13
        Originally posted by Vorpal View Post

        If I remember correctly (from when I was coding x86 assembly many years ago), the FS and GS registers are used to offset memory access, by user space. However the value stored in them can not be directly accessed by user space, needing a kernel helper for that. At least one of them (I forget which), is normally used by glibc to point to the base address for thread local storage. I also seem to remember that wine might need the other one for some windows emulation trickery in 32-bit mode.

        So this patch would simply dispense with the need of going through the kernel to read/write these registers.
        great yet another workaround work only in glibc -_-

        Comment


        • #14
          Originally posted by Vorpal View Post

          If I remember correctly (from when I was coding x86 assembly many years ago), the FS and GS registers are used to offset memory access, by user space. However the value stored in them can not be directly accessed by user space, needing a kernel helper for that. At least one of them (I forget which), is normally used by glibc to point to the base address for thread local storage. I also seem to remember that wine might need the other one for some windows emulation trickery in 32-bit mode.
          Here's a map of how they're used - Wine does the same as Darling: https://docs.darlinghq.org/internals...html#registers
          I need to add, however, that no kernel space helpers are needed to read/write TLS variables. A kernel call is only used when a thread is created - to set up these "offsets".

          My assumption therefore is that the performance benefit comes from faster FS/GS manipulation during context switches (i.e. in the kernel).

          Comment


          • #15
            Originally posted by sarfarazahmad View Post
            Where does Windows stand on this ? We get to know quite a number of details of what's going on in the kernel land courtesy Phoronix among other media. Since Windows is closed-source, I wonder what it is like in that land.
            Windows has supported FSGSBASE since Windows 8.1. You can see the _readfsbase*/_readgsbase_*/_writefsbase*/_writegsbase* functions in the intrinsic list of VS 2015

            Comment

            Working...
            X