That is an interesting question. On the face of it, one would think that since WRMSR
is a serializing instruction it flushes the preceding memory writes and all is well. Even then, to quote the manual:
These instructions force the processor to complete all modifications
to flags, registers, and memory by previous instructions and to drain
all buffered writes to memory before the next instruction is fetched
and executed.
(Emphasis mine)
It doesn't say anything about the ordering with respect to sending the IPI as that is part of the current instruction, not the next one. So this theoretically means the other core could execute the mov r1, [ _x]
while the originating core is still busy flushing stuff but is very unlikely given that the target core would need to service the interrupt which probably has a lot higher latency.
As @harold mentioned, this point is moot since WRMSR
is not always serializing. Reading the footnote that I initially missed:
WRMSR to the IA32_TSC_DEADLINE MSR (MSR index 6E0H) and the X2APIC
MSRs (MSR indices 802H to 83FH) are not serializing.
So there is absolutely no guarantee that the write to x
is flushed.