Re: [PATCH 4.18 30/34] x86, hibernate: Fix nosave_regions setup for hibernation

2018-11-09 Thread Pavel Machek
On Thu 2018-11-08 13:52:59, Greg Kroah-Hartman wrote:
> 4.18-stable review patch.  If anyone has any objections, please let me know.
>

For the record, this and

[PATCH 4.14 27/31] x86, hibernate: Fix nosave_regions setup

makes sense to me.

Best regards,
Pavel



> --
> 
> From: Zhimin Gu 
> 
> commit cc55f7537db6af371e9c1c6a71161ee40f918824 upstream.
> 
> On 32bit systems, nosave_regions(non RAM areas) located between
> max_low_pfn and max_pfn are not excluded from hibernation snapshot
> currently, which may result in a machine check exception when
> trying to access these unsafe regions during hibernation:
> 
> [  612.800453] Disabling lock debugging due to kernel taint
> [  612.805786] mce: [Hardware Error]: CPU 0: Machine Check Exception: 5 Bank 
> 6: fe801136
> [  612.814344] mce: [Hardware Error]: RIP !INEXACT! 60: 
> {swsusp_save+0x436/0x560}
> [  612.823167] mce: [Hardware Error]: TSC 1f5939fe276 ADDR dd00 MISC 
> 30e086
> [  612.830677] mce: [Hardware Error]: PROCESSOR 0:306c3 TIME 1529487426 
> SOCKET 0 APIC 0 microcode 24
> [  612.839581] mce: [Hardware Error]: Run the above through 'mcelog --ascii'
> [  612.846394] mce: [Hardware Error]: Machine check: Processor context corrupt
> [  612.853380] Kernel panic - not syncing: Fatal machine check
> [  612.858978] Kernel Offset: 0x1800 from 0xc100 (relocation range: 
> 0xc000-0xf7ffdfff)
> 
> This is because on 32bit systems, pages above max_low_pfn are regarded
> as high memeory, and accessing unsafe pages might cause expected MCE.
> On the problematic 32bit system, there are reserved memory above low
> memory, which triggered the MCE:
> 
> e820 memory mapping:
> [0.00] BIOS-e820: [mem 0x-0x0009d7ff] usable
> [0.00] BIOS-e820: [mem 0x0009d800-0x0009] reserved
> [0.00] BIOS-e820: [mem 0x000e-0x000f] reserved
> [0.00] BIOS-e820: [mem 0x0010-0xd160cfff] usable
> [0.00] BIOS-e820: [mem 0xd160d000-0xd1613fff] ACPI NVS
> [0.00] BIOS-e820: [mem 0xd1614000-0xd1a44fff] usable
> [0.00] BIOS-e820: [mem 0xd1a45000-0xd1ec] reserved
> [0.00] BIOS-e820: [mem 0xd1ed-0xd7eeafff] usable
> [0.00] BIOS-e820: [mem 0xd7eeb000-0xd7ff] reserved
> [0.00] BIOS-e820: [mem 0xd800-0xd875] usable
> [0.00] BIOS-e820: [mem 0xd876-0xd87f] reserved
> [0.00] BIOS-e820: [mem 0xd880-0xd8fadfff] usable
> [0.00] BIOS-e820: [mem 0xd8fae000-0xd8ff] ACPI 
> data
> [0.00] BIOS-e820: [mem 0xd900-0xda71bfff] usable
> [0.00] BIOS-e820: [mem 0xda71c000-0xda7f] ACPI NVS
> [0.00] BIOS-e820: [mem 0xda80-0xdbb8bfff] usable
> [0.00] BIOS-e820: [mem 0xdbb8c000-0xdbff] reserved
> [0.00] BIOS-e820: [mem 0xdd00-0xdf1f] reserved
> [0.00] BIOS-e820: [mem 0xf800-0xfbff] reserved
> [0.00] BIOS-e820: [mem 0xfec0-0xfec00fff] reserved
> [0.00] BIOS-e820: [mem 0xfed0-0xfed03fff] reserved
> [0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
> [0.00] BIOS-e820: [mem 0xfee0-0xfee00fff] reserved
> [0.00] BIOS-e820: [mem 0xff00-0x] reserved
> [0.00] BIOS-e820: [mem 0x0001-0x00041edf] usable
> 
> Fix this problem by changing pfn limit from max_low_pfn to max_pfn.
> This fix does not impact 64bit system because on 64bit max_low_pfn
> is the same as max_pfn.
> 
> Signed-off-by: Zhimin Gu 
> Acked-by: Pavel Machek 
> Signed-off-by: Chen Yu 
> Acked-by: Thomas Gleixner 
> Cc: All applicable 
> Signed-off-by: Rafael J. Wysocki 
> Signed-off-by: Greg Kroah-Hartman 
> 
> ---
>  arch/x86/kernel/setup.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1258,7 +1258,7 @@ void __init setup_arch(char **cmdline_p)
>   x86_init.hyper.guest_late_init();
>  
>   e820__reserve_resources();
> - e820__register_nosave_regions(max_low_pfn);
> + e820__register_nosave_regions(max_pfn);
>  
>   x86_init.resources.reserve_resources();
>  
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH 4.18 30/34] x86, hibernate: Fix nosave_regions setup for hibernation

