Skip to contentSkip to conversation

mm: memblock: do not enforce current limit for memblock_phys* family

PATCH Applied Mike Rapoport 2 participants 3 messages Oct 12, 2019 – Oct 15, 2019

Subsystems (2)
lore
Share & tools
lore

Mike Rapoport

author maintainer
#0 lore raw

PATCH 1/1 mm: memblock: do not enforce current limit for memblock_phys* family

From: Mike Rapoport <[email protected]>

Until commit 92d12f9544b7 ("memblock: refactor internal allocation functions") the maximal address for memblock allocations was forced to memblock.current_limit only for the allocation functions returning virtual address. The changes introduced by that commit moved the limit enforcement into the allocation core and as a result the allocation functions returning physical address also started to limit allocations to memblock.current_limit.

This caused breakage of etnaviv GPU driver:

[    3.682347] etnaviv etnaviv: bound 130000.gpu (ops gpu_ops)
[    3.688669] etnaviv etnaviv: bound 134000.gpu (ops gpu_ops)
[    3.695099] etnaviv etnaviv: bound 2204000.gpu (ops gpu_ops)
[    3.700800] etnaviv-gpu 130000.gpu: model: GC2000, revision: 5108
[    3.723013] etnaviv-gpu 130000.gpu: command buffer outside valid
memory window
[    3.731308] etnaviv-gpu 134000.gpu: model: GC320, revision: 5007
[    3.752437] etnaviv-gpu 134000.gpu: command buffer outside valid
memory window
[    3.760583] etnaviv-gpu 2204000.gpu: model: GC355, revision: 1215
[    3.766766] etnaviv-gpu 2204000.gpu: Ignoring GPU with VG and FE2.0

Restore the behaviour of memblock_phys* family so that these functions will not enforce memblock.current_limit.

Fixes 92d12f9544b7 ("memblock: refactor internal allocation functions")
---
 mm/memblock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
mm/memblock.c +3 -3
index 7d4f61a..c4b16ca 100644
@@ -1356,9 +1356,6 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
 		align = SMP_CACHE_BYTES;
 	}
 
-	if (end > memblock.current_limit)
-		end = memblock.current_limit;
-
 again:
 	found = memblock_find_in_range_node(size, align, start, end, nid,
 					    flags);
@@ -1469,6 +1466,9 @@ static void * __init memblock_alloc_internal(
 	if (WARN_ON_ONCE(slab_is_available()))
 		return kzalloc_node(size, GFP_NOWAIT, nid);
 
+	if (max_addr > memblock.current_limit)
+		max_addr = memblock.current_limit;
+
 	alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid);
 
 	/* retry allocation without lower limit */
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 8 lines · On Sun, 13 Oct 2019 00:31:01 +0300 Mike Rapoport <[email protected]> wrote:

Until commit 92d12f9544b7 ("memblock: refactor internal allocation functions") the maximal address for memblock allocations was forced to memblock.current_limit only for the allocation functions returning virtual address. The changes introduced by that commit moved the limit enforcement into the allocation core and as a result the allocation functions returning physical address also started to limit allocations to memblock.current_limit.

Quoted 4 lines

This caused breakage of etnaviv GPU driver:

...

So I'll add a cc:stable, yes?

author maintainer
#2 lore raw
Quoted 15 lines · Andrew Morton
Quoted 2 lines · On Sun, 13 Oct 2019 00:31:01 +0300 Mike Rapoport <[email protected]> wrote:

Until commit 92d12f9544b7 ("memblock: refactor internal allocation functions") the maximal address for memblock allocations was forced

to

Quoted 1 line

memblock.current_limit only for the allocation functions returning

virtual

Quoted 1 line

address. The changes introduced by that commit moved the limit

enforcement

Quoted 1 line

into the allocation core and as a result the allocation functions

returning

Quoted 3 lines

physical address also started to limit allocations to memblock.current_limit.

Quoted 6 lines
Quoted 4 lines

This caused breakage of etnaviv GPU driver:

...

So I'll add a cc:stable, yes?

Yeah, right. Somehow I've missed that...

Signature · 2 lines
Sincerely yours,
Mike