From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: Re: [PATCH v6] x86: load FPU registers on return to userland Date: Tue, 15 Jan 2019 12:54:49 -0800 Message-ID: <39ab2f2b-81bb-636e-933d-f3a5225aa020@intel.com> References: <20190109114744.10936-1-bigeasy@linutronix.de> <2e396dbcbb1c4cc191b4208626baed07@AcuMS.aculab.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: David Laight , Sebastian Andrzej Siewior , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , "kvm@vger.kernel.org" , Rik van Riel , Dave Hansen To: Andy Lutomirski , "Jason A. Donenfeld" Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 1/15/19 12:26 PM, Andy Lutomirski wrote: > I don't think we'd ever want kernel_fpu_end() to restore anything, > right? I'm a bit confused as to when this optimization would actually > be useful. Using AVX-512 as an example... Let's say there was AVX-512 state, and a kernel_fpu_begin() user only used AVX2. We could totally avoid doing *any* AVX-512 state save/restore. The init optimization doesn't help us if there _is_ AVX-512 state, and the modified optimization only helps if we recently did a XRSTOR at context switch and have not written to AVX-512 state since XRSTOR. This probably only matters for AVX-512-using apps that have run on a kernel with lots of kernel_fpu_begin()s that don't use AVX-512. So, not a big deal right now.