diff options
author | Peter Daifuku <pdaifuku@nvidia.com> | 2020-09-30 14:25:05 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2020-10-06 13:10:02 -0400 |
commit | 5a948ccca95bcecf9d1e81db02394134f8a18c38 (patch) | |
tree | fb9e43f6750d9c804e5eb8b161a1c634428f9914 /drivers/gpu/nvgpu/common/mm | |
parent | cd134bb198d7138a3c2fcb17d11f2eedf934e2c4 (diff) |
gpu: nvgpu: limit PD cache to < pgsize for linux
For Linux, limit the use of the cache to entries less than the page size, to
avoid potential problems with running out of CMA memory when allocating large,
contiguous slabs, as would be required for non-iommmuable chips.
Also, in nvgpu_pd_cache_do_free(), zero out entries only if iommu is in use
and PTE entries use the cache (since it's the prefetch of invalid PTEs by
iommu that needs to be avoided).
Bug 3093183
Bug 3100907
Change-Id: I363031db32e11bc705810a7e87fc9e9ac1dc00bd
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2422039
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Dinesh T <dt@nvidia.com>
Reviewed-by: Satish Arora <satisha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/pd_cache.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/pd_cache.c b/drivers/gpu/nvgpu/common/mm/pd_cache.c index a5b3d134..8f7003e5 100644 --- a/drivers/gpu/nvgpu/common/mm/pd_cache.c +++ b/drivers/gpu/nvgpu/common/mm/pd_cache.c | |||
@@ -423,12 +423,19 @@ static void nvgpu_pd_cache_do_free(struct gk20a *g, | |||
423 | * this just re-adds it. | 423 | * this just re-adds it. |
424 | * | 424 | * |
425 | * Since the memory used for the entries is still mapped, if | 425 | * Since the memory used for the entries is still mapped, if |
426 | * igpu make sure the entries are invalidated so that the hw | 426 | * iommu is being used, make sure PTE entries in particular |
427 | * doesn't accidentally try to prefetch non-existent fb memory. | 427 | * are invalidated so that the hw doesn't accidentally try to |
428 | * prefetch non-existent fb memory. | ||
428 | * | 429 | * |
429 | * TBD: what about dgpu? (Not supported in Drive 5.0) | 430 | * Notes: |
431 | * - The check for NVGPU_PD_CACHE_SIZE > PAGE_SIZE effectively | ||
432 | * determines whether PTE entries use the cache. | ||
433 | * - In the case where PTE entries ues the cache, we also | ||
434 | * end up invalidating the PDE entries, but that's a minor | ||
435 | * performance hit, as there are far fewer of those | ||
436 | * typically than there are PTE entries. | ||
430 | */ | 437 | */ |
431 | if (pd->mem->cpu_va != NULL) { | 438 | if (nvgpu_iommuable(g) && (NVGPU_PD_CACHE_SIZE > PAGE_SIZE)) { |
432 | memset((void *)((u64)pd->mem->cpu_va + pd->mem_offs), 0, | 439 | memset((void *)((u64)pd->mem->cpu_va + pd->mem_offs), 0, |
433 | pentry->pd_size); | 440 | pentry->pd_size); |
434 | } | 441 | } |