Re: RFC, untested: handing of MSR immediates and MSRs on Xen
From: H. Peter Anvin
Date: Wed Oct 23 2024 - 17:53:14 EST
On 10/23/24 14:31, H. Peter Anvin wrote:
Note: I haven't added tracepoint handling yet. *Ideally* tracepoints
would be patched over the main callsite instead of using a separate
static_key() -- which also messes up register allocation due to the
subsequent call. This is a general problem with tracepoints which
perhaps is better handled separately.
So I have never quite wrapped my head around how heavyweight tracepoints
actually are. I do know that static_key() is definitely not a perfect
optimization barrier[*].
The case of MSR tracepoints in particular concerns me, because having
one knob for all MSRs is an *incredibly* wide net to cast, and doesn't
distinguish in any way between performance-sensitive and
non-performance-sensitive MSRs.
I do wonder if tracepoint sites could be implemented using traps (or
perhaps better, software interrupts) especially in critical flows, or if
that would increase the cost of the tracing too much.
-hpa
[*] One thing we may want to consider in general is if we should
increase the bias for __builtin_expect() by passing
-fbuiltin-expect-probability to gcc, or use
__builtin_expect_with_probability().