From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754616AbbBTNcT (ORCPT ); Fri, 20 Feb 2015 08:32:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55034 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754232AbbBTNcC (ORCPT ); Fri, 20 Feb 2015 08:32:02 -0500 Date: Fri, 20 Feb 2015 14:30:02 +0100 From: Oleg Nesterov To: Borislav Petkov Cc: Rik van Riel , Linus Torvalds , Suresh Siddha , linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com, matt.fleming@intel.com, bp@suse.de, pbonzini@redhat.com, tglx@linutronix.de, luto@amacapital.net Subject: Re: [PATCH 0/3] x86, fpu: more eagerfpu cleanups Message-ID: <20150220133002.GA32275@redhat.com> References: <1421012793-30106-1-git-send-email-riel@redhat.com> <20150115191918.GA27332@redhat.com> <20150119185109.GA16427@redhat.com> <20150220121009.GA19589@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150220121009.GA19589@pd.tnic> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/20, Borislav Petkov wrote: > > On Mon, Jan 19, 2015 at 07:51:09PM +0100, Oleg Nesterov wrote: > > math_state_restore() and its usage doesn't look nice. init_fpu() too, > > Yeah, about that: > > I see: > > math_state_restore > ... > if (!tsk_used_math(tsk)) > init_fpu() > > and init_fpu() then does: > > if (tsk_used_math(tsk)) > Yes, and more. math_state_restore() assumes that it is called with irqs disabled. At least if !tsk_used_math. That is why 3/3 calls init_fpu() first. Not only this doesn't look clean, this is simply not true in general. The comment above init_fpu() is simply wrong. And unlazy_fpu() from there doesn't look nice. This mixes 2 completely differents things. > Could use a cleanup and so on... Perhaps it is in the works already :) Yes, I'll try to make the cleanups on top of these changes. And let me repeat that there is another reason for 1/3 and 2/3 at least (3/3 makes sense too), if we add TIF_LOAD_FPU we need to avoid the performance regression (irq_fpu_usable() should not fail if !__thread_has_fpu()). Oleg.