* [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
@ 2015-12-21 14:12 ` Matt Fleming
0 siblings, 0 replies; 11+ messages in thread
From: Matt Fleming @ 2015-12-21 14:12 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin
Cc: linux-efi, linux-kernel, Matt Fleming, Josh Triplett,
Sai Praneeth Prakhya, Borislav Petkov, Môshe van der Sterre
Môshe reported the following warning triggered on his machine since
commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
data"),
[ 0.026936] ------------[ cut here ]------------
[ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
[ 0.026941] Modules linked in:
[ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
[ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
[ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
[ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
[ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
[ 0.026951] Call Trace:
[ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
[ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
[ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
[ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
[ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
[ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
[ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
[ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
[ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
[ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
[ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
[ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
[ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
early_memremap() has an upper limit on the size of mapping it can
handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
much larger than that.
There's actually no reason to restrict ourselves to using the early_*
version of memremap() - the ACPI BGRT driver is invoked late enough in
boot that we can use the standard version, with the benefit that the
late version allows mappings of arbitrary size.
Reported-by: Môshe van der Sterre <me@moshe.nl>
Tested-by: Môshe van der Sterre <me@moshe.nl>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index bf51f4c02562..b0970661870a 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -72,14 +72,14 @@ void __init efi_bgrt_init(void)
return;
}
- image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
+ image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
if (!image) {
pr_err("Ignoring BGRT: failed to map image header memory\n");
return;
}
memcpy(&bmp_header, image, sizeof(bmp_header));
- early_memunmap(image, sizeof(bmp_header));
+ memunmap(image);
bgrt_image_size = bmp_header.size;
bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
@@ -89,7 +89,7 @@ void __init efi_bgrt_init(void)
return;
}
- image = early_memremap(bgrt_tab->image_address, bmp_header.size);
+ image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
if (!image) {
pr_err("Ignoring BGRT: failed to map image memory\n");
kfree(bgrt_image);
@@ -98,5 +98,5 @@ void __init efi_bgrt_init(void)
}
memcpy(bgrt_image, image, bgrt_image_size);
- early_memunmap(image, bmp_header.size);
+ memunmap(image);
}
--
2.6.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
@ 2015-12-21 14:12 ` Matt Fleming
0 siblings, 0 replies; 11+ messages in thread
From: Matt Fleming @ 2015-12-21 14:12 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Matt Fleming, Josh Triplett,
Sai Praneeth Prakhya, Borislav Petkov, Môshe van der Sterre
Môshe reported the following warning triggered on his machine since
commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
data"),
[ 0.026936] ------------[ cut here ]------------
[ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
[ 0.026941] Modules linked in:
[ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
[ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
[ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
[ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
[ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
[ 0.026951] Call Trace:
[ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
[ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
[ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
[ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
[ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
[ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
[ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
[ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
[ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
[ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
[ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
[ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
[ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
early_memremap() has an upper limit on the size of mapping it can
handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
much larger than that.
There's actually no reason to restrict ourselves to using the early_*
version of memremap() - the ACPI BGRT driver is invoked late enough in
boot that we can use the standard version, with the benefit that the
late version allows mappings of arbitrary size.
Reported-by: Môshe van der Sterre <me-A/3C56C7qwM@public.gmane.org>
Tested-by: Môshe van der Sterre <me-A/3C56C7qwM@public.gmane.org>
Cc: Josh Triplett <josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org>
Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
Signed-off-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
---
arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index bf51f4c02562..b0970661870a 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -72,14 +72,14 @@ void __init efi_bgrt_init(void)
return;
}
- image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
+ image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
if (!image) {
pr_err("Ignoring BGRT: failed to map image header memory\n");
return;
}
memcpy(&bmp_header, image, sizeof(bmp_header));
- early_memunmap(image, sizeof(bmp_header));
+ memunmap(image);
bgrt_image_size = bmp_header.size;
bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
@@ -89,7 +89,7 @@ void __init efi_bgrt_init(void)
return;
}
- image = early_memremap(bgrt_tab->image_address, bmp_header.size);
+ image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
if (!image) {
pr_err("Ignoring BGRT: failed to map image memory\n");
kfree(bgrt_image);
@@ -98,5 +98,5 @@ void __init efi_bgrt_init(void)
}
memcpy(bgrt_image, image, bgrt_image_size);
- early_memunmap(image, bmp_header.size);
+ memunmap(image);
}
--
2.6.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
@ 2015-12-21 20:07 ` Josh Triplett
0 siblings, 0 replies; 11+ messages in thread
From: Josh Triplett @ 2015-12-21 20:07 UTC (permalink / raw)
To: Matt Fleming
Cc: Ingo Molnar, Thomas Gleixner, H . Peter Anvin, linux-efi,
linux-kernel, Sai Praneeth Prakhya, Borislav Petkov,
Môshe van der Sterre
On Mon, Dec 21, 2015 at 02:12:52PM +0000, Matt Fleming wrote:
> Môshe reported the following warning triggered on his machine since
> commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
> data"),
>
> [ 0.026936] ------------[ cut here ]------------
> [ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
> [ 0.026941] Modules linked in:
> [ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
> [ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
> [ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
> [ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
> [ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
> [ 0.026951] Call Trace:
> [ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
> [ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
> [ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
> [ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
> [ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
> [ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
> [ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
> [ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
> [ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
> [ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
> [ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
> [ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
> [ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
>
> early_memremap() has an upper limit on the size of mapping it can
> handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
> much larger than that.
>
> There's actually no reason to restrict ourselves to using the early_*
> version of memremap() - the ACPI BGRT driver is invoked late enough in
> boot that we can use the standard version, with the benefit that the
> late version allows mappings of arbitrary size.
>
> Reported-by: Môshe van der Sterre <me@moshe.nl>
> Tested-by: Môshe van der Sterre <me@moshe.nl>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
> Cc: Borislav Petkov <bp@suse.de>
> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
> arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> index bf51f4c02562..b0970661870a 100644
> --- a/arch/x86/platform/efi/efi-bgrt.c
> +++ b/arch/x86/platform/efi/efi-bgrt.c
> @@ -72,14 +72,14 @@ void __init efi_bgrt_init(void)
> return;
> }
>
> - image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
> + image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
> if (!image) {
> pr_err("Ignoring BGRT: failed to map image header memory\n");
> return;
> }
>
> memcpy(&bmp_header, image, sizeof(bmp_header));
> - early_memunmap(image, sizeof(bmp_header));
> + memunmap(image);
> bgrt_image_size = bmp_header.size;
>
> bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
> @@ -89,7 +89,7 @@ void __init efi_bgrt_init(void)
> return;
> }
>
> - image = early_memremap(bgrt_tab->image_address, bmp_header.size);
> + image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
> if (!image) {
> pr_err("Ignoring BGRT: failed to map image memory\n");
> kfree(bgrt_image);
> @@ -98,5 +98,5 @@ void __init efi_bgrt_init(void)
> }
>
> memcpy(bgrt_image, image, bgrt_image_size);
> - early_memunmap(image, bmp_header.size);
> + memunmap(image);
> }
> --
> 2.6.2
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
@ 2015-12-21 20:07 ` Josh Triplett
0 siblings, 0 replies; 11+ messages in thread
From: Josh Triplett @ 2015-12-21 20:07 UTC (permalink / raw)
To: Matt Fleming
Cc: Ingo Molnar, Thomas Gleixner, H . Peter Anvin,
linux-efi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Sai Praneeth Prakhya,
Borislav Petkov, Môshe van der Sterre
On Mon, Dec 21, 2015 at 02:12:52PM +0000, Matt Fleming wrote:
> Môshe reported the following warning triggered on his machine since
> commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
> data"),
>
> [ 0.026936] ------------[ cut here ]------------
> [ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
> [ 0.026941] Modules linked in:
> [ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
> [ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
> [ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
> [ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
> [ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
> [ 0.026951] Call Trace:
> [ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
> [ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
> [ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
> [ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
> [ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
> [ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
> [ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
> [ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
> [ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
> [ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
> [ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
> [ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
> [ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
>
> early_memremap() has an upper limit on the size of mapping it can
> handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
> much larger than that.
>
> There's actually no reason to restrict ourselves to using the early_*
> version of memremap() - the ACPI BGRT driver is invoked late enough in
> boot that we can use the standard version, with the benefit that the
> late version allows mappings of arbitrary size.
>
> Reported-by: Môshe van der Sterre <me-A/3C56C7qwM@public.gmane.org>
> Tested-by: Môshe van der Sterre <me-A/3C56C7qwM@public.gmane.org>
> Cc: Josh Triplett <josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org>
> Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
> Signed-off-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
Reviewed-by: Josh Triplett <josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org>
> arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> index bf51f4c02562..b0970661870a 100644
> --- a/arch/x86/platform/efi/efi-bgrt.c
> +++ b/arch/x86/platform/efi/efi-bgrt.c
> @@ -72,14 +72,14 @@ void __init efi_bgrt_init(void)
> return;
> }
>
> - image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
> + image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
> if (!image) {
> pr_err("Ignoring BGRT: failed to map image header memory\n");
> return;
> }
>
> memcpy(&bmp_header, image, sizeof(bmp_header));
> - early_memunmap(image, sizeof(bmp_header));
> + memunmap(image);
> bgrt_image_size = bmp_header.size;
>
> bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
> @@ -89,7 +89,7 @@ void __init efi_bgrt_init(void)
> return;
> }
>
> - image = early_memremap(bgrt_tab->image_address, bmp_header.size);
> + image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
> if (!image) {
> pr_err("Ignoring BGRT: failed to map image memory\n");
> kfree(bgrt_image);
> @@ -98,5 +98,5 @@ void __init efi_bgrt_init(void)
> }
>
> memcpy(bgrt_image, image, bgrt_image_size);
> - early_memunmap(image, bmp_header.size);
> + memunmap(image);
> }
> --
> 2.6.2
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
@ 2016-01-04 13:12 ` Matt Fleming
0 siblings, 0 replies; 11+ messages in thread
From: Matt Fleming @ 2016-01-04 13:12 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin
Cc: linux-efi, linux-kernel, Josh Triplett, Sai Praneeth Prakhya,
Borislav Petkov, Môshe van der Sterre
On Mon, 21 Dec, at 02:12:52PM, Matt Fleming wrote:
> Môshe reported the following warning triggered on his machine since
> commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
> data"),
>
> [ 0.026936] ------------[ cut here ]------------
> [ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
> [ 0.026941] Modules linked in:
> [ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
> [ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
> [ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
> [ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
> [ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
> [ 0.026951] Call Trace:
> [ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
> [ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
> [ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
> [ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
> [ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
> [ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
> [ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
> [ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
> [ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
> [ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
> [ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
> [ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
> [ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
>
> early_memremap() has an upper limit on the size of mapping it can
> handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
> much larger than that.
>
> There's actually no reason to restrict ourselves to using the early_*
> version of memremap() - the ACPI BGRT driver is invoked late enough in
> boot that we can use the standard version, with the benefit that the
> late version allows mappings of arbitrary size.
>
> Reported-by: Môshe van der Sterre <me@moshe.nl>
> Tested-by: Môshe van der Sterre <me@moshe.nl>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
> Cc: Borislav Petkov <bp@suse.de>
> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
> ---
> arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Ping? Could someone please pick this up for the 'x86/efi' branch? It
fixes a bug in 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when
mapping BGRT data").
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
@ 2016-01-04 13:12 ` Matt Fleming
0 siblings, 0 replies; 11+ messages in thread
From: Matt Fleming @ 2016-01-04 13:12 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Josh Triplett,
Sai Praneeth Prakhya, Borislav Petkov, Môshe van der Sterre
On Mon, 21 Dec, at 02:12:52PM, Matt Fleming wrote:
> Môshe reported the following warning triggered on his machine since
> commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
> data"),
>
> [ 0.026936] ------------[ cut here ]------------
> [ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
> [ 0.026941] Modules linked in:
> [ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
> [ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
> [ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
> [ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
> [ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
> [ 0.026951] Call Trace:
> [ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
> [ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
> [ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
> [ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
> [ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
> [ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
> [ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
> [ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
> [ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
> [ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
> [ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
> [ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
> [ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
>
> early_memremap() has an upper limit on the size of mapping it can
> handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
> much larger than that.
>
> There's actually no reason to restrict ourselves to using the early_*
> version of memremap() - the ACPI BGRT driver is invoked late enough in
> boot that we can use the standard version, with the benefit that the
> late version allows mappings of arbitrary size.
>
> Reported-by: Môshe van der Sterre <me-A/3C56C7qwM@public.gmane.org>
> Tested-by: Môshe van der Sterre <me-A/3C56C7qwM@public.gmane.org>
> Cc: Josh Triplett <josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org>
> Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
> Signed-off-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
> ---
> arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Ping? Could someone please pick this up for the 'x86/efi' branch? It
fixes a bug in 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when
mapping BGRT data").
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:x86/efi] x86/efi-bgrt: Replace early_memremap() with memremap()
2015-12-21 14:12 ` Matt Fleming
` (2 preceding siblings ...)
(?)
@ 2016-01-06 17:33 ` tip-bot for Matt Fleming
-1 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Matt Fleming @ 2016-01-06 17:33 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, me, bp, tglx, josh, mingo, sai.praneeth.prakhya, hpa, matt
Commit-ID: e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
Gitweb: http://git.kernel.org/tip/e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
Author: Matt Fleming <matt@codeblueprint.co.uk>
AuthorDate: Mon, 21 Dec 2015 14:12:52 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 6 Jan 2016 18:28:52 +0100
x86/efi-bgrt: Replace early_memremap() with memremap()
Môshe reported the following warning triggered on his machine since
commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
data"),
[ 0.026936] ------------[ cut here ]------------
[ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
[ 0.026941] Modules linked in:
[ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
[ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
[ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
[ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
[ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
[ 0.026951] Call Trace:
[ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
[ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
[ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
[ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
[ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
[ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
[ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
[ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
[ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
[ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
[ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
[ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
[ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
early_memremap() has an upper limit on the size of mapping it can
handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
much larger than that.
There's actually no reason to restrict ourselves to using the early_*
version of memremap() - the ACPI BGRT driver is invoked late enough in
boot that we can use the standard version, with the benefit that the
late version allows mappings of arbitrary size.
Reported-by: Môshe van der Sterre <me@moshe.nl>
Tested-by: Môshe van der Sterre <me@moshe.nl>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1450707172-12561-1-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index bf51f4c..b097066 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -72,14 +72,14 @@ void __init efi_bgrt_init(void)
return;
}
- image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
+ image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
if (!image) {
pr_err("Ignoring BGRT: failed to map image header memory\n");
return;
}
memcpy(&bmp_header, image, sizeof(bmp_header));
- early_memunmap(image, sizeof(bmp_header));
+ memunmap(image);
bgrt_image_size = bmp_header.size;
bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
@@ -89,7 +89,7 @@ void __init efi_bgrt_init(void)
return;
}
- image = early_memremap(bgrt_tab->image_address, bmp_header.size);
+ image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
if (!image) {
pr_err("Ignoring BGRT: failed to map image memory\n");
kfree(bgrt_image);
@@ -98,5 +98,5 @@ void __init efi_bgrt_init(void)
}
memcpy(bgrt_image, image, bgrt_image_size);
- early_memunmap(image, bmp_header.size);
+ memunmap(image);
}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
2017-12-01 16:25 ` Ghannam, Yazen
@ 2017-12-02 8:15 ` Greg KH
0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2017-12-02 8:15 UTC (permalink / raw)
To: Ghannam, Yazen; +Cc: stable
On Fri, Dec 01, 2017 at 04:25:44PM +0000, Ghannam, Yazen wrote:
> > -----Original Message-----
> > From: Greg KH [mailto:gregkh@linuxfoundation.org]
> > Sent: Friday, December 1, 2017 11:16 AM
> > To: Ghannam, Yazen <Yazen.Ghannam@amd.com>
> > Cc: stable@vger.kernel.org
> > Subject: Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with
> > memremap()
> >
> > On Fri, Dec 01, 2017 at 08:35:52AM +0000, Ghannam, Yazen wrote:
> > > Upstream commit ID: e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
> > > Prerequisite commit: "50a0cb565246 x86/efi-bgrt: Fix kernel panic when
> > mapping BGRT data"
> >
> > So apply both of these patches to 4.4? Please be specific as I'm
> > confused here.
> >
>
> Yes, both.
>
> The first commit is the fix, and the second commit is needed for the first to
> apply cleanly.
>
> So cherry-pick
> 1) 50a0cb565246f20d59cdb161778531e4b19d35ac
> 2) e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
>
> Sorry, I wasn't sure of the best way to describe this.
Both now applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
2017-12-01 16:15 ` Greg KH
@ 2017-12-01 16:25 ` Ghannam, Yazen
2017-12-02 8:15 ` Greg KH
0 siblings, 1 reply; 11+ messages in thread
From: Ghannam, Yazen @ 2017-12-01 16:25 UTC (permalink / raw)
To: Greg KH; +Cc: stable
> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Friday, December 1, 2017 11:16 AM
> To: Ghannam, Yazen <Yazen.Ghannam@amd.com>
> Cc: stable@vger.kernel.org
> Subject: Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with
> memremap()
>
> On Fri, Dec 01, 2017 at 08:35:52AM +0000, Ghannam, Yazen wrote:
> > Upstream commit ID: e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
> > Prerequisite commit: "50a0cb565246 x86/efi-bgrt: Fix kernel panic when
> mapping BGRT data"
>
> So apply both of these patches to 4.4? Please be specific as I'm
> confused here.
>
Yes, both.
The first commit is the fix, and the second commit is needed for the first to
apply cleanly.
So cherry-pick
1) 50a0cb565246f20d59cdb161778531e4b19d35ac
2) e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
Sorry, I wasn't sure of the best way to describe this.
Thanks,
Yazen
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
2017-12-01 8:35 [PATCH] " Ghannam, Yazen
@ 2017-12-01 16:15 ` Greg KH
2017-12-01 16:25 ` Ghannam, Yazen
0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2017-12-01 16:15 UTC (permalink / raw)
To: Ghannam, Yazen; +Cc: stable
On Fri, Dec 01, 2017 at 08:35:52AM +0000, Ghannam, Yazen wrote:
> Upstream commit ID: e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
> Prerequisite commit: "50a0cb565246 x86/efi-bgrt: Fix kernel panic when mapping BGRT data"
So apply both of these patches to 4.4? Please be specific as I'm
confused here.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
@ 2017-12-01 8:35 Ghannam, Yazen
2017-12-01 16:15 ` Greg KH
0 siblings, 1 reply; 11+ messages in thread
From: Ghannam, Yazen @ 2017-12-01 8:35 UTC (permalink / raw)
To: stable
Upstream commit ID: e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
Prerequisite commit: "50a0cb565246 x86/efi-bgrt: Fix kernel panic when mapping BGRT data"
Reason: Fixes the following call trace on AMD Fam17h systems.
[ +0.019604] ------------[ cut here ]------------
[ +0.000008] WARNING: CPU: 0 PID: 0 at /home/yghannam/linux-amd-yazen/mm/early_ioremap.c:122 __early_ioremap+0x9b/0x1bd()
[ +0.000006] Modules linked in:
[ +0.000006] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.103-HEAD #2
...
[ +0.000006] 0000000000000286 02cb38f113d2874f ffffffff81e03e50 ffffffff813e0767
[ +0.000007] 0000000000000000 ffffffff81c9e5f0 ffffffff81e03e88 ffffffff81080192
[ +0.000007] 0000000074d32018 0000000000000000 0000000000000001 0000000000000001
[ +0.000007] Call Trace:
[ +0.000007] [<ffffffff813e0767>] dump_stack+0x63/0x8c
[ +0.000006] [<ffffffff81080192>] warn_slowpath_common+0x82/0xc0
[ +0.000005] [<ffffffff810802da>] warn_slowpath_null+0x1a/0x20
[ +0.000004] [<ffffffff81fbb86e>] __early_ioremap+0x9b/0x1bd
[ +0.000006] [<ffffffff81fa5476>] ? __early_set_fixmap+0x84/0x95
[ +0.000005] [<ffffffff811adc75>] ? kmalloc_slab+0x5/0xa0
[ +0.000005] [<ffffffff81fbbb66>] early_ioremap+0x13/0x15
[ +0.000005] [<ffffffff81fa860b>] efi_bgrt_init+0x192/0x1ea
[ +0.000004] [<ffffffff81fa7b68>] efi_late_init+0x9/0xb
[ +0.000006] [<ffffffff81f88002>] start_kernel+0x46c/0x49c
[ +0.000005] [<ffffffff81f87120>] ? early_idt_handler_array+0x120/0x120
[ +0.000005] [<ffffffff81f8732d>] x86_64_start_reservations+0x2a/0x2c
[ +0.000004] [<ffffffff81f8746a>] x86_64_start_kernel+0x13b/0x15e
[ +0.000009] ---[ end trace f9b2fbcd6a135369 ]---
[ +0.000004] Ignoring BGRT: failed to map image memory
Stable version to apply to: 4.4.x
Thanks,
Yazen
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-12-02 8:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 14:12 [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap() Matt Fleming
2015-12-21 14:12 ` Matt Fleming
2015-12-21 20:07 ` Josh Triplett
2015-12-21 20:07 ` Josh Triplett
2016-01-04 13:12 ` Matt Fleming
2016-01-04 13:12 ` Matt Fleming
2016-01-06 17:33 ` [tip:x86/efi] " tip-bot for Matt Fleming
2017-12-01 8:35 [PATCH] " Ghannam, Yazen
2017-12-01 16:15 ` Greg KH
2017-12-01 16:25 ` Ghannam, Yazen
2017-12-02 8:15 ` Greg KH
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.