gpu: nvgpu: Use real PDE size to determine pte_blk_order

In the buddy allocator use the actual size of the PDE to determine
the pte_blk_order field which is used to determine what page size a
buddy has (or doesn't). Previously this was just set as the large
page size times 1024 which would over allocate PDE ranges for Pascal+
chips. This caused userspace, which was using the real PDE size, to
sometime allocate small and large pages in what the buddy allocator
mistakenly thought was one PDE.

Bug 200105199

Change-Id: I7ab7db7962015fc268bad61b558a18704133e1cb
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1639731
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2018-01-16 16:44:18 -08:00
committed by mobile promotions
parent 137006fe78
commit b8dbc853d7

View File

@@ -1255,7 +1255,7 @@ int __nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
a->vm = vm; a->vm = vm;
if (flags & GPU_ALLOC_GVA_SPACE) { if (flags & GPU_ALLOC_GVA_SPACE) {
pde_size = ((u64)vm->big_page_size) << 10; pde_size = 1ULL << nvgpu_vm_pde_coverage_bit_count(vm);
a->pte_blk_order = balloc_get_order(a, pde_size); a->pte_blk_order = balloc_get_order(a, pde_size);
} }