[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150805103227.GA3233@gmail.com>
Date: Wed, 5 Aug 2015 12:32:27 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Dave Hansen <dave@...1.net>
Cc: dave.hansen@...ux.intel.com, linux-kernel@...r.kernel.org,
bp@...en8.de, fenghua.yu@...el.com, hpa@...or.com, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Denys Vlasenko <dvlasenk@...hat.com>
Subject: Re: [PATCH] x86, fpu: correct XSAVE xstate size calculation
* Dave Hansen <dave@...1.net> wrote:
>
> From: Dave Hansen <dave.hansen@...ux.intel.com>
>
> Note: our xsaves support is currently broken and disabled. This
> patch does not fix it, but it is an incremental improvement. It
> might be useful to someone backporting the entire set of XSAVES
> patches at some point, but it should not be backported alone.
>
> There are currently two xsave buffer formats: standard and
> compacted. The standard format is waht 'XSAVE' and 'XSAVEOPT'
> produce while 'XSAVES' and 'XSAVEC' produce a compacted-formet
> buffer. (The kernel never uses XSAVEC)
>
> But, the XSAVES buffer *ALSO* contains "system state components"
> which are never saved by a plain XSAVE. So, XSAVES has two
> things that might make its buffer differently-sized from an
> XSAVE-produced one.
>
> The current code assumes that an XSAVES buffer's size is simply
> the sum of the sizes of the (user) states which are supported.
> This seems to work in most cases, but it is not consistent with
> what the SDM says, and it breaks if we 'align' a component in the
> buffer. The calculation is also unnecessary work since the CPU
> *tells* us the size of the buffer directly.
>
> This patch just reads the size of the buffer right out of the
> CPUID leaf instead of trying to derive it.
So how will we know where to find which field, if we cannot even do a size
calculation?
I realize that the calculation and what CPUID gives us should match, but it's not
really good for the kernel to not know the precise layout of a critical task
context data structure ...
So can we turn this into 'double check the CPUID size and print a warning on
mismatch' kind of boot time sanity check? Preferably for all XSAVE* data formats
we can run into. I'd be fine with applying such a patch ahead of enabling
compaction again.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists