Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933425AbaLKAiI (ORCPT ); Wed, 10 Dec 2014 19:38:08 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:45516 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933226AbaLKAiG (ORCPT ); Wed, 10 Dec 2014 19:38:06 -0500 MIME-Version: 1.0 In-Reply-To: References: From: Andy Lutomirski Date: Wed, 10 Dec 2014 16:37:43 -0800 Message-ID: Subject: Re: [PATCH, 3.18] sleeping function called from invalid context To: Daniel J Blueman , Rik van Riel Cc: Linux Kernel , Linus Torvalds , "H. Peter Anvin" , Suresh Siddha Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding Rik, who is probably the most recent person to have looked at the disaster fondly known as "FPU". On Wed, Dec 10, 2014 at 4:25 PM, Daniel J Blueman wrote: > With 3.18, I was seeing a significant number of allocation warnings > from load_elf_binary call paths [1]. > > Allocating FPU state atomically [2] does prevent potentially sleeping > while atomic, but probably isn't the correct fix. Anyone familiar with > this area? > > -- [1] > > BUG: sleeping function called from invalid context at mm/slub.c:1240 > in_atomic(): 1, irqs_disabled(): 0, pid: 29016, name: dmesg > INFO: lockdep is turned off. > Preemption disabled at:[] handle_mm_fault+0x5ff/0x8a0 > > CPU: 122 PID: 29016 Comm: dmesg Tainted: G W 3.18.0-test #6 > Hardware name: Supermicro AS -1042G-LTF/H8QGL, BIOS DS3.5a 11/13/2014 > ffffffff8203b81b ffff886fdf62f888 ffffffff81b942e8 0000000000000007 > 0000000000000000 ffff886fdf62f8b8 ffffffff8109ac4c 0000000000000000 > 0000000000000010 ffff8807df84bc00 00000000000000d0 ffff886fdf62f908 > Call Trace: > [] dump_stack+0x4f/0x7c > [] __might_sleep+0x164/0x250 > [] kmem_cache_alloc+0xeb/0x138 > [] init_fpu+0x71/0xb0 > [] math_state_restore+0xce/0x208 > [] do_device_not_available+0x2b/0x60 > [] device_not_available+0x15/0x20 > [] ? copy_page+0x12/0x33 wtf? I don't see any fpu state being accessed in copy_page. Can you disassemble "[] ? copy_page+0x12/0x33"? --Andy > [] ? get_parent_ip+0x11/0x58 > [] ? preempt_count_add+0x55/0xb0 > [] ? do_cow_fault+0xe9/0x258 > [] handle_mm_fault+0x5ff/0x8a0 > [] ? __do_page_fault+0xc8/0x498 > [] ? vma_gap_callbacks_rotate+0x19/0x20 > [] __do_page_fault+0x12d/0x498 > [] ? up_write+0x1e/0x48 > [] ? vma_link+0x80/0xc0 > [] ? vma_set_page_prot+0x3a/0x60 > [] ? mmap_region+0x1be/0x5e0 > [] do_page_fault+0x1e/0x70 > [] page_fault+0x1f/0x30 > [] ? __clear_user+0x2e/0x50 > [] ? __clear_user+0x12/0x50 > [] clear_user+0x2a/0x30 > [] padzero+0x21/0x30 > [] load_elf_binary+0x8cf/0xdd0 > [] search_binary_handler+0x7f/0x1f8 > [] do_execve_common.isra.34+0x616/0x790 > [] ? do_execve_common.isra.34+0x572/0x790 > [] do_execve+0x13/0x18 > [] SyS_execve+0x20/0x30 > [] stub_execve+0x69/0xa0 > > -- [2] > > diff --git a/arch/x86/include/asm/fpu-internal.h > b/arch/x86/include/asm/fpu-internal.h > index e97622f..57029ad 100644 > --- a/arch/x86/include/asm/fpu-internal.h > +++ b/arch/x86/include/asm/fpu-internal.h > @@ -574,7 +574,7 @@ static inline int fpu_alloc(struct fpu *fpu) > { > if (fpu_allocated(fpu)) > return 0; > - fpu->state = kmem_cache_alloc(task_xstate_cachep, GFP_KERNEL); > + fpu->state = kmem_cache_alloc(task_xstate_cachep, GFP_ATOMIC); > if (!fpu->state) > return -ENOMEM; > WARN_ON((unsigned long)fpu->state & 15); > -- > Daniel J Blueman -- Andy Lutomirski AMA Capital Management, LLC -- 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/