Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set 100G memory but only 66G in centos 6.8/6.9 #321

Closed
wendal opened this issue Apr 27, 2017 · 22 comments
Closed

set 100G memory but only 66G in centos 6.8/6.9 #321

wendal opened this issue Apr 27, 2017 · 22 comments
Assignees

Comments

@wendal
Copy link

wendal commented Apr 27, 2017

centos 6.9
win10 x64

I assign 100G memory to guest vm, but inside centos, it show only 66G

any idea for that??

@dcui
Copy link
Contributor

dcui commented Apr 27, 2017

Did you check "Enable Dynamic Memory" in the Hyper-V "Setting -> Memory" for the VM?

What's the output of "free -m" and "cat /proc/meminfo" in the VM?

@wendal
Copy link
Author

wendal commented Apr 27, 2017

sorry, I download the wrong ubuntu iso, i386 version.

@dcui
Copy link
Contributor

dcui commented Apr 27, 2017

Ah.. yes, 64GB -- that's the max addressable physical address for 32-PAE

@wendal
Copy link
Author

wendal commented Apr 27, 2017

I try ubuntu 14.04.05 x64, it show 98G, without lis-next.

so it look like a bug at centos 6.9 kernel?? 2.6.32-696

@wendal
Copy link
Author

wendal commented Apr 27, 2017

after I install lis-next from source code, centos 6.9 fail to start after boot menu...

@wendal
Copy link
Author

wendal commented Apr 27, 2017

centos 6.8 x64 livecd show this, 66G memory:

2

any idea for that ?? thank you a lot

@wendal
Copy link
Author

wendal commented Apr 27, 2017

centos 7.3 1611, show 98G

3

@dcui
Copy link
Contributor

dcui commented Apr 27, 2017

I reproduced the issue with CentOS 6.8/6.9. Note the line "WARNING: BIOS bug: CPU MTRRs don't cover all of memory, losing 33408MB of RAM.":

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000f7ff0000 (usable)
BIOS-e820: 00000000f7ff0000 - 00000000f7fff000 (ACPI data)
BIOS-e820: 00000000f7fff000 - 00000000f8000000 (ACPI NVS)
BIOS-e820: 0000000100000000 - 0000000fe0000000 (usable)
BIOS-e820: 0000001000000000 - 0000001928000000 (usable)
SMBIOS version 2.3 @ 0xF57D0
SMBIOS 2.3 present.
DMI: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006 04/28/2016
AMI BIOS detected: BIOS may corrupt low RAM, working around it.
e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
Hypervisor detected: Microsoft HyperV
HyperV: features 0x2e7f, hints 0xc2c
HyperV: LAPIC Timer Frequency: 0x30d40
e820 update range: 0000000000000000 - 0000000000001000 (usable) ==> (reserved)
e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
last_pfn = 0x1928000 max_arch_pfn = 0x400000000
x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
e820 update range: 0000001100000000 - 0000001928000000 (usable) ==> (reserved)
WARNING: BIOS bug: CPU MTRRs don't cover all of memory, losing 33408MB of RAM.
------------[ cut here ]------------
WARNING: at arch/x86/kernel/cpu/mtrr/cleanup.c:972 mtrr_trim_uncached_memory+0x2de/0x309() (Not tainted)
Hardware name: Virtual Machine
Modules linked in:
Pid: 0, comm: swapper Not tainted 2.6.32-696.el6.x86_64 #1
Call Trace:
[] ? warn_slowpath_common+0x91/0xe0
[] ? warn_slowpath_null+0x1a/0x20
[] ? mtrr_trim_uncached_memory+0x2de/0x309
[] ? setup_arch+0x4e7/0xca6
[] ? vprintk_default+0xe/0x10
[] ? printk+0x4f/0x58
[] ? start_kernel+0xdc/0x436
[] ? x86_64_start_reservations+0x125/0x129
[] ? x86_64_start_kernel+0x115/0x124
---[ end trace a7919e7f17c0a725 ]---
update e820 for mtrr
modified physical RAM map:
modified: 0000000000000000 - 0000000000010000 (reserved)
modified: 0000000000010000 - 000000000009fc00 (usable)
modified: 000000000009fc00 - 00000000000a0000 (reserved)
modified: 00000000000e0000 - 0000000000100000 (reserved)
modified: 0000000000100000 - 00000000f7ff0000 (usable)
modified: 00000000f7ff0000 - 00000000f7fff000 (ACPI data)
modified: 00000000f7fff000 - 00000000f8000000 (ACPI NVS)
modified: 0000000100000000 - 0000000fe0000000 (usable)
modified: 0000001000000000 - 0000001100000000 (usable)
modified: 0000001100000000 - 0000001928000000 (reserved)
last_pfn = 0x1100000 max_arch_pfn = 0x400000000
last_pfn = 0xf7ff0 max_arch_pfn = 0x400000000

