On Thu, Oct 14 2021 at 16:09, Thomas Gleixner wrote: > On Thu, Oct 14 2021 at 11:01, Paolo Bonzini wrote: > > Also you really should not wait until _all_ dynamic states are cleared > in guest XFD. Because a guest which has bit 18 and 19 available but only > uses one of them is going to trap on every other context switch due to > XFD writes. > > So you check for > > (guest_xfd & guest_perm) != guest_perm) > > and > > (guest_xr0 & guest_perm) != 0 > > If both are true, then you reallocate the buffers for _all_ permitted > states _and_ set XFD to pass through. And for that to work we must write XFD _before_ XSETBV in the guest boot phase. Thanks, tglx