Re: [PATCH v4 0/10] x86/xsaves: Fix XSAVES known issues

From: Dave Hansen
Date: Fri Apr 29 2016 - 14:09:29 EST


Hi Folks,

I've heard through the grapevine that there's some concern that we
should not be bothering to enable XSAVES because there's not a
sufficient use case for it. Maybe it's meager today, but I still think
we should do it.

I'll try to lay out why.

Today, on every Skylake system, this patch saves 128 bytes in each
task_struct. If there were an Atom system with XSAVES it would save 384
bytes since there is no AVX support on Atom. If there were a future
processor which has an xstate _past_ AVX-512, but that does not have
AVX-512 itself, that savings goes up to 2048+384 bytes. I believe it is
*inevitable* that the savings will become substantial.

Plus, if the processors ever start supporting a supervisor state that we
_need_ in Linux, we have to XSAVES support anyway.

It's inevitable that we _will_ need it.

Why do it today?

Now that Skylake is out, we _can_ get reasonable testing of this feature
from early adopters in the wild. If we turn this on today, and it
breaks, we break a relatively modest number of Skylake systems (1%? 2%?
0.1%?). Let's say we wait $X years when the benefits are greater. We
turn it on, and something breaks. We'll break 50% (or 40% or whatever)
of the systems in production.

Once we *HAVE* XSAVES support, it also opens up the possibilities for
doing things like dynamic XSAVE buffer allocation. For instance, let
threads that are not _using_ AVX-512 not waste the 2k of space for it.

So why wait?