* [PATCH AUTOSEL 6.3 06/11] of: fdt: Scan /memreserve/ last
[not found] <20230511193757.623114-1-sashal@kernel.org>
@ 2023-05-11 19:37 ` Sasha Levin
2023-05-15 20:21 ` Conor Dooley
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2023-05-11 19:37 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Lucas Tanure, Rob Herring, Sasha Levin, robh+dt, frowand.list,
devicetree
From: Lucas Tanure <tanure@linux.com>
[ Upstream commit b413281876292de44ae84e9a9ce9d62e47f266e9 ]
Change the scanning /memreserve/ and /reserved-memory node order to fix
Kernel panic on Khadas Vim3 Board.
If /memreserve/ goes first, the memory is reserved, but nomap can't be
applied to the region. So the memory won't be used by Linux, but it is
still present in the linear map as normal memory, which allows
speculation. Legitimate access to adjacent pages will cause the CPU
to end up prefetching into them leading to Kernel panic.
So /reserved-memory node should go first, as it has a more updated
description of the memory regions and can apply flags, like nomap.
Link: https://lore.kernel.org/all/CAJX_Q+1Tjc+-TjZ6JW9X0NxEdFe=82a9626yL63j7uVD4LpxEA@mail.gmail.com/
Signed-off-by: Lucas Tanure <tanure@linux.com>
Link: https://lore.kernel.org/r/20230424113846.46382-1-tanure@linux.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/of/fdt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d1a68b6d03b3f..c28aedd7ae1f7 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -635,6 +635,9 @@ void __init early_init_fdt_scan_reserved_mem(void)
if (!initial_boot_params)
return;
+ fdt_scan_reserved_mem();
+ fdt_reserve_elfcorehdr();
+
/* Process header /memreserve/ fields */
for (n = 0; ; n++) {
fdt_get_mem_rsv(initial_boot_params, n, &base, &size);
@@ -643,8 +646,6 @@ void __init early_init_fdt_scan_reserved_mem(void)
memblock_reserve(base, size);
}
- fdt_scan_reserved_mem();
- fdt_reserve_elfcorehdr();
fdt_init_reserved_mem();
}
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 6.3 06/11] of: fdt: Scan /memreserve/ last
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 06/11] of: fdt: Scan /memreserve/ last Sasha Levin
@ 2023-05-15 20:21 ` Conor Dooley
2023-06-01 9:54 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Conor Dooley @ 2023-05-15 20:21 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Lucas Tanure, Rob Herring, robh+dt,
frowand.list, devicetree
[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]
Hey Sasha,
On Thu, May 11, 2023 at 03:37:49PM -0400, Sasha Levin wrote:
> From: Lucas Tanure <tanure@linux.com>
>
> [ Upstream commit b413281876292de44ae84e9a9ce9d62e47f266e9 ]
>
> Change the scanning /memreserve/ and /reserved-memory node order to fix
> Kernel panic on Khadas Vim3 Board.
>
> If /memreserve/ goes first, the memory is reserved, but nomap can't be
> applied to the region. So the memory won't be used by Linux, but it is
> still present in the linear map as normal memory, which allows
> speculation. Legitimate access to adjacent pages will cause the CPU
> to end up prefetching into them leading to Kernel panic.
>
> So /reserved-memory node should go first, as it has a more updated
> description of the memory regions and can apply flags, like nomap.
>
> Link: https://lore.kernel.org/all/CAJX_Q+1Tjc+-TjZ6JW9X0NxEdFe=82a9626yL63j7uVD4LpxEA@mail.gmail.com/
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> Link: https://lore.kernel.org/r/20230424113846.46382-1-tanure@linux.com
> Signed-off-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
Rob requested that this patch (and it's bretheren in other AUTOSEL
series) not be backported immediately:
| Going to let this sit in linux-next for a bit. I also didn't tag for
| stable kernels. I want it to get some exposure in mainline at least for
| a few -rc releases rather than getting backported right away. Please
| help ensure that happens if you see stable review emails. I'm going to
| be offline most of the next month.
https://lore.kernel.org/linux-devicetree/168262872454.3491083.6407810340850053636.robh@kernel.org/
Perhaps delaying it for another couple of weeks, since we have only just
had -rc2, is a good idead?
Cheers,
Conor.
> ---
> drivers/of/fdt.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d1a68b6d03b3f..c28aedd7ae1f7 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -635,6 +635,9 @@ void __init early_init_fdt_scan_reserved_mem(void)
> if (!initial_boot_params)
> return;
>
> + fdt_scan_reserved_mem();
> + fdt_reserve_elfcorehdr();
> +
> /* Process header /memreserve/ fields */
> for (n = 0; ; n++) {
> fdt_get_mem_rsv(initial_boot_params, n, &base, &size);
> @@ -643,8 +646,6 @@ void __init early_init_fdt_scan_reserved_mem(void)
> memblock_reserve(base, size);
> }
>
> - fdt_scan_reserved_mem();
> - fdt_reserve_elfcorehdr();
> fdt_init_reserved_mem();
> }
>
> --
> 2.39.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 6.3 06/11] of: fdt: Scan /memreserve/ last
2023-05-15 20:21 ` Conor Dooley
@ 2023-06-01 9:54 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2023-06-01 9:54 UTC (permalink / raw)
To: Conor Dooley
Cc: linux-kernel, stable, Lucas Tanure, Rob Herring, robh+dt,
frowand.list, devicetree
On Mon, May 15, 2023 at 09:21:04PM +0100, Conor Dooley wrote:
>Hey Sasha,
>
>On Thu, May 11, 2023 at 03:37:49PM -0400, Sasha Levin wrote:
>> From: Lucas Tanure <tanure@linux.com>
>>
>> [ Upstream commit b413281876292de44ae84e9a9ce9d62e47f266e9 ]
>>
>> Change the scanning /memreserve/ and /reserved-memory node order to fix
>> Kernel panic on Khadas Vim3 Board.
>>
>> If /memreserve/ goes first, the memory is reserved, but nomap can't be
>> applied to the region. So the memory won't be used by Linux, but it is
>> still present in the linear map as normal memory, which allows
>> speculation. Legitimate access to adjacent pages will cause the CPU
>> to end up prefetching into them leading to Kernel panic.
>>
>> So /reserved-memory node should go first, as it has a more updated
>> description of the memory regions and can apply flags, like nomap.
>>
>> Link: https://lore.kernel.org/all/CAJX_Q+1Tjc+-TjZ6JW9X0NxEdFe=82a9626yL63j7uVD4LpxEA@mail.gmail.com/
>> Signed-off-by: Lucas Tanure <tanure@linux.com>
>> Link: https://lore.kernel.org/r/20230424113846.46382-1-tanure@linux.com
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
>Rob requested that this patch (and it's bretheren in other AUTOSEL
>series) not be backported immediately:
>| Going to let this sit in linux-next for a bit. I also didn't tag for
>| stable kernels. I want it to get some exposure in mainline at least for
>| a few -rc releases rather than getting backported right away. Please
>| help ensure that happens if you see stable review emails. I'm going to
>| be offline most of the next month.
>https://lore.kernel.org/linux-devicetree/168262872454.3491083.6407810340850053636.robh@kernel.org/
>
>Perhaps delaying it for another couple of weeks, since we have only just
>had -rc2, is a good idead?
I'll drop it, let me know when you want it included back. Thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-01 9:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230511193757.623114-1-sashal@kernel.org>
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 06/11] of: fdt: Scan /memreserve/ last Sasha Levin
2023-05-15 20:21 ` Conor Dooley
2023-06-01 9:54 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).