Skip to content

intel_fb: memory allocation failed #5412

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

Open
cproc opened this issue Jan 8, 2025 · 8 comments
Open

intel_fb: memory allocation failed #5412

cproc opened this issue Jan 8, 2025 · 8 comments
Labels

Comments

@cproc
Copy link
Member

cproc commented Jan 8, 2025

I get the following error (with added debug messages) on one of my test machines when I try to run Sculpt:

[init -> runtime -> intel_fb] Lx_kit::Mem_allocator::alloc(): size: 8388608, align: 8388608
[init -> runtime -> intel_fb] Allocator_avl_base::alloc_aligned(): size: 8388608, align: 23, avail: 52093
Allocator_avl_base::alloc_aligned(): size: 8392704, align: 23, avail: 67542831104
Allocator_avl_base::alloc_aligned(): size: 8392704, align: 22, avail: 67542831104
Allocator_avl_base::alloc_aligned(): size: 8392704, align: 21, avail: 67542831104
Allocator_avl_base::alloc_aligned(): size: 8392704, align: 23, avail: 140736137416704
[init -> drivers -> platform] Allocator_avl_base::alloc_aligned(): size: 8396800, align: 23, avail: 4217597952
Allocator_avl_base::alloc_aligned(): size: 8392704, align: 21, avail: 140735321972736
Allocator_avl_base::alloc_aligned(): size: 8392704, align: 21, avail: 140735623946240
[init -> runtime -> intel_fb] Lx_kit::Mem_allocator::alloc() first attempt failed, retrying with 8392703 bytes added
[init -> runtime -> intel_fb] Allocator_avl_base::alloc_aligned(): size: 8388608, align: 23, avail: 8444796
[init -> runtime -> intel_fb] Error: memory allocation failed for 8388608 align 8388608
Error: illegal WRITE at address 0x34 by pager_object: pd='init -> runtime -> intel_fb' thread='ep' ip=0x11d0a04

It works when I add 'align' to the size of the new buffer, but that's another ~8M in this case and depending on how big other allocations can be, might be too much as a general solution.

@cproc cproc added the bug label Jan 8, 2025
@cproc
Copy link
Member Author

cproc commented Jan 8, 2025

edit: the first line of the log output was missing. It's

[init -> runtime -> intel_fb] Lx_kit::Mem_allocator::alloc(): size: 8388608, align: 8388608

@alex-ab
Copy link
Member

alex-ab commented Jan 14, 2025

Can you please provide the debugging patch? I don't find any code with "first attempt" or "retrying", so one has to guess what you did.

cproc added a commit to cproc/genode that referenced this issue Jan 17, 2025
@cproc
Copy link
Member Author

cproc commented Jan 17, 2025

@alex-ab: commit f9961d6 is the debugging patch

@alex-ab
Copy link
Member

alex-ab commented Jan 20, 2025

Thanks @cproc. Can you please check whether buffer.virt_addr() (line 95) is aligned according to 'align'. If not, then the second attempt can not succeed, since a region is added which does not fulfill the align requirement.

@cproc
Copy link
Member Author

cproc commented Jan 20, 2025

Thanks @cproc. Can you please check whether buffer.virt_addr() (line 95) is aligned according to 'align'. If not, then the second attempt can not succeed, since a region is added which does not fulfill the align requirement.

buffer.virt_addr() is 0x400000 and align is 0x800000.

@alex-ab
Copy link
Member

alex-ab commented Jan 23, 2025

We had a coffee round discussion regarding the topic, I try to summarize. The main issue with the current implementation is this "+ 1" size, which is required to suppress the auto merging of regions, but presumably causes the alignment heuristic in core to not use the intended natural alignment of 23 but something smaller. There exist several options:

  • Extend the Genode API such, that the rm_region.attach also consider an explicit align attribute, which currently is not supported. There was mainly the common view, that this should not be done eagerly, as it breaks the ABI. It may fit later better, e.g. when the region management of a component moves from core to the components themself (in form of a utility).
  • The other option is to manage the region in lx_kit explicitly, to avoid the auto merging for attached regions as done by the avl implementation currently.
  • One may try to add some add_discrete(parameters + align option) in a non ABI breaking way to the avl implementation, which avoids the merging of region.
  • If this does not work out, a copy of the avl implementation with this feature in lx_kit is the other option.

At moment no one is working on trying this out. @cproc feel free if you can/want to investigate.

@alex-ab
Copy link
Member

alex-ab commented Jan 23, 2025

Sorry, "should be done eagerly" -> "should not be done eagerly"

@alex-ab
Copy link
Member

alex-ab commented Jan 23, 2025

I updated the text again with a bit more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants