linux-armv7-xe303c12-only icon indicating copy to clipboard operation
linux-armv7-xe303c12-only copied to clipboard

My Linux kernel config file does not recognizes all memory available to the system,but only half.

Open Marietto2008 opened this issue 1 year ago • 5 comments

Hello.

The project that I've been working on since 2 years is to enable KVM (with the support of libvirt and virt-manager) on a recent version of Linux and of its kernel on the old but still nice ARM Chromebook model xe303c12. My goal is to virtualize FreeBSD 13.2 for armV7. I've almost completed the project. At today I'm using Ubuntu 22.04 (but it works also with Devuan 5) ; KVM is enabled ; libvirt 9.7.0 and virt-manager are working great. And I've almost been able to virtualize FreeBSD. Almost because I've found a problem that I need to fix or the whole project will die. Ubuntu recognizes only 1 GB of memory free,but the ARM Chromebook has 2 GB of memory soldered to the mobo. So,1 GB of memory has been lost during the transition from the first project I tried to enable KVM with an old kernel (and ubuntu) version,that you can find here :

http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/#setting-up-the-boot-medium

and my project,that uses a more recent kernel version (5.4) and ubuntu version (22.04). I think that when I have recompiled the kernel,I've lost some kernel entries that are enabled on the 3.13 kernel used by the developers at the Virtual Open System. Well,I have no idea about which entries my kernel config are missing.

I have checked the available memory for the OS giving the command :

# free -m

If I don't recover 1 GB of memory,I can't virtualize FreeBSD,because only 1 GB is a very small amount of memory to be able to run the host and the guest OS.

So,can you help me to find which kernel entries I should add to have all the 2 GB of memory available ?

Virtual Open System offers it's own kernel config file,that I have saved here :

https://pastebin.ubuntu.com/p/j4B54TChKD/

using their kernel config file I see that I have a total of 2 GB of memory available (I spend 400 mb to load Linux,so only 600 remains ; it's not good. In Fact I get a lot of qemu crashes), but If I use my config file the OS starts with only 1 GB.

Marietto2008 avatar Sep 23 '23 19:09 Marietto2008

I don't know the reason why half of your memory is unavailable. In accordance with the link to dmesg from a similar question on stackoverflow where it is said that it is impossible to use memory up to the load address, perhaps your kernel is not relocable (or it should not be relocable, I don’t know). Try a different kernel boot address, a smaller one, like 0x5xxxxxx or so on. All my attempts to load the myself builded kernel with that loader at the memory address 0x4xxxxxxx ended unsuccessfully, and I did not check 0x8xxxxxxx adress. In the near future I will not have the opportunity to check, since the device is not with me now. As i remember my regular kernel, loaded without an intermediate nv-u-boot loader, sees all 2GB of memory without problems.

quarkscript2 avatar Sep 27 '23 08:09 quarkscript2

Can you give me the link to the stackoverflow question that you have mentioned ?

I want to share two kernel config files :

  1. the kernel 3.13 dmesg log file where 2 GB is recognized,here :

https://pastebin.ubuntu.com/p/gsw9SM4zY3/

  1. the kernel 5.4 dmesg log file where only 1 GB is recognized,here :

https://pastebin.ubuntu.com/p/W6Mgj4jGg2/

I've compared the dmesg logs (kernel 3.13 vs kernel 5.4 config files) and I think this is the reason why I have only 1 GB of memory available :

OF: fdt: Ignoring memory range 0x40000000 - 0x80000000

This line is not present on the kernel 3.13 dmesg log file,but it is on the kernel 5.4 dmesg log file. The dtb file generation seems involved. What do you think I can try to do ?

Marietto2008 avatar Sep 27 '23 08:09 Marietto2008

Well, i am sure it is your question https://unix.stackexchange.com/questions/757313/my-ubuntu-kernel-config-file-does-not-recognizes-all-memory-available-to-the-sys (yeah not overflow but exchange)

You may use other address while building uImage or you may build relocatable kernel, but it may be conflicting with all that kvm implementation (it is just my assumption) As i remember kernel load address some where was proposed like 0x42004000 , but i never got succesful boot with it. According to your dmesg first byte of RAM should has address 0x4000000, so when you set 0x80008000 as entry point you set kernel entry point to 1'073'774'592 byte.

quarkscript2 avatar Sep 27 '23 10:09 quarkscript2

yes,it's interesting. Who knows why,with the kernel 3.13,declaring 0x80008000,instead,it gives 2 GB.

Marietto2008 avatar Sep 27 '23 10:09 Marietto2008

your solution worked like a charm :

root@devuan-bunsen:~# free -m

               total        used        free      shared  buff/cache   available
Mem:            2009         220        1602           0         247        1789
Swap:              0           0           0

Marietto2008 avatar Sep 27 '23 11:09 Marietto2008