Re: [PATCH 15/19] kvm: x86: Save and restore guest XFD_ERR properly

From: Paolo Bonzini
Date: Sun Dec 12 2021 - 04:10:32 EST


On 12/12/21 02:50, Tian, Kevin wrote:

If there are other XFD controlled facilities in the future, then it will
be NR_USED_XFD_CONTROLLED_FACILITIES * 2 VMEXITs per thread which
uses
them. Not the end of the world either.

Looking at the targeted application space it's pretty unlikely that
tasks which utilize AMX are going to be so short lived that the overhead
of these VMEXITs really matters.

This of course can be revisited when there is a sane use case, but
optimizing for it prematurely does not buy us anything else than
pointless complexity.
It may affect guest which still uses CR0.TS to do lazy save. But likely
modern OSes all move to eager save approach so always trapping #NM
should be fine.

You also don't need to trap #NM if CPUID includes no dynamic bits, because then XFD will never be nonzero.

Paolo