From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754212AbbCFQdQ (ORCPT ); Fri, 6 Mar 2015 11:33:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52892 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750979AbbCFQdO (ORCPT ); Fri, 6 Mar 2015 11:33:14 -0500 Date: Fri, 6 Mar 2015 17:31:06 +0100 From: Oleg Nesterov To: David Vrabel Cc: Ingo Molnar , Dave Hansen , Borislav Petkov , Andy Lutomirski , Linus Torvalds , Pekka Riikonen , Rik van Riel , Suresh Siddha , LKML , "Yu, Fenghua" , Quentin Casasnovas Subject: Re: [PATCH 1/1] x86/fpu: math_state_restore() should not blindly disable irqs Message-ID: <20150306163106.GA30423@redhat.com> References: <20150305195149.GB12657@redhat.com> <20150305201101.GA21571@gmail.com> <20150305212532.GA16890@redhat.com> <20150306075833.GA623@gmail.com> <20150306132634.GA20693@redhat.com> <20150306134601.GA11718@gmail.com> <20150306140154.GA22811@redhat.com> <54F9C112.3010604@citrix.com> <20150306153622.GA26939@redhat.com> <54F9D2A9.8030401@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54F9D2A9.8030401@citrix.com> 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 03/06, David Vrabel wrote: > > On 06/03/15 15:36, Oleg Nesterov wrote: > > > > This needs more discussion, but in short so far I think that fpu_alloc() > > from #NM exception is fine if user_mode(regs) == T. > > I think a memory allocation here, where the only behaviour on a failure > is to kill the task, is (and has always been) a crazy idea. Well, I do not agree. But lets discuss this later. This code should be rewritten in any case. It has more problems. > Additionally, in a Xen PV guest the #NM handler is called with TS > already cleared by the hypervisor so the handler must not enable > interrupts (and thus potentially schedule another task) until after the > current task's fpu state has been restored. If a task was scheduled > before restoring the FPU state, TS would be clear and that task will use > fpu state from a previous task. I can be easily wrong (especially because I know nothing about Xen ;), but I do not think this is true. Yes sure, we need to avoid preemption, but we need this in any case, even without Xen. Again, lets discuss this a bit later? Oleg.