On 13/02/2018 09:15, David Woodhouse wrote:
>>> - if (!data)
>>> + if (!data && !spectre_v2_ibrs_all())
>> This should check the value of IBRS_ALL in the VM, not in the host.
> No, it's host we want. If IBRS_ALL is set in the host, we set the
> actual hardware MSR once at boot time and never touch it again. The
> SPEC_CTRL MSR we expose to guests is purely a no-op fiction.
> If spectre_v2_ibrs_all() is true then KVM should *never* actually pass
> through or touch the real MSR.
That would be nice but unfortunately it's not possible. :(
The VM might actually not have IBRS_ALL, as usual the reason is
migration compatibility. In that case, that no-op fiction would be very
slow because the VM will actually do a lot of SPEC_CTRL writes.
So the right logic is:
- if the VM has IBRS_ALL, pass through the MSR when it is zero and
intercept writes when it is one (no writes should happen)
- if the VM doesn't have IBRS_ALL, do as we are doing now, independent
of what the host spectre_v2_ibrs_all() setting is.