2018-11-09 Thread Pavel Machek
On Thu 2018-11-08 13:52:59, Greg Kroah-Hartman wrote:
> 4.18-stable review patch.  If anyone has any objections, please let me know.
>

For the record, this and

[PATCH 4.14 27/31] x86, hibernate: Fix nosave_regions setup

makes sense to me.

Best regards,
Pavel



> --
> 
> From: Zhimin Gu 
> 
> commit cc55f7537db6af371e9c1c6a71161ee40f918824 upstream.
> 
> On 32bit systems, nosave_regions(non RAM areas) located between
> max_low_pfn and max_pfn are not excluded from hibernation snapshot
> currently, which may result in a machine check exception when
> trying to access these unsafe regions during hibernation:
> 
> [  612.800453] Disabling lock debugging due to kernel taint
> [  612.805786] mce: [Hardware Error]: CPU 0: Machine Check Exception: 5 Bank 
> 6: fe801136
> [  612.814344] mce: [Hardware Error]: RIP !INEXACT! 60: 
> {swsusp_save+0x436/0x560}
> [  612.823167] mce: [Hardware Error]: TSC 1f5939fe276 ADDR dd00 MISC 
> 30e086
> [  612.830677] mce: [Hardware Error]: PROCESSOR 0:306c3 TIME 1529487426 
> SOCKET 0 APIC 0 microcode 24
> [  612.839581] mce: [Hardware Error]: Run the above through 'mcelog --ascii'
> [  612.846394] mce: [Hardware Error]: Machine check: Processor context corrupt
> [  612.853380] Kernel panic - not syncing: Fatal machine check
> [  612.858978] Kernel Offset: 0x1800 from 0xc100 (relocation range: 
> 0xc000-0xf7ffdfff)
> 
> This is because on 32bit systems, pages above max_low_pfn are regarded
> as high memeory, and accessing unsafe pages might cause expected MCE.
> On the problematic 32bit system, there are reserved memory above low
> memory, which triggered the MCE:
> 
> e820 memory mapping:
> [0.00] BIOS-e820: [mem 0x-0x0009d7ff] usable
> [0.00] BIOS-e820: [mem 0x0009d800-0x0009] reserved
> [0.00] BIOS-e820: [mem 0x000e-0x000f] reserved
> [0.00] BIOS-e820: [mem 0x0010-0xd160cfff] usable
> [0.00] BIOS-e820: [mem 0xd160d000-0xd1613fff] ACPI NVS
> [0.00] BIOS-e820: [mem 0xd1614000-0xd1a44fff] usable
> [0.00] BIOS-e820: [mem 0xd1a45000-0xd1ec] reserved
> [0.00] BIOS-e820: [mem 0xd1ed-0xd7eeafff] usable
> [0.00] BIOS-e820: [mem 0xd7eeb000-0xd7ff] reserved
> [0.00] BIOS-e820: [mem 0xd800-0xd875] usable
> [0.00] BIOS-e820: [mem 0xd876-0xd87f] reserved
> [0.00] BIOS-e820: [mem 0xd880-0xd8fadfff] usable
> [0.00] BIOS-e820: [mem 0xd8fae000-0xd8ff] ACPI 
> data
> [0.00] BIOS-e820: [mem 0xd900-0xda71bfff] usable
> [0.00] BIOS-e820: [mem 0xda71c000-0xda7f] ACPI NVS
> [0.00] BIOS-e820: [mem 0xda80-0xdbb8bfff] usable
> [0.00] BIOS-e820: [mem 0xdbb8c000-0xdbff] reserved
> [0.00] BIOS-e820: [mem 0xdd00-0xdf1f] reserved
> [0.00] BIOS-e820: [mem 0xf800-0xfbff] reserved
> [0.00] BIOS-e820: [mem 0xfec0-0xfec00fff] reserved
> [0.00] BIOS-e820: [mem 0xfed0-0xfed03fff] reserved
> [0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
> [0.00] BIOS-e820: [mem 0xfee0-0xfee00fff] reserved
> [0.00] BIOS-e820: [mem 0xff00-0x] reserved
> [0.00] BIOS-e820: [mem 0x0001-0x00041edf] usable
> 
> Fix this problem by changing pfn limit from max_low_pfn to max_pfn.
> This fix does not impact 64bit system because on 64bit max_low_pfn
> is the same as max_pfn.
> 
> Signed-off-by: Zhimin Gu 
> Acked-by: Pavel Machek 
> Signed-off-by: Chen Yu 
> Acked-by: Thomas Gleixner 
> Cc: All applicable 
> Signed-off-by: Rafael J. Wysocki 
> Signed-off-by: Greg Kroah-Hartman 
> 
> ---
>  arch/x86/kernel/setup.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1258,7 +1258,7 @@ void __init setup_arch(char **cmdline_p)
>   x86_init.hyper.guest_late_init();
>  
>   e820__reserve_resources();
> - e820__register_nosave_regions(max_low_pfn);
> + e820__register_nosave_regions(max_pfn);
>  
>   x86_init.resources.reserve_resources();
>  
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


[PATCH 4.18 30/34] x86, hibernate: Fix nosave_regions setup for hibernation

2018-11-08 Thread Greg Kroah-Hartman
4.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Zhimin Gu 

commit cc55f7537db6af371e9c1c6a71161ee40f918824 upstream.

On 32bit systems, nosave_regions(non RAM areas) located between
max_low_pfn and max_pfn are not excluded from hibernation snapshot
currently, which may result in a machine check exception when
trying to access these unsafe regions during hibernation:

[  612.800453] Disabling lock debugging due to kernel taint
[  612.805786] mce: [Hardware Error]: CPU 0: Machine Check Exception: 5 Bank 6: 
fe801136
[  612.814344] mce: [Hardware Error]: RIP !INEXACT! 60: 
{swsusp_save+0x436/0x560}
[  612.823167] mce: [Hardware Error]: TSC 1f5939fe276 ADDR dd00 MISC 
30e086
[  612.830677] mce: [Hardware Error]: PROCESSOR 0:306c3 TIME 1529487426 SOCKET 
0 APIC 0 microcode 24
[  612.839581] mce: [Hardware Error]: Run the above through 'mcelog --ascii'
[  612.846394] mce: [Hardware Error]: Machine check: Processor context corrupt
[  612.853380] Kernel panic - not syncing: Fatal machine check
[  612.858978] Kernel Offset: 0x1800 from 0xc100 (relocation range: 
0xc000-0xf7ffdfff)

This is because on 32bit systems, pages above max_low_pfn are regarded
as high memeory, and accessing unsafe pages might cause expected MCE.
On the problematic 32bit system, there are reserved memory above low
memory, which triggered the MCE:

e820 memory mapping:
[0.00] BIOS-e820: [mem 0x-0x0009d7ff] usable
[0.00] BIOS-e820: [mem 0x0009d800-0x0009] reserved
[0.00] BIOS-e820: [mem 0x000e-0x000f] reserved
[0.00] BIOS-e820: [mem 0x0010-0xd160cfff] usable
[0.00] BIOS-e820: [mem 0xd160d000-0xd1613fff] ACPI NVS
[0.00] BIOS-e820: [mem 0xd1614000-0xd1a44fff] usable
[0.00] BIOS-e820: [mem 0xd1a45000-0xd1ec] reserved
[0.00] BIOS-e820: [mem 0xd1ed-0xd7eeafff] usable
[0.00] BIOS-e820: [mem 0xd7eeb000-0xd7ff] reserved
[0.00] BIOS-e820: [mem 0xd800-0xd875] usable
[0.00] BIOS-e820: [mem 0xd876-0xd87f] reserved
[0.00] BIOS-e820: [mem 0xd880-0xd8fadfff] usable
[0.00] BIOS-e820: [mem 0xd8fae000-0xd8ff] ACPI data
[0.00] BIOS-e820: [mem 0xd900-0xda71bfff] usable
[0.00] BIOS-e820: [mem 0xda71c000-0xda7f] ACPI NVS
[0.00] BIOS-e820: [mem 0xda80-0xdbb8bfff] usable
[0.00] BIOS-e820: [mem 0xdbb8c000-0xdbff] reserved
[0.00] BIOS-e820: [mem 0xdd00-0xdf1f] reserved
[0.00] BIOS-e820: [mem 0xf800-0xfbff] reserved
[0.00] BIOS-e820: [mem 0xfec0-0xfec00fff] reserved
[0.00] BIOS-e820: [mem 0xfed0-0xfed03fff] reserved
[0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
[0.00] BIOS-e820: [mem 0xfee0-0xfee00fff] reserved
[0.00] BIOS-e820: [mem 0xff00-0x] reserved
[0.00] BIOS-e820: [mem 0x0001-0x00041edf] usable

Fix this problem by changing pfn limit from max_low_pfn to max_pfn.
This fix does not impact 64bit system because on 64bit max_low_pfn
is the same as max_pfn.

Signed-off-by: Zhimin Gu 
Acked-by: Pavel Machek 
Signed-off-by: Chen Yu 
Acked-by: Thomas Gleixner 
Cc: All applicable 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/setup.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1258,7 +1258,7 @@ void __init setup_arch(char **cmdline_p)
x86_init.hyper.guest_late_init();
 
e820__reserve_resources();
-   e820__register_nosave_regions(max_low_pfn);
+   e820__register_nosave_regions(max_pfn);
 
x86_init.resources.reserve_resources();
 




[PATCH 4.18 30/34] x86, hibernate: Fix nosave_regions setup for hibernation

2018-11-08 Thread Greg Kroah-Hartman
4.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Zhimin Gu 

commit cc55f7537db6af371e9c1c6a71161ee40f918824 upstream.

On 32bit systems, nosave_regions(non RAM areas) located between
max_low_pfn and max_pfn are not excluded from hibernation snapshot
currently, which may result in a machine check exception when
trying to access these unsafe regions during hibernation:

[  612.800453] Disabling lock debugging due to kernel taint
[  612.805786] mce: [Hardware Error]: CPU 0: Machine Check Exception: 5 Bank 6: 
fe801136
[  612.814344] mce: [Hardware Error]: RIP !INEXACT! 60: 
{swsusp_save+0x436/0x560}
[  612.823167] mce: [Hardware Error]: TSC 1f5939fe276 ADDR dd00 MISC 
30e086
[  612.830677] mce: [Hardware Error]: PROCESSOR 0:306c3 TIME 1529487426 SOCKET 
0 APIC 0 microcode 24
[  612.839581] mce: [Hardware Error]: Run the above through 'mcelog --ascii'
[  612.846394] mce: [Hardware Error]: Machine check: Processor context corrupt
[  612.853380] Kernel panic - not syncing: Fatal machine check
[  612.858978] Kernel Offset: 0x1800 from 0xc100 (relocation range: 
0xc000-0xf7ffdfff)

This is because on 32bit systems, pages above max_low_pfn are regarded
as high memeory, and accessing unsafe pages might cause expected MCE.
On the problematic 32bit system, there are reserved memory above low
memory, which triggered the MCE:

e820 memory mapping:
[0.00] BIOS-e820: [mem 0x-0x0009d7ff] usable
[0.00] BIOS-e820: [mem 0x0009d800-0x0009] reserved
[0.00] BIOS-e820: [mem 0x000e-0x000f] reserved
[0.00] BIOS-e820: [mem 0x0010-0xd160cfff] usable
[0.00] BIOS-e820: [mem 0xd160d000-0xd1613fff] ACPI NVS
[0.00] BIOS-e820: [mem 0xd1614000-0xd1a44fff] usable
[0.00] BIOS-e820: [mem 0xd1a45000-0xd1ec] reserved
[0.00] BIOS-e820: [mem 0xd1ed-0xd7eeafff] usable
[0.00] BIOS-e820: [mem 0xd7eeb000-0xd7ff] reserved
[0.00] BIOS-e820: [mem 0xd800-0xd875] usable
[0.00] BIOS-e820: [mem 0xd876-0xd87f] reserved
[0.00] BIOS-e820: [mem 0xd880-0xd8fadfff] usable
[0.00] BIOS-e820: [mem 0xd8fae000-0xd8ff] ACPI data
[0.00] BIOS-e820: [mem 0xd900-0xda71bfff] usable
[0.00] BIOS-e820: [mem 0xda71c000-0xda7f] ACPI NVS
[0.00] BIOS-e820: [mem 0xda80-0xdbb8bfff] usable
[0.00] BIOS-e820: [mem 0xdbb8c000-0xdbff] reserved
[0.00] BIOS-e820: [mem 0xdd00-0xdf1f] reserved
[0.00] BIOS-e820: [mem 0xf800-0xfbff] reserved
[0.00] BIOS-e820: [mem 0xfec0-0xfec00fff] reserved
[0.00] BIOS-e820: [mem 0xfed0-0xfed03fff] reserved
[0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
[0.00] BIOS-e820: [mem 0xfee0-0xfee00fff] reserved
[0.00] BIOS-e820: [mem 0xff00-0x] reserved
[0.00] BIOS-e820: [mem 0x0001-0x00041edf] usable

Fix this problem by changing pfn limit from max_low_pfn to max_pfn.
This fix does not impact 64bit system because on 64bit max_low_pfn
is the same as max_pfn.

Signed-off-by: Zhimin Gu 
Acked-by: Pavel Machek 
Signed-off-by: Chen Yu 
Acked-by: Thomas Gleixner 
Cc: All applicable 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/setup.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1258,7 +1258,7 @@ void __init setup_arch(char **cmdline_p)
x86_init.hyper.guest_late_init();
 
e820__reserve_resources();
-   e820__register_nosave_regions(max_low_pfn);
+   e820__register_nosave_regions(max_pfn);
 
x86_init.resources.reserve_resources();