plugwash
Forum Moderator
Forum Moderator
Posts: 3599
Joined: Wed Dec 28, 2011 11:45 pm

memory split: there has to be a better way.

Mon Oct 15, 2012 7:18 pm

Currently the split of memory between arm and GPU is handled by switching start.elf files and the start.elf file selected determines how much memory the arm gets. However this is suboptimal to say the least since it means the memory split can only be varied in pretty coarse steps and more importantly with the release of the 512MB Pi an image can't be setup to do the sane thing on both models of Pi.

Surely there must be a better way than this. One idea that immediately springs to mind would be to split the address space into THREE areas. First a linux boot area from 0 to 128M. Then a GPU area from 128M to a user configured reach and finally a second area for the arm taking the remainder of the memory. This would be a little more complex than the current setup but afaict linux is already designed to handle non-contiguous physical memory so it shouldn't be a massive problem.

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: memory split: there has to be a better way.

Mon Oct 15, 2012 7:38 pm

Dom has this on his to do list.

What he was saying is the problem lies inside the start.elf itself something outside it would make the choice basically if you put a 512 split into a 256 it would revert to a different split and you would have to reconfigure. I personally haven't seen a big enough boost to over clock with an accelerated X like Liz was saying maybe it's not even needed won't know without testing.

But that's just an opinion. It really all depends on the final outcome all there is to do is try everything and settle on a good balance then leave what's left over for the hacking community to develop. Later if someone needs different they will have the options available for them.

So I guess there are 2 ideas between the 2 of you.

.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

Narishma
Posts: 151
Joined: Wed Nov 23, 2011 1:29 pm

Re: memory split: there has to be a better way.

Mon Oct 15, 2012 7:45 pm

A few months back, someone from the foundation (dom maybe?) mentioned that they were working on a way to dynamically change the memory split between the CPU and GPU without needing a reboot.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: memory split: there has to be a better way.

Mon Oct 15, 2012 8:20 pm

There are two schemes being worked on.

One is a start.elf and a relocation file. The loader can then modify the start.elf to a specific (fixed) memory split. You would specify the split value in config.txt.
(A different start.elf would be needed for the smaller firmware used by 240M/496M splits).

The big change is to use CMA. This needs a newer kernel (at least 3.4, but I'm targetting 3.6), newer firmware with VCHIQ 5 (which is currently unstable).
I have actually got it booting and running some code. There's a couple of issues.
When memory is required by GPU, it has to request it from linux, which then shuffles data around and releases/swaps out pages. When GPU has spare memory it gives it back to linux.
This takes a little time (e.g. a second). Not a big problem, but you don't want it happening in the middle of playing a video. And you certainly don't want it happening every second...
You can fix the GPU/linux split of CMA so it can be run like the old scheme, but it is configurable at boot (or even run) time, so that is at least avoidable.

This only started working last night, so is pretty unstable...

W. H. Heydt
Posts: 12360
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: memory split: there has to be a better way.

Tue Oct 16, 2012 6:54 am

No idea if this could be done, but someone in one of the myriad threads on the 512MB Pi suggested basing the split on specifying how much memory the GPU gets, with Linux getting the balance.

An alternative might be find a way to specify a fraction of the memory that the GPU gets...say in 16ths, which would allow the spec to be a single hexadecimal character..

Aydan
Posts: 719
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: memory split: there has to be a better way.

Wed Oct 17, 2012 10:14 am

W. H. Heydt wrote:No idea if this could be done, but someone in one of the myriad threads on the 512MB Pi suggested basing the split on specifying how much memory the GPU gets, with Linux getting the balance.
Yep, that was me. Most laptops do it like this in the BIOS. You set how much video memory the GPU gets and the rest goes to the OS.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: memory split: there has to be a better way.

Sat Oct 20, 2012 12:20 am


Return to “General discussion”