From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756181Ab3KHAJP (ORCPT ); Thu, 7 Nov 2013 19:09:15 -0500 Received: from mail-la0-f51.google.com ([209.85.215.51]:37887 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755752Ab3KHAJK (ORCPT ); Thu, 7 Nov 2013 19:09:10 -0500 Date: Fri, 8 Nov 2013 01:09:03 +0100 From: Johan Hovold To: Dave Jones Cc: linux-usb@vger.kernel.org, Linux Kernel Subject: Re: usb-serial lockdep trace in linus' current tree. Message-ID: <20131108000903.GD8555@localhost> References: <20131107223728.GA18157@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131107223728.GA18157@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 07, 2013 at 05:37:28PM -0500, Dave Jones wrote: > Seeing this since todays USB merge. > > WARNING: CPU: 0 PID: 226 at kernel/lockdep.c:2740 lockdep_trace_alloc+0xc5/0xd0() > DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) > Modules linked in: usb_debug(+) kvm_intel kvm crct10dif_pclmul crc32c_intel ghash_clmulni_intel microcode(+) pcspkr serio_raw > CPU: 0 PID: 226 Comm: systemd-udevd Not tainted 3.12.0+ #112 > ffffffff81a22d3d ffff88023cde5670 ffffffff8171a8e8 ffff88023cde56b8 > ffff88023cde56a8 ffffffff8105430d 0000000000000046 00000000000080d0 > 0000000000000010 0000000000000001 ffff880244407a80 ffff88023cde5708 > Call Trace: > [] dump_stack+0x4e/0x82 > [] warn_slowpath_common+0x7d/0xa0 > [] warn_slowpath_fmt+0x4c/0x50 > [] lockdep_trace_alloc+0xc5/0xd0 > [] __kmalloc+0x53/0x350 > [] ? xhci_urb_enqueue+0xb7/0x610 > [] ? debug_dma_mapping_error+0x7c/0x90 > [] xhci_urb_enqueue+0xb7/0x610 > [] usb_hcd_submit_urb+0xa6/0xae0 > [] ? native_sched_clock+0x24/0x80 > [] ? trace_hardirqs_off_caller+0x1f/0xc0 > [] ? native_sched_clock+0x24/0x80 > [] ? trace_hardirqs_off_caller+0x1f/0xc0 > [] ? get_lock_stats+0x19/0x60 > [] ? put_lock_stats.isra.28+0xe/0x40 > [] usb_submit_urb+0x1f9/0x470 > [] usb_serial_generic_write_start+0xf5/0x210 > [] usb_serial_generic_write+0x70/0x90 > [] usb_console_write+0xc7/0x220 > [] call_console_drivers.constprop.23+0xa5/0x1e0 > [] console_unlock+0x40c/0x460 > [] register_console+0x12c/0x390 > [] usb_serial_console_init+0x22/0x40 > [] usb_serial_probe+0xfea/0x10e0 > [] ? native_sched_clock+0x24/0x80 > [] ? trace_hardirqs_off_caller+0x1f/0xc0 > [] ? get_lock_stats+0x19/0x60 > [] ? __mutex_unlock_slowpath+0xed/0x1a0 > [] ? trace_hardirqs_on_caller+0x115/0x1e0 > [] ? trace_hardirqs_on+0xd/0x10 > [] usb_probe_interface+0x1cf/0x300 > [] driver_probe_device+0x87/0x390 > [] __driver_attach+0x93/0xa0 > [] ? __device_attach+0x40/0x40 > [] bus_for_each_dev+0x6b/0xb0 > [] driver_attach+0x1e/0x20 > [] usb_serial_register_drivers+0x29e/0x580 > [] ? 0xffffffffa0004fff > [] usb_serial_module_init+0x1e/0x1000 [usb_debug] > [] do_one_initcall+0xf2/0x1a0 > [] ? set_memory_nx+0x43/0x50 > [] load_module+0x1fd2/0x26a0 > [] ? store_uevent+0x40/0x40 > [] SyS_finit_module+0x86/0xb0 > [] tracesys+0xdd/0xe2 > ---[ end trace ee033a3c9fd6263b ]--- A recent change in usb-serial used the wrong memory-allocation flag in write(), which results in a [ 5.979005] BUG: sleeping function called from invalid context at /home/johan/src/linux/linux-nu/mm/dmapool.c:310 with usb-next when using a usb-serial console as you seem to do be doing as well. Could be related. Care to give the fix below a try? Thanks, Johan >>From 7caaef75ebba3cfa3916b53ce1aee95291802ac4 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 8 Nov 2013 00:44:31 +0100 Subject: [PATCH] USB: serial: fix write memory-allocation flag Fix regression introduced by commit 818f60365a29 ("USB: serial: add memory flags to usb_serial_generic_write_start"), which used GFP_KERNEL in write, which must not not sleep. --- drivers/usb/serial/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 2b01ec8651c2..538498646b06 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -208,7 +208,7 @@ int usb_serial_generic_write(struct tty_struct *tty, return 0; count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock); - result = usb_serial_generic_write_start(port, GFP_KERNEL); + result = usb_serial_generic_write_start(port, GFP_ATOMIC); if (result) return result; -- 1.8.4.2