Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751659AbaBBJL7 (ORCPT ); Sun, 2 Feb 2014 04:11:59 -0500 Received: from git.silcnet.org ([81.89.56.81]:47663 "EHLO git.silcnet.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751466AbaBBJLz (ORCPT ); Sun, 2 Feb 2014 04:11:55 -0500 X-Greylist: delayed 793 seconds by postgrey-1.27 at vger.kernel.org; Sun, 02 Feb 2014 04:11:55 EST Date: Sun, 2 Feb 2014 09:45:13 +0100 (CET) From: Pekka Riikonen X-X-Sender: priikone@git.silcnet.org To: Linus Torvalds cc: "H. Peter Anvin" , Suresh Siddha , Nate Eldredge , Thomas Gleixner , Ingo Molnar , the arch/x86 maintainers , stable , Linux Kernel Mailing List , Maarten Baert , Jan Kara , George Spelvin , Pekka Riikonen Subject: Re: [PATCH] Make math_state_restore() save and restore the interrupt flag In-Reply-To: Message-ID: References: <52ED4C96.6020703@zytor.com> User-Agent: Alpine 2.00 (GSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 1 Feb 2014, Linus Torvalds wrote: > We could do that with the whole "task_work" thing (or perhaps just > do_notify_resume(), especially after merging the "don't necessarily > return with iret" patch I sent out earlier), with additionally making > sure that scheduling does the right thing wrt a "currently dirty math > state due to kernel use". > > The advantage of that would be that we really could do a *lot* of FP > math very cheaply in the kernel, because we'd pay the overhead of > kernel_fpu_begin/end() just once (well, the "end" part would be just > setting the bit that we now have dirty state, the cost would be in the > return-to-user-space-and-restore-fp-state part). > > Comments? That would be much more invasive than just changing > __kernel_fpu_end(), but would bring in possibly quite noticeable > advantages under loads that use the FP/vector resources in the kernel. > This would be very good and it needs to work in interrupt context (softirq) also, and when we interrupt idle task. It's with networking we can really hit kernel_fpu_begin()/end() millions of times per second and there's really only need to do it once per interrupt. This is actually similar what I was doing (in do_softirq)) when I noticed eagerfpu was broken and now Nate's bug AFAICS happens there as well. Pekka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/