From patchwork Mon Mar 7 22:21:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 8523541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DCE849F7CA for ; Mon, 7 Mar 2016 22:24:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 040C12022D for ; Mon, 7 Mar 2016 22:24:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 319AD2021A for ; Mon, 7 Mar 2016 22:24:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ad3Xt-0001Fz-Vf; Mon, 07 Mar 2016 22:22:33 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ad3Xr-0001DR-Iz for linux-arm-kernel@lists.infradead.org; Mon, 07 Mar 2016 22:22:32 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id B9C326074A; Mon, 7 Mar 2016 22:22:12 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AD2FE608BC; Mon, 7 Mar 2016 22:22:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1FED26074A; Mon, 7 Mar 2016 22:22:10 +0000 (UTC) From: Sinan Kaya To: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com Subject: [PATCH 2/2] pci, acpi: free IO resource during shutdown Date: Mon, 7 Mar 2016 17:21:50 -0500 Message-Id: <1457389310-3538-2-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1457389310-3538-1-git-send-email-okaya@codeaurora.org> References: <1457389310-3538-1-git-send-email-okaya@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160307_142232_016253_864C1AFA X-CRM114-Status: GOOD ( 12.28 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sinan Kaya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, agross@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The ACPI PCI driver is leaking out memory mappings when a slot is removed. Upon insertion following a removal, we are hitting a BUG statement. Second call to the remap API hits a bug statement because the area is already mapped. This patch releases additional virtual memory mapped by pci_remap_iospace function as part of __release_pci_root_info function if the region type is IO. BUG: failure at kernel/lib/ioremap.c:31/ioremap_pte_range()! Kernel panic - not syncing: BUG! CPU: 1 PID: 630 Comm: kworker/u48:3 Not tainted Workqueue: kacpi_hotplug acpi_hotplug_work_fn Call trace: dump_backtrace+0x0/0x10c [] show_stack+0x10/0x1c [] dump_stack+0x74/0xc4 panic+0xe4/0x21c [] ioremap_page_range+0x290/0x30c [] pci_remap_iospace+0x88/0xa0 [] setup_resource+0x114/0x16c [] acpi_walk_resource_buffer+0x54/0xb0 acpi_walk_resources+0x90/0xbc pci_acpi_scan_root+0x184/0x2d0 acpi_pci_root_add+0x368/0x434 acpi_bus_attach+0x124/0x22c [] acpi_bus_scan+0x58/0x74 [] acpi_device_hotplug+0xc4/0x3f0 [] acpi_hotplug_work_fn+0x1c/0x34 [] process_one_work+0x1e8/0x308 [] worker_thread+0x294/0x3cc [ --- drivers/acpi/pci_root.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 71bbfae..6d4bc2d 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -946,6 +946,8 @@ static void acpi_pci_root_release_info(struct pci_host_bridge *bridge) resource_list_for_each_entry(entry, &bridge->windows) { res = entry->res; + if (res->flags & IORESOURCE_IO) + pci_unmap_iospace(res); if (res->parent && (res->flags & (IORESOURCE_MEM | IORESOURCE_IO))) release_resource(res);