diff options
author | Oded Gabbay <ogabbay@kernel.org> | 2021-01-11 16:49:30 +0100 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2021-01-12 14:00:10 +0100 |
commit | 9488307a5559255f2fc9a3ab61e1c31e243ca7c6 (patch) | |
tree | ad3d6a9d5a2175e2346c0766a0388cb6efa432b1 /drivers/misc/habanalabs/common/mmu.c | |
parent | habanalabs: fix reset process in case of failures (diff) | |
download | linux-9488307a5559255f2fc9a3ab61e1c31e243ca7c6.tar.xz linux-9488307a5559255f2fc9a3ab61e1c31e243ca7c6.zip |
habanalabs: prevent soft lockup during unmap
When using Deep learning framework such as tensorflow or pytorch, there
are tens of thousands of host memory mappings. When the user frees
all those mappings at the same time, the process of unmapping and
unpinning them can take a long time, which may cause a soft lockup
bug.
To prevent this, we need to free the core to do other things during
the unmapping process. For now, we chose to do it every 32K unmappings
(each unmap is a single 4K page).
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/common/mmu.c')
-rw-r--r-- | drivers/misc/habanalabs/common/mmu.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/misc/habanalabs/common/mmu.c b/drivers/misc/habanalabs/common/mmu.c index 33ae953d3a36..28a4638741d8 100644 --- a/drivers/misc/habanalabs/common/mmu.c +++ b/drivers/misc/habanalabs/common/mmu.c @@ -9,7 +9,7 @@ #include "habanalabs.h" -static bool is_dram_va(struct hl_device *hdev, u64 virt_addr) +bool hl_is_dram_va(struct hl_device *hdev, u64 virt_addr) { struct asic_fixed_properties *prop = &hdev->asic_prop; @@ -156,7 +156,7 @@ int hl_mmu_unmap_page(struct hl_ctx *ctx, u64 virt_addr, u32 page_size, if (!hdev->mmu_enable) return 0; - is_dram_addr = is_dram_va(hdev, virt_addr); + is_dram_addr = hl_is_dram_va(hdev, virt_addr); if (is_dram_addr) mmu_prop = &prop->dmmu; @@ -236,7 +236,7 @@ int hl_mmu_map_page(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr, if (!hdev->mmu_enable) return 0; - is_dram_addr = is_dram_va(hdev, virt_addr); + is_dram_addr = hl_is_dram_va(hdev, virt_addr); if (is_dram_addr) mmu_prop = &prop->dmmu; |