@dcui
Copy link
Contributor

dcui commented Apr 27, 2017

So the question is: why are CentOS 7.3 and Ubuntu 14.04.5 able to show ~100GB rather than 60+ GB...

@wendal
Copy link
Author

wendal commented Apr 27, 2017

after upgrade kernel by http://elrepo.reloumirrors.net/kernel/el6/x86_64/RPMS/kernel-ml-4.10.12-1.el6.elrepo.x86_64.rpm

it works, 98G show in free -m

@wendal
Copy link
Author

wendal commented Apr 27, 2017

after startup, centos 6.9 with kernel 4.10.12

4

@wendal
Copy link
Author

wendal commented Apr 27, 2017

is there any way to copy text from hyper-v guest?

dmesg show this at centos with kernel 4.10.12 :

5

@dcui
Copy link
Contributor

dcui commented Apr 27, 2017

It looks the built-in kernels of CentOS 6.8/6.9 are not so resilient to the BIOS defect. Good to know you have a workaround by installing the 4.x kernel.

No easy way to copy text from the VM terminal to the host. You can try SSH or VNC. :-)

@wendal
Copy link
Author

wendal commented Apr 27, 2017

ok, thank you a lot ^_^

@wendal
Copy link
Author

wendal commented Apr 27, 2017

BTW, is it possible a bug in hyper-v, not centos 6.8/6.9?

at the same win10 x64, centos 6.9 VM in virtualbox 5.1.20 can access full memory size, but it is very slow after ~60G, about 20mb/s, but still working.

@wendal wendal changed the title set 100G memory but only 66G in centos set 100G memory but only 66G in centos 6.8/6.9 Apr 27, 2017
@dcui
Copy link
Contributor

dcui commented Apr 27, 2017

Yeah, I think there is a bug in Hyper-V's guest BIOS: "WARNING: BIOS bug: CPU MTRRs don't cover all of memory, losing 33408MB of RAM."

I just don't know how the 4.x kernel can cope with this.

@dcui
Copy link
Contributor

dcui commented Jun 30, 2017

Old RHEL 6.x kernel has a bug, which can be exposed when the VM is running on WS 2016, where the reported max supported physical address has 44 bits. On WS 2012 R2, the max physical address has only 42 bits, and the bug is not triggered.

The old kernel needs to pick the patch:
x86: Fix /proc/mtrr with base/size more than 44bits (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d5c78673b1b28467354c2c30c3d4f003666ff385)

or, we can use the "disable_mtrr_trim" kernel parameter to work around the issue (there is not perf issue with this, because Hyper-V always ignores the MTRR setting for conventional RAM of a VM).

@wendal
Copy link
Author

wendal commented Jun 30, 2017

Great!

@alexng-canuck
Copy link
Contributor

alexng-canuck commented Jul 25, 2017

@wendal @dcui Is there any action item here with respect to LIS? Can we close this issue?

@kattisrinivasan
Copy link

kattisrinivasan commented Jul 25, 2017 via email

@alexng-canuck
Copy link
Contributor

Fair enough. We can look into adding the "disable_mtrr_trim" only for RH6.X installations.

@vyadavmsft; can you look into adding this for the RHEL 6.X RPMs? I will see what we can do in the rhel6.x install script for folks playing with the git sources.

alexng-canuck pushed a commit to alexng-canuck/lis-next that referenced this issue Jul 27, 2017
This works around issue LIS#321. Summarized here:

Old RHEL 6.x kernel has a bug, which can be exposed when the VM is
running on WS 2016, where the reported max supported physical address
has 44 bits. On WS 2012 R2, the max physical address has only 42 bits,
and the bug is not triggered.

The old kernel needs to pick the patch:
x86: Fix /proc/mtrr with base/size more than 44bits
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d5c78673b1b28467354c2c30c3d4f003666ff385

or, we can use the "disable_mtrr_trim" kernel parameter to work around the issue.
There is not perf issue with this, because Hyper-V always ignores
the MTRR setting for conventional RAM of a VM).
alexng-canuck pushed a commit that referenced this issue Jul 31, 2017
Fix some requested issues #387 and #321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants