Brooks Davis
2018-04-16 16:10:12 UTC
The fuswintr() and suswintr() are intended to be safe in interrupt
context. They are used in the profiling code and if they fail the code
falls back to triggering a trap with appropriate fields in struct
thread. This is fine as such, but amd64, arm, i386, and powerpc have
implementations that always fail. arm64, mips, riscv, and sparc64 all
add code to the trap handler to detect that this particular code has
faulted and return to the handler before doing and processing that might
result in a sleep. This optimization came from 4.4BSD.
Does this optimization actually make sense in 2017, particularly
given that we're not taking advantage of it on x86 (and worse, our
implementations of return (-1) aren't inlined so they have cache
impacts)?
-- Brooks
context. They are used in the profiling code and if they fail the code
falls back to triggering a trap with appropriate fields in struct
thread. This is fine as such, but amd64, arm, i386, and powerpc have
implementations that always fail. arm64, mips, riscv, and sparc64 all
add code to the trap handler to detect that this particular code has
faulted and return to the handler before doing and processing that might
result in a sleep. This optimization came from 4.4BSD.
Does this optimization actually make sense in 2017, particularly
given that we're not taking advantage of it on x86 (and worse, our
implementations of return (-1) aren't inlined so they have cache
impacts)?
-- Brooks