From patchwork Wed Oct 17 14:03:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10645683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 268D81057 for ; Wed, 17 Oct 2018 14:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 139C42B14E for ; Wed, 17 Oct 2018 14:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 078182B158; Wed, 17 Oct 2018 14:03:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2C462B155 for ; Wed, 17 Oct 2018 14:03:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ACDF76B000A; Wed, 17 Oct 2018 10:03:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A560A6B000D; Wed, 17 Oct 2018 10:03:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91EEC6B000E; Wed, 17 Oct 2018 10:03:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by kanga.kvack.org (Postfix) with ESMTP id 1D4EA6B000A for ; Wed, 17 Oct 2018 10:03:26 -0400 (EDT) Received: by mail-lj1-f199.google.com with SMTP id v62-v6so7721502lje.9 for ; Wed, 17 Oct 2018 07:03:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:mime-version:content-transfer-encoding; bh=2OVLIv4pvK4XbXbssL49o+sbDOxAj20Y8ait05owHZA=; b=rASY5eXnC7LlR9DEfvAiJZKB7VyRAjPzxf7cc5721ANRAso25tXj39yTtFJx75Gqkx 2t7msTCeV4uMAF8/8sVNy6Fgb+vMXKiko4Q48m+UJGw1y3/9H40JOY/sl7WoELEXkjOx vEfrFAZkkzcR+XTHmVv703ECmWC+gNzOnQ3DUikbew4SdtoT8gsxzYs/aRxNVF/wK8m5 y4MtdKvaa7KPQuKNv8KFt3++6APX9YaGWG2SjVHS6NWk5OG3M3uvceMK+g3wGk7+dBhp /VUm7iD+FXax+I1ke4AY1iBG/xH93Z+iUW1LV0TH7s+fusBIvzUZ90QuZ0Lci/8U6wEU babw== X-Gm-Message-State: ABuFfoiszSZroZYZj504SN5G3IEZHbDS7kdWjyZVetXH0VaKj7/WfKkb 7ssdg5/0RkjUINhv9DkvzgQN35iiCHfI5HvRjKzQHmlLWHoyUYxTfTtgyy5TxTt4HEnfX4voC4j Dzj4gwZuUtw7njPbxAuW3AXYqbt4/hHWzVqbNL+D4VZMBKVF6pYCI80zSLcGir0r0ljJD3dw7dD h8XPYdDL6LkOiowyW0lMDb677Qedgs3FphCl5qEJaA8Iw52kJBIEihDnsUxMusFTRdRnDvFL6fS a+Eadw9R2yEV/DtRyUcjsd7UcrMxfy8VNE9IuRt4vpMepV8cAnTFhniVHmEzGtxnbdLcwHx/0MJ oAk41aSdRRBK8NiY3i3Z/eV7CJUvboYeMZzJ/IDJJm6+yjhQqLX3N0PG/dpzG6lsja3HnxYmEqO x X-Received: by 2002:a2e:98c2:: with SMTP id s2-v6mr12075324ljj.19.1539785005062; Wed, 17 Oct 2018 07:03:25 -0700 (PDT) X-Received: by 2002:a2e:98c2:: with SMTP id s2-v6mr12075266ljj.19.1539785003899; Wed, 17 Oct 2018 07:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539785003; cv=none; d=google.com; s=arc-20160816; b=cj9UYelcHI30oE/5Z7vTtQ6QgW2xUYRLxKaMTuPNJveX+GHzojT34A9AuZLclEvc91 QG5F0ugrIF9xqZ3NHRCaE6WpubDqNdnJzFuBVyVawQl29eW3O9XPGynRStG8lPCQOyku fT0aWyx5veO88TajGCI9tc/bNec9KcVaNioqJtNIgHTGornLl9/QvHVbemvpTLWKbU9V +0wPxyLE0wrBdrOi2uCKy1mQzkMnur2PuBYLq61WUNzpETBOIyU8ec/yb+TohR/qVkwQ JVDGp8OxWEDfz1omi3vRcZK1/aZqa3q0blzvvhDqtLe3koalt7t2Ijpe0hyIYJ5cor0r HmGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=2OVLIv4pvK4XbXbssL49o+sbDOxAj20Y8ait05owHZA=; b=nbE+Kzz4C0FLK/jkjgt2vhJOz9eb4HB1HDQn7QE3RTyci4PeJf20ILj1pJEu/jZJsR Im73GRpS6iJDX7e9YQSqq3X00jq8Tbm/XZQH4ykfuy620xmBfCstj1DlACmdp7Y+rZ0H 7u2f5SUTI9JMrAAs+Y+wxP33YoIJexPACtWiOzbrIavo3hW7ZFWdklhghoU/zJlBkKqF 4MBM0gdOGQ0Sra8g1vyFe3ZhbIOjfINf88OcC7d6o63zDqLjbRPuyObL5pUHGFZDwUFa wIyaKwuuX3u1CLE45rgW8jTmWDlU/4OGUxMVuAqFOuCjB8QrOzLFLUHlMJtn8jt7SHEW Sclg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gR94kALd; spf=pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s81-v6sor3309457lfs.47.2018.10.17.07.03.23 for (Google Transport Security); Wed, 17 Oct 2018 07:03:23 -0700 (PDT) Received-SPF: pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gR94kALd; spf=pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2OVLIv4pvK4XbXbssL49o+sbDOxAj20Y8ait05owHZA=; b=gR94kALd7TJgf5KSzQ0BeBDO/KnKugVpX9MaEe+IiXNjdnMswjUbw438EFPpKm5AlY ZZ/kZg6v3/jiTOVcfi87k7bW9a6ENuj0Z9+4rG5ko1xiZhNhLgfHSb660qUcKzeTSWrk MxtQtUJwYi67/q3bWfr7p5XqoGMYBdzC9ltXQ= X-Google-Smtp-Source: ACcGV63+7PHqdPWkwXKKgC0n01Ja+9wkJ/YFluFvwY90yj5/x8DubZbWZNEG4KjqPiKeWd/s8CvWew== X-Received: by 2002:a19:e013:: with SMTP id x19-v6mr15182454lfg.89.1539785003149; Wed, 17 Oct 2018 07:03:23 -0700 (PDT) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id y3-v6sm4093739ljy.95.2018.10.17.07.03.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Oct 2018 07:03:22 -0700 (PDT) From: Anders Roxell To: linux@armlinux.org.uk, gregkh@linuxfoundation.org, akpm@linux-foundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, tj@kernel.org, Anders Roxell , Arnd Bergmann Subject: [PATCH 1/2] serial: set suppress_bind_attrs flag only if builtin Date: Wed, 17 Oct 2018 16:03:10 +0200 Message-Id: <20181017140311.28679-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP When the test 'CONFIG_DEBUG_TEST_DRIVER_REMOVE=y' is enabled, arch_initcall(pl011_init) came before subsys_initcall(default_bdi_init). devtmpfs gets killed because we try to remove a file and decrement the wb reference count before the noop_backing_device_info gets initialized. [ 0.332075] Serial: AMBA PL011 UART driver [ 0.485276] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 39, base_baud = 0) is a PL011 rev1 [ 0.502382] console [ttyAMA0] enabled [ 0.515710] Unable to handle kernel paging request at virtual address 0000800074c12000 [ 0.516053] Mem abort info: [ 0.516222] ESR = 0x96000004 [ 0.516417] Exception class = DABT (current EL), IL = 32 bits [ 0.516641] SET = 0, FnV = 0 [ 0.516826] EA = 0, S1PTW = 0 [ 0.516984] Data abort info: [ 0.517149] ISV = 0, ISS = 0x00000004 [ 0.517339] CM = 0, WnR = 0 [ 0.517553] [0000800074c12000] user address but active_mm is swapper [ 0.517928] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 0.518305] Modules linked in: [ 0.518839] CPU: 0 PID: 13 Comm: kdevtmpfs Not tainted 4.19.0-rc5-next-20180928-00002-g2ba39ab0cd01-dirty #82 [ 0.519307] Hardware name: linux,dummy-virt (DT) [ 0.519681] pstate: 80000005 (Nzcv daif -PAN -UAO) [ 0.519959] pc : __destroy_inode+0x94/0x2a8 [ 0.520212] lr : __destroy_inode+0x78/0x2a8 [ 0.520401] sp : ffff0000098c3b20 [ 0.520590] x29: ffff0000098c3b20 x28: 00000000087a3714 [ 0.520904] x27: 0000000000002000 x26: 0000000000002000 [ 0.521179] x25: ffff000009583000 x24: 0000000000000000 [ 0.521467] x23: ffff80007bb52000 x22: ffff80007bbaa7c0 [ 0.521737] x21: ffff0000093f9338 x20: 0000000000000000 [ 0.522033] x19: ffff80007bbb05d8 x18: 0000000000000400 [ 0.522376] x17: 0000000000000000 x16: 0000000000000000 [ 0.522727] x15: 0000000000000400 x14: 0000000000000400 [ 0.523068] x13: 0000000000000001 x12: 0000000000000001 [ 0.523421] x11: 0000000000000000 x10: 0000000000000970 [ 0.523749] x9 : ffff0000098c3a60 x8 : ffff80007bbab190 [ 0.524017] x7 : ffff80007bbaa880 x6 : 0000000000000c88 [ 0.524305] x5 : ffff0000093d96c8 x4 : 61c8864680b583eb [ 0.524567] x3 : ffff0000093d6180 x2 : ffffffffffffffff [ 0.524872] x1 : 0000800074c12000 x0 : 0000800074c12000 [ 0.525207] Process kdevtmpfs (pid: 13, stack limit = 0x(____ptrval____)) [ 0.525529] Call trace: [ 0.525806] __destroy_inode+0x94/0x2a8 [ 0.526108] destroy_inode+0x34/0x88 [ 0.526370] evict+0x144/0x1c8 [ 0.526636] iput+0x184/0x230 [ 0.526871] dentry_unlink_inode+0x118/0x130 [ 0.527152] d_delete+0xd8/0xe0 [ 0.527420] vfs_unlink+0x240/0x270 [ 0.527665] handle_remove+0x1d8/0x330 [ 0.527875] devtmpfsd+0x138/0x1c8 [ 0.528085] kthread+0x14c/0x158 [ 0.528291] ret_from_fork+0x10/0x18 [ 0.528720] Code: 92800002 aa1403e0 d538d081 8b010000 (c85f7c04) [ 0.529367] ---[ end trace 5a3dee47727f877c ]--- Rework to set suppress_bind_attrs flag to avoid removing the device when CONFIG_DEBUG_TEST_DRIVER_REMOVE=y. This applies for pic32_uart and xilinx_uartps as well. Cc: Arnd Bergmann Co-developed-by: Arnd Bergmann Signed-off-by: Anders Roxell --- drivers/tty/serial/amba-pl011.c | 2 ++ drivers/tty/serial/pic32_uart.c | 1 + drivers/tty/serial/xilinx_uartps.c | 1 + 3 files changed, 4 insertions(+) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index ebd33c0232e6..89ade213a1a9 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2780,6 +2780,7 @@ static struct platform_driver arm_sbsa_uart_platform_driver = { .name = "sbsa-uart", .of_match_table = of_match_ptr(sbsa_uart_of_match), .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), }, }; @@ -2808,6 +2809,7 @@ static struct amba_driver pl011_driver = { .drv = { .name = "uart-pl011", .pm = &pl011_dev_pm_ops, + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), }, .id_table = pl011_ids, .probe = pl011_probe, diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c index fd80d999308d..0bdf1687983f 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -919,6 +919,7 @@ static struct platform_driver pic32_uart_platform_driver = { .driver = { .name = PIC32_DEV_NAME, .of_match_table = of_match_ptr(pic32_serial_dt_ids), + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_PIC32), }, }; diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 0e3dae461f71..806a953ac8d4 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1717,6 +1717,7 @@ static struct platform_driver cdns_uart_platform_driver = { .name = CDNS_UART_NAME, .of_match_table = cdns_uart_of_match, .pm = &cdns_uart_dev_pm_ops, + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_XILINX_PS_UART), }, }; From patchwork Wed Oct 17 14:03:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10645685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 038EB15E2 for ; Wed, 17 Oct 2018 14:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1EBD2B12F for ; Wed, 17 Oct 2018 14:03:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D58692B155; Wed, 17 Oct 2018 14:03:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 324462B12F for ; Wed, 17 Oct 2018 14:03:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A1CC6B000E; Wed, 17 Oct 2018 10:03:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 32A016B0010; Wed, 17 Oct 2018 10:03:36 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21AF36B0266; Wed, 17 Oct 2018 10:03:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by kanga.kvack.org (Postfix) with ESMTP id A273A6B000E for ; Wed, 17 Oct 2018 10:03:35 -0400 (EDT) Received: by mail-lj1-f199.google.com with SMTP id v62-v6so7721642lje.9 for ; Wed, 17 Oct 2018 07:03:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=FYD5OgbslaSN2IMFW2M3a1vvfCw0/W1XvkhV0Wehs50=; b=JYCvkG1HOBs46Guy0j2b4PJHTJ1EM6fKc3JIOMSVHhw97cZ69RoulqM9wyK/7/g3XK Vs8D1hg6I0f/hOZ+CNWBa35RcHhJHUpCKOxRzd+NWjEY7G27hilRIksfb/b5PfrEd9wf 8O6QlYxl4rZV/aUW4QNUuepdF/gi+ZVuPn+EdOIWHYnN5jNameaPSgu3/qLsPj0HM/mr Q4pNU47UDworHSaF4bkjGrBKf9RWfWIOpV0UCmuRrrG2KUvNTrZeQXNZwIB5q8M4qFRg R2Sf4o9rVkN21Wii1Vi5ocf4T+49fB6cyYq4jnoZ4n5BJjtPOMSyG4RI2Glz8kRB88oy y9dQ== X-Gm-Message-State: ABuFfoivlLNmdfIqXMBvr1U91/i3DY5E7q1o7i1nZYMO+TGS7OY3THlb azLetg7gcSdbXAh/NKY1aOi5Zpz8rtE4Nx2Xlx2rO+0r/qJZIL8MISNKwoW3tgXyZ7qYk0eXxmL 8/UwpegT4vJFSwi8WhQIVP1XRmz3pUszFg6oO4FgE5rOTQaptkbYJfWzpI0FjK0k8UCP3C032q7 529vCxPE49K7xovRqbO4w5VXbvvgi+P6ggOcgqgn636WknHJ3OFt+UutnriWH3C3AaxgIKxCuEd IgQ2xyZt2yPCnW543bYZmEctSTqgpgPSPPsiElvrf6ToY9QxRRtUaB6d38yDNmDi85kGjcdKWQB bmCIzp3jOuXdBCbZ3hO/zqWANWMLllldcgNDVOFm/O9L5cX8zb+IkNCjxVHfgauHaVgct1DKYNo F X-Received: by 2002:a19:f514:: with SMTP id j20-v6mr15610358lfb.13.1539785015014; Wed, 17 Oct 2018 07:03:35 -0700 (PDT) X-Received: by 2002:a19:f514:: with SMTP id j20-v6mr15610287lfb.13.1539785013501; Wed, 17 Oct 2018 07:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539785013; cv=none; d=google.com; s=arc-20160816; b=APBqSdbV/EKB71xPOdeqRNZ4U/i24DNcZIETUf0PV/kJiPUkzXiFW+wUfH3gkSeGwJ vTbBnxMWJi2wrjDT8qubbeemQU/wiL3G9R6nafy29MpOHgz6KSjOCOD28rwo9uiFnPot MFSV3+Ac2O7prOhM1YFbgBMm2OSImqwH/owk/zhzciBu4VtXfzvZu2sQZPuct8y4ivwJ puLS+Q07YrCgLpvTxuNpdGEiwfubLMtPXmq/dUUOyJMS4ntgQn3t990DuLUrjtZu2Gas ef/FUzL1OZZfF6zNKnldTKT92bx6f8JV/EgrFHEvJ6hwXieNtBnmTZWVxz6fQ070fl30 S+2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=FYD5OgbslaSN2IMFW2M3a1vvfCw0/W1XvkhV0Wehs50=; b=BNP/ZB7iAJXZAEpE63dQGu31RCyxU5g04Mu6P/7eLBNXz4PF+bClAe0eOKN6pG76VN 837EnHGNY+hw8UGtCEaWEC/sDtd3alMv5tVE003pjubBcdvv8mmwICyJmq5K+e/0VIEH jIVdCCaFQta6JYw2cBDt4lJzomKrDxDgs8xxamI6meef6NL0XvMZXMUy1UgsjuGYQzeE dp3fvXE+r/1LPzTIJgrJmd1ETulx0fT632I6m1lQww/CNL+jg50xtyCcdUXuYw5J8fuB eZTYwrUCGOxYVaNUBKRE0edMcZRq43DnHTayUAKsGKKwaj905BNU45p3stPNehvyjleu f/8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O4IetBcJ; spf=pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id i8-v6sor1243244lfc.39.2018.10.17.07.03.33 for (Google Transport Security); Wed, 17 Oct 2018 07:03:33 -0700 (PDT) Received-SPF: pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O4IetBcJ; spf=pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FYD5OgbslaSN2IMFW2M3a1vvfCw0/W1XvkhV0Wehs50=; b=O4IetBcJP4FShQawjKO6gD6lkk5p+jXVhrvJjpxnlEbgSrp6i/UyAMQVXvVlNYshZa EguhuuvDlRAJCOPsDRf0dztrSz2A7vIkoDmMjSp2yUrhMgf9aU7SipV+RsEUNZozm+Hj f8KkWtM8gK//jIKmnWh8upOytH4pJ5PUNe+3k= X-Google-Smtp-Source: ACcGV63oXudWyvUqX71gA0NBw/l59Ng2ymIskw4Cf2YDo5cX7uwVlXjZXnw2R1nnePcu2vSpH/RvvQ== X-Received: by 2002:a19:c189:: with SMTP id r131-v6mr14739969lff.59.1539785012982; Wed, 17 Oct 2018 07:03:32 -0700 (PDT) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id o101-v6sm3931820lfg.53.2018.10.17.07.03.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Oct 2018 07:03:32 -0700 (PDT) From: Anders Roxell To: linux@armlinux.org.uk, gregkh@linuxfoundation.org, akpm@linux-foundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, tj@kernel.org, Anders Roxell , Arnd Bergmann Subject: [PATCH 2/2] writeback: don't decrement wb->refcnt if !wb->bdi Date: Wed, 17 Oct 2018 16:03:11 +0200 Message-Id: <20181017140311.28679-2-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181017140311.28679-1-anders.roxell@linaro.org> References: <20181017140311.28679-1-anders.roxell@linaro.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP When enabling CONFIG_DEBUG_TEST_DRIVER_REMOVE devtmpfs gets killed because we try to remove a file and decrement the wb reference count before the noop_backing_device_info gets initialized. Since arch_initcall(pl011_init) came before subsys_initcall(default_bdi_init), devtmpfs' handle_remove() crashes because the reference count is a NULL pointer only because bdi->wb hasn't been initialized yet. [ 0.332075] Serial: AMBA PL011 UART driver [ 0.485276] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 39, base_baud = 0) is a PL011 rev1 [ 0.502382] console [ttyAMA0] enabled [ 0.515710] Unable to handle kernel paging request at virtual address 0000800074c12000 [ 0.516053] Mem abort info: [ 0.516222] ESR = 0x96000004 [ 0.516417] Exception class = DABT (current EL), IL = 32 bits [ 0.516641] SET = 0, FnV = 0 [ 0.516826] EA = 0, S1PTW = 0 [ 0.516984] Data abort info: [ 0.517149] ISV = 0, ISS = 0x00000004 [ 0.517339] CM = 0, WnR = 0 [ 0.517553] [0000800074c12000] user address but active_mm is swapper [ 0.517928] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 0.518305] Modules linked in: [ 0.518839] CPU: 0 PID: 13 Comm: kdevtmpfs Not tainted 4.19.0-rc5-next-20180928-00002-g2ba39ab0cd01-dirty #82 [ 0.519307] Hardware name: linux,dummy-virt (DT) [ 0.519681] pstate: 80000005 (Nzcv daif -PAN -UAO) [ 0.519959] pc : __destroy_inode+0x94/0x2a8 [ 0.520212] lr : __destroy_inode+0x78/0x2a8 [ 0.520401] sp : ffff0000098c3b20 [ 0.520590] x29: ffff0000098c3b20 x28: 00000000087a3714 [ 0.520904] x27: 0000000000002000 x26: 0000000000002000 [ 0.521179] x25: ffff000009583000 x24: 0000000000000000 [ 0.521467] x23: ffff80007bb52000 x22: ffff80007bbaa7c0 [ 0.521737] x21: ffff0000093f9338 x20: 0000000000000000 [ 0.522033] x19: ffff80007bbb05d8 x18: 0000000000000400 [ 0.522376] x17: 0000000000000000 x16: 0000000000000000 [ 0.522727] x15: 0000000000000400 x14: 0000000000000400 [ 0.523068] x13: 0000000000000001 x12: 0000000000000001 [ 0.523421] x11: 0000000000000000 x10: 0000000000000970 [ 0.523749] x9 : ffff0000098c3a60 x8 : ffff80007bbab190 [ 0.524017] x7 : ffff80007bbaa880 x6 : 0000000000000c88 [ 0.524305] x5 : ffff0000093d96c8 x4 : 61c8864680b583eb [ 0.524567] x3 : ffff0000093d6180 x2 : ffffffffffffffff [ 0.524872] x1 : 0000800074c12000 x0 : 0000800074c12000 [ 0.525207] Process kdevtmpfs (pid: 13, stack limit = 0x(____ptrval____)) [ 0.525529] Call trace: [ 0.525806] __destroy_inode+0x94/0x2a8 [ 0.526108] destroy_inode+0x34/0x88 [ 0.526370] evict+0x144/0x1c8 [ 0.526636] iput+0x184/0x230 [ 0.526871] dentry_unlink_inode+0x118/0x130 [ 0.527152] d_delete+0xd8/0xe0 [ 0.527420] vfs_unlink+0x240/0x270 [ 0.527665] handle_remove+0x1d8/0x330 [ 0.527875] devtmpfsd+0x138/0x1c8 [ 0.528085] kthread+0x14c/0x158 [ 0.528291] ret_from_fork+0x10/0x18 [ 0.528720] Code: 92800002 aa1403e0 d538d081 8b010000 (c85f7c04) [ 0.529367] ---[ end trace 5a3dee47727f877c ]--- Rework so that wb_put have an extra check if wb->bdi before decrement wb->refcnt and also add a WARN_ON to get a warning if it happens again in other drivers. Fixes: 52ebea749aae ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks") Cc: Arnd Bergmann Co-developed-by: Arnd Bergmann Signed-off-by: Anders Roxell Signed-off-by: Arnd, please. --- include/linux/backing-dev-defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 9a6bc0951cfa..20721550d32a 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -258,7 +258,7 @@ static inline void wb_get(struct bdi_writeback *wb) */ static inline void wb_put(struct bdi_writeback *wb) { - if (wb != &wb->bdi->wb) + if (!WARN_ON(!wb->bdi) && wb != &wb->bdi->wb) percpu_ref_put(&wb->refcnt); }