All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Sinan Kaya <okaya@codeaurora.org>
Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
	timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com,
	agross@codeaurora.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] pci, acpi: free IO resource during shutdown
Date: Thu, 7 Apr 2016 11:06:24 -0500	[thread overview]
Message-ID: <20160407160624.GB8780@localhost> (raw)
In-Reply-To: <1457389310-3538-2-git-send-email-okaya@codeaurora.org>

Hi Sinan,

On Mon, Mar 07, 2016 at 05:21:50PM -0500, Sinan Kaya wrote:
> 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.

I don't know what "removing a slot" means.  You're changing
pci_root.c, so I assume this is really an ACPI host bridge removal?

The release should correspond to a mapping, and the changelog should
point out where that mapping happens so we can see the symmetry.

You say this is undoing the effect of pci_remap_iospace(), but that's
only called by native drivers and the generic (OF) driver, not by
pci_root.c.

Please combine this with the previous patch so we have the new
function and its use in the same patch.

>  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 [<ffff800000086e58>]
>  show_stack+0x10/0x1c [<ffff8000004d1f50>]
>  dump_stack+0x74/0xc4
>  panic+0xe4/0x21c [<ffff8000002577cc>]
>  ioremap_page_range+0x290/0x30c [<ffff8000002861dc>]
>  pci_remap_iospace+0x88/0xa0 [<ffff8000000908f8>]
>  setup_resource+0x114/0x16c [<ffff8000002c0fc0>]
>  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 [<ffff8000002a5628>]
>  acpi_bus_scan+0x58/0x74 [<ffff8000002a57c0>]
>  acpi_device_hotplug+0xc4/0x3f0 [<ffff8000002a0468>]
>  acpi_hotplug_work_fn+0x1c/0x34 [<ffff8000000b9310>]
>  process_one_work+0x1e8/0x308 [<ffff8000000b9b04>]
>  worker_thread+0x294/0x3cc  [<ffff8000000bd9
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  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);
> -- 
> 1.8.2.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: helgaas@kernel.org (Bjorn Helgaas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] pci, acpi: free IO resource during shutdown
Date: Thu, 7 Apr 2016 11:06:24 -0500	[thread overview]
Message-ID: <20160407160624.GB8780@localhost> (raw)
In-Reply-To: <1457389310-3538-2-git-send-email-okaya@codeaurora.org>

Hi Sinan,

On Mon, Mar 07, 2016 at 05:21:50PM -0500, Sinan Kaya wrote:
> 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.

I don't know what "removing a slot" means.  You're changing
pci_root.c, so I assume this is really an ACPI host bridge removal?

The release should correspond to a mapping, and the changelog should
point out where that mapping happens so we can see the symmetry.

You say this is undoing the effect of pci_remap_iospace(), but that's
only called by native drivers and the generic (OF) driver, not by
pci_root.c.

Please combine this with the previous patch so we have the new
function and its use in the same patch.

>  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 [<ffff800000086e58>]
>  show_stack+0x10/0x1c [<ffff8000004d1f50>]
>  dump_stack+0x74/0xc4
>  panic+0xe4/0x21c [<ffff8000002577cc>]
>  ioremap_page_range+0x290/0x30c [<ffff8000002861dc>]
>  pci_remap_iospace+0x88/0xa0 [<ffff8000000908f8>]
>  setup_resource+0x114/0x16c [<ffff8000002c0fc0>]
>  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 [<ffff8000002a5628>]
>  acpi_bus_scan+0x58/0x74 [<ffff8000002a57c0>]
>  acpi_device_hotplug+0xc4/0x3f0 [<ffff8000002a0468>]
>  acpi_hotplug_work_fn+0x1c/0x34 [<ffff8000000b9310>]
>  process_one_work+0x1e8/0x308 [<ffff8000000b9b04>]
>  worker_thread+0x294/0x3cc  [<ffff8000000bd9
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  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);
> -- 
> 1.8.2.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-04-07 16:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-07 22:21 [PATCH 1/2] pci: add pci_unmap_iospace function for PCI_IOBASE Sinan Kaya
2016-03-07 22:21 ` Sinan Kaya
2016-03-07 22:21 ` [PATCH 2/2] pci, acpi: free IO resource during shutdown Sinan Kaya
2016-03-07 22:21   ` Sinan Kaya
2016-04-07 16:06   ` Bjorn Helgaas [this message]
2016-04-07 16:06     ` Bjorn Helgaas
2016-04-07 17:45     ` Sinan Kaya
2016-04-07 17:45       ` Sinan Kaya
2016-04-07 21:41       ` Bjorn Helgaas
2016-04-07 21:41         ` Bjorn Helgaas
2016-04-08  3:40         ` Sinan Kaya
2016-04-08  3:40           ` Sinan Kaya
2016-04-08  6:51           ` Tomasz Nowicki
2016-04-08  6:51             ` Tomasz Nowicki
2016-04-08 17:46             ` Sinan Kaya
2016-04-08 17:46               ` Sinan Kaya
2016-04-09  8:44               ` Tomasz Nowicki
2016-04-09  8:44                 ` Tomasz Nowicki
2016-03-16 23:14 ` [PATCH 1/2] pci: add pci_unmap_iospace function for PCI_IOBASE Sinan Kaya
2016-03-16 23:14   ` Sinan Kaya
2016-04-07 16:00 ` Bjorn Helgaas
2016-04-07 16:00   ` Bjorn Helgaas
2016-04-07 17:49   ` Sinan Kaya
2016-04-07 17:49     ` Sinan Kaya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160407160624.GB8780@localhost \
    --to=helgaas@kernel.org \
    --cc=agross@codeaurora.org \
    --cc=cov@codeaurora.org \
    --cc=jcm@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=okaya@codeaurora.org \
    --cc=timur@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.