From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759150AbbA2VyZ (ORCPT ); Thu, 29 Jan 2015 16:54:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42247 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757045AbbA2VyY (ORCPT ); Thu, 29 Jan 2015 16:54:24 -0500 Message-ID: <54CAAC01.7000000@redhat.com> Date: Thu, 29 Jan 2015 16:54:09 -0500 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Oleg Nesterov , Dave Hansen CC: Suresh Siddha , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Fenghua Yu , the arch/x86 maintainers , linux-kernel Subject: Re: [PATCH 2/3] x86, fpu: unlazy_fpu: don't do __thread_fpu_end() if use_eager_fpu() References: <54C2A245.4010307@redhat.com> <20150129210723.GA31584@redhat.com> <20150129210816.GC31584@redhat.com> In-Reply-To: <20150129210816.GC31584@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/29/2015 04:08 PM, Oleg Nesterov wrote: > unlazy_fpu()->__thread_fpu_end() doesn't look right if use_eager_fpu(). > Unconditional __thread_fpu_end() is only correct if we know that this > thread can't return to user-mode and use FPU. > > Fortunately it has only 2 callers. fpu_copy() checks use_eager_fpu(), > and init_fpu(current) can be only called by the coredumping thread via > regset->get(). But it is exported to modules, and imo this should be > fixed anyway. > > And if we check use_eager_fpu() we can use __save_fpu() like fpu_copy() > and save_init_fpu() do. > > - It seems that even !use_eager_fpu() case doesn't need the unconditional > __thread_fpu_end(), we only need it if __save_init_fpu() returns 0. > > - It is still not clear to me if __save_init_fpu() can safely nest with > another save + restore from __kernel_fpu_begin(). If not, we can use > kernel_fpu_disable() to fix the race. > > Signed-off-by: Oleg Nesterov Reviewed-by: Rik van Riel