Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp724368imm; Wed, 1 Aug 2018 04:22:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfjvDRsrx8PvRHKpAkUDYKwDjIzcBcpsjlLohWoQVUjlGBONNJQ4cESl2P2PdJ9hRGn9Ojw X-Received: by 2002:a62:1219:: with SMTP id a25-v6mr26581876pfj.104.1533122570293; Wed, 01 Aug 2018 04:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533122570; cv=none; d=google.com; s=arc-20160816; b=IipQ1kIJzMTn4ZPTKrVfup+qau4FbXdueahobOpU3/9K4H4snFRI473uKYTzUKl/f8 DiDDQCWuez+3jwRPuFIvIbjPVe4MHOBAU4qquE45Cp3ESsy104Hgf3uRlvKnjqTuCaoH 5QjLb3MYlY8GBCVw8OgLxnbbv87SwMeXHk2n9EsOiUX8oWATJu7Rjtru4yPwpr4tDoCD Cq0cw9SSa5weIdcDNBxcTx36sFDDTaF+W+FWHHuCCcOUIesUskpkPwkbTfUOiNIQuUiQ lNDQm4YO1eXqCoR6nCUB/MFHARqKD+BLNWUiYVxtdLDlO9rxbba9oeM235PHvGumaenT X9Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:arc-authentication-results; bh=bNKd65oIUvaNQQyg/b4E7txOJePScJe/ZTkqCOCQoZA=; b=n0PU2x4guhJk0JtIMiGZJtLKxLUsNQOlZnx91qnT5njQWXnLc6eHNsIk7IB4XN+TTo 0fWcGPaodehloz8DyDcCf8wRS8nNirWALr/w4robYsYoJe0YsW7P5OuXjCYOmQ+JmTzI boCnBcdNf/kEb69Sqda7b+jlwmWakfTl52UbYRuhuAmjbCYWoqRnRb6gwwpjiYCxfjHd TAzGDNsrKfwsOxQb1ubkQQUo6rOJ1nlJ4JIrIPTLD18h4r9ezDBT3JlENYVUUEtuIc+b eb+C1Ww3JJW3ERgr1h0TkAS+a/TfMxahArFPzq3lQ9QLZjI5+zxMqgqd5i/x/qf4PNvx LtQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si15002471plb.221.2018.08.01.04.22.36; Wed, 01 Aug 2018 04:22:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389083AbeHANHF (ORCPT + 99 others); Wed, 1 Aug 2018 09:07:05 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:36314 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388565AbeHANHF (ORCPT ); Wed, 1 Aug 2018 09:07:05 -0400 Received: by mail-ua0-f194.google.com with SMTP id c12-v6so12429373uan.3; Wed, 01 Aug 2018 04:21:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bNKd65oIUvaNQQyg/b4E7txOJePScJe/ZTkqCOCQoZA=; b=GKdBF3L1bCgr69Mqr2qnMmEVkUazNaq1QUz58D+vx7H5iyZPbXyDseOKtVR/FYIhTp djz3xDiTYfwGO4uZDoALqcMURae7Setlv4qoq28WzQw4kG98hlLCJk86/Zwz+JSAi3Fh PqaR6q2K7mmmtZd+VnW+xg5AUJd12/kTv8liF06+yIt05HDwS4CLjRnR1xeg8lXX/izI FeOv5R9i8O/FgMQH/C5InTrqbKrSUQo3Z0sx4eOJKAWiFRqM98XExTFKXCy6F3R5lyjT rFKpSceZ0vQU4UzihGBaWjYFOcikd0zJXB3cOoxnbED4c2Dt49/3yXwgzXwb0/fsFkC0 QUzw== X-Gm-Message-State: AOUpUlEfLQfCvh+zf9JpZg9yLzdBV6k9tei9u+p9yE+Eqp7HRUnQWGHz 4n2/6VLGNDqSBDiBmdBBUkDuxyM2sZb0w3cUJBk= X-Received: by 2002:a9f:37c8:: with SMTP id q66-v6mr17906765uaq.180.1533122504428; Wed, 01 Aug 2018 04:21:44 -0700 (PDT) MIME-Version: 1.0 References: <6008699.T6Yd1fn3Dk@amdc3058> <1975707.vO8kdHz3oS@amdc3058> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 1 Aug 2018 13:21:31 +0200 Message-ID: Subject: Re: Sleeping from invalid context in udlfb To: Mikulas Patocka Cc: Bartlomiej Zolnierkiewicz , Dave Airlie , Bernie Thompson , Ladislav Michl , DRI Development , Linux Fbdev development list , Greg KH , Jiri Slaby , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mikulas, On Wed, Aug 1, 2018 at 12:59 PM Mikulas Patocka wrote: > On Wed, 1 Aug 2018, Geert Uytterhoeven wrote: > > On Tue, Jul 31, 2018 at 5:23 PM Mikulas Patocka wrote: > > > BTW when using the udlfb driver as a console, I've got this warning. > > > vt_console_print takes a spinlock and then calls the framebuffer driver > > > that sleeps. > > > > > > The question is - whose fault is this? Could the console code somehow be > > > told to print characters without holding a spinlock? Or does it mean that > > > framebuffer drivers can't sleep? > > > > > > udlfb communicates through USB, so the sleeping is inevitable. > > > > > > Mikulas > > > > > > > > > BUG: sleeping function called from invalid context at mm/slab.h:421 > > > in_atomic(): 1, irqs_disabled(): 0, pid: 430, name: kworker/2:3 > > > 6 locks held by kworker/2:3/430: > > > #0: 000000001301127e ( (wq_completion)"events"){....} , at: process_one_work+0x17c/0x3a8 > > > #1: 00000000beacc951 ( (work_completion)(&(&dlfb->init_framebuffer_work)->work)){....} , at: process_one_work+0x17c/0x3a8 > > > #2: 00000000a402f826 ( registration_lock){....} , at: register_framebuffer+0x28/0x2c0 [fb] > > > #3: 0000000021cbe902 ( console_lock){....} , at: register_framebuffer+0x258/0x2c0 [fb] > > > #4: 0000000096d51735 ( console_owner){....} , at: console_unlock+0x174/0x500 > > > #5: 00000000faa7f206 ( printing_lock){....} , at: vt_console_print+0x60/0x3a0 > > > Preemption disabled at: [] vt_console_print+0x60/0x3a0 > > > CPU: 2 PID: 430 Comm: kworker/2:3 Not tainted 4.17.10-debug #3 > > > Hardware name: Marvell Armada 8040 MacchiatoBin/Armada 8040 MacchiatoBin, BIOS EDK II Jul 30 2018 > > > Workqueue: events dlfb_init_framebuffer_work [udlfb] > > > Call trace: > > > dump_backtrace+0x0/0x150 > > > show_stack+0x14/0x20 > > > dump_stack+0x8c/0xac > > > ___might_sleep+0x140/0x170 > > > __might_sleep+0x50/0x88 > > > __kmalloc+0x1b0/0x270 > > > xhci_urb_enqueue+0xa8/0x460 [xhci_hcd] > > > usb_hcd_submit_urb+0xc0/0x998 [usbcore] > > > usb_submit_urb+0x1e0/0x518 [usbcore] > > > dlfb_submit_urb+0x38/0x98 [udlfb] > > > dlfb_handle_damage.isra.4+0x1e0/0x210 [udlfb] > > > dlfb_ops_imageblit+0x28/0x38 [udlfb] > > > soft_cursor+0x15c/0x1d8 [fb] > > > bit_cursor+0x324/0x510 [fb] > > > fbcon_cursor+0x144/0x1a0 [fb] > > > hide_cursor+0x38/0xa0 > > > vt_console_print+0x334/0x3a0 > > > console_unlock+0x274/0x500 > > > register_framebuffer+0x22c/0x2c0 [fb] > > > dlfb_init_framebuffer_work+0x1ec/0x2fc [udlfb] > > > process_one_work+0x1e8/0x3a8 > > > worker_thread+0x44/0x418 > > > kthread+0x11c/0x120 > > > ret_from_fork+0x10/0x18 > > > > This is sort of expected: you cannot do USB transfers from printk(). > > > > Gr{oetje,eeting}s, > > > > Geert > > So, should there be a framebuffer flag that prevents the console from > binding to it? > > If I start the kernel with "console=ttyS0,115200", it doesn't try to bind > to the udlfb driver, but if I start it without this flag, it does and > crashes :-( Your frame buffer driver should offload tasks that may sleep to e.g. a workqueue. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds