From: Yisheng Xie <xieyisheng1@huawei.com>
To: <bhelgaas@google.com>, <rjw@rjwysocki.net>, <lenb@kernel.org>
Cc: <linux-pci@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <guohanjun@huawei.com>,
<jcm@redhat.com>, <toshi.kani@hpe.com>, <tanxiaojun@huawei.com>,
<wangzhou1@hisilicon.com>
Subject: Re: [PATCH v2 1/2] PCI ACPI: Avoid panic when PCI IO resource's size is not page aligned
Date: Thu, 19 Apr 2018 16:03:01 +0800 [thread overview]
Message-ID: <cabc6d02-af9b-9322-a48b-4e525ba8aef9@huawei.com> (raw)
In-Reply-To: <1522480343-37669-1-git-send-email-xieyisheng1@huawei.com>
Hi all,
ping... Sorry to disturb, but any comment about this patchset?
Thanks
Yisheng
On 2018/3/31 15:12, Yisheng Xie wrote:
> Zhou reported a bug on Hisilicon arm64 D06 platform with 64KB page size:
>
> [ 2.470908] kernel BUG at lib/ioremap.c:72!
> [ 2.475079] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
> [ 2.480551] Modules linked in:
> [ 2.483594] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.16.0-rc7-00062-g0b41260-dirty #23
> [ 2.491756] Hardware name: Huawei D06/D06, BIOS Hisilicon D06 UEFI Nemo 2.0 RC0 - B120 03/23/2018
> [ 2.500614] pstate: 80c00009 (Nzcv daif +PAN +UAO)
> [ 2.505395] pc : ioremap_page_range+0x268/0x36c
> [ 2.509912] lr : pci_remap_iospace+0xe4/0x100
> [...]
> [ 2.603733] Call trace:
> [ 2.606168] ioremap_page_range+0x268/0x36c
> [ 2.610337] pci_remap_iospace+0xe4/0x100
> [ 2.614334] acpi_pci_probe_root_resources+0x1d4/0x214
> [ 2.619460] pci_acpi_root_prepare_resources+0x18/0xa8
> [ 2.624585] acpi_pci_root_create+0x98/0x214
> [ 2.628843] pci_acpi_scan_root+0x124/0x20c
> [ 2.633013] acpi_pci_root_add+0x224/0x494
> [ 2.637096] acpi_bus_attach+0xf8/0x200
> [ 2.640918] acpi_bus_attach+0x98/0x200
> [ 2.644740] acpi_bus_attach+0x98/0x200
> [ 2.648562] acpi_bus_scan+0x48/0x9c
> [ 2.652125] acpi_scan_init+0x104/0x268
> [ 2.655948] acpi_init+0x308/0x374
> [ 2.659337] do_one_initcall+0x48/0x14c
> [ 2.663160] kernel_init_freeable+0x19c/0x250
> [ 2.667504] kernel_init+0x10/0x100
> [ 2.670979] ret_from_fork+0x10/0x18
>
> The cause is the size of PCI IO resource is 32KB, which is 4K aligned but
> not 64KB aligned, however, ioremap_page_range() request the range as page
> aligned or it will trigger a BUG_ON() on ioremap_pte_range() it calls, as
> ioremap_pte_range increase the addr by PAGE_SIZE, which makes addr != end
> until trigger BUG_ON, if its incoming end is not page aligned. More detail
> trace is as following:
>
> ioremap_page_range
> -> ioremap_p4d_range
> -> ioremap_p4d_range
> -> ioremap_pud_range
> -> ioremap_pmd_range
> -> ioremap_pte_range
>
> This patch fix the bug by align the size of PCI IO resource to PAGE_SIZE.
>
> Reported-by: Zhou Wang <wangzhou1@hisilicon.com>
> Tested-by: Xiaojun Tan <tanxiaojun@huawei.com>
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
> I mark this as v2 for I have post a RFC version:
>
> https://lkml.org/lkml/2018/3/30/8
>
> v2:
> * Let the caller of ioremap_page_range() align the request by PAGE_SIZE - per Toshi
>
> Thanks
> Yisheng
>
> drivers/acpi/pci_root.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 6fc204a..b758ca3 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -746,7 +746,7 @@ static void acpi_pci_root_remap_iospace(struct resource_entry *entry)
> goto err;
>
> res->start = port;
> - res->end = port + length - 1;
> + res->end = PAGE_ALIGN(port + length) - 1;
> entry->offset = port - pci_addr;
>
> if (pci_remap_iospace(res, cpu_addr) < 0)
>
next prev parent reply other threads:[~2018-04-19 8:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-31 7:12 Yisheng Xie
2018-03-31 7:12 ` [PATCH v2 2/2] PCI: Check phys_addr for pci_remap_iospace Yisheng Xie
2018-04-19 8:03 ` Yisheng Xie [this message]
2018-05-01 9:28 ` [PATCH v2 1/2] PCI ACPI: Avoid panic when PCI IO resource's size is not page aligned Rafael J. Wysocki
2018-05-07 8:06 ` Yisheng Xie
2018-05-08 21:20 ` Rafael J. Wysocki
2018-05-09 3:46 ` Yisheng Xie
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=cabc6d02-af9b-9322-a48b-4e525ba8aef9@huawei.com \
--to=xieyisheng1@huawei.com \
--cc=bhelgaas@google.com \
--cc=guohanjun@huawei.com \
--cc=jcm@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=tanxiaojun@huawei.com \
--cc=toshi.kani@hpe.com \
--cc=wangzhou1@hisilicon.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®