When allocating memory from bootmem for the kernel to use, try to leave about
2MB of memory in the bootmem allocator for the SDK to use internally at a later point. It'd be nice if there were some functions we could call before allocating memory to let various facilities reserve some memory, but for now this seems sufficient. Previously some unfortunate systems could give up all (or at least most) of their memory to the kernel from bootmem, and then allocating command queues for packet output and the like would fail later in the boot process (which in turn would lead to crashes even later.) Reported by: kan
This commit is contained in:
parent
a5dbab5444
commit
1dadcedcfc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216773
@ -287,6 +287,14 @@ octeon_memory_init(void)
|
||||
*/
|
||||
i = 0;
|
||||
while (i < PHYS_AVAIL_ENTRIES) {
|
||||
/*
|
||||
* If there is less than 2MB of memory available in 128-byte
|
||||
* blocks, do not steal any more memory. We need to leave some
|
||||
* memory for the command queues to be allocated out of.
|
||||
*/
|
||||
if (cvmx_bootmem_available_mem(128) < 2 << 20)
|
||||
break;
|
||||
|
||||
addr = cvmx_bootmem_phy_alloc(1 << 20, phys_end,
|
||||
~(vm_paddr_t)0, PAGE_SIZE, 0);
|
||||
if (addr == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user