android_kernel_msm-6.1_noth.../kernel/dma
Dezhi Huang 47e02fe1ef UPSTREAM: dma-remap: use kvmalloc_array/kvfree for larger dma memory remap
If dma_direct_alloc() alloc memory in size of 64MB, the inner function
dma_common_contiguous_remap() will allocate 128KB memory by invoking
the function kmalloc_array(). and the kmalloc_array seems to fail to try
to allocate 128KB mem.

Call trace:
[14977.928623] qcrosvm: page allocation failure: order:5, mode:0x40cc0
[14977.928638] dump_backtrace.cfi_jt+0x0/0x8
[14977.928647] dump_stack_lvl+0x80/0xb8
[14977.928652] warn_alloc+0x164/0x200
[14977.928657] __alloc_pages_slowpath+0x9f0/0xb4c
[14977.928660] __alloc_pages+0x21c/0x39c
[14977.928662] kmalloc_order+0x48/0x108
[14977.928666] kmalloc_order_trace+0x34/0x154
[14977.928668] __kmalloc+0x548/0x7e4
[14977.928673] dma_direct_alloc+0x11c/0x4f8
[14977.928678] dma_alloc_attrs+0xf4/0x138
[14977.928680] gh_vm_ioctl_set_fw_name+0x3c4/0x610 [gunyah]
[14977.928698] gh_vm_ioctl+0x90/0x14c [gunyah]
[14977.928705] __arm64_sys_ioctl+0x184/0x210

work around by doing kvmalloc_array instead.

Signed-off-by: Gao Xu <gaoxu2@hihonor.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>

Bug: 279161171
(cherry picked from commit 51ff97d54f02b4444dfc42e380ac4c058e12d5dd)
Change-Id: I665c0a2b06f5a97cef297c1d5a6618373b513299
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
2023-07-13 20:31:00 +00:00
..
coherent.c dma-mapping: Add dma_release_coherent_memory to DMA API 2022-06-24 09:30:54 -06:00
contiguous.c Merge 3bf03b9a08 ("Merge branch 'akpm' (patches from Andrew)") into android-mainline 2022-04-03 12:26:33 +02:00
debug.c ANDROID: dma/debug: fix warning of check_sync 2022-09-27 18:46:03 +00:00
debug.h dma-debug: teach add_dma_entry() about DMA_ATTR_SKIP_CPU_SYNC 2021-10-18 12:46:45 +02:00
direct.c ANDROID: arm64/mm: Add command line option to make ZONE_DMA32 empty 2023-02-16 22:07:29 +00:00
direct.h dma-direct: support PCI P2PDMA pages in dma-direct map_sg 2022-07-26 07:27:47 -04:00
dummy.c dma-mapping: return error code from dma_dummy_map_sg() 2021-08-09 17:13:06 +02:00
Kconfig dma-mapping: remove CONFIG_DMA_REMAP 2022-03-03 14:00:57 +03:00
Makefile dma-mapping: remove CONFIG_DMA_REMAP 2022-03-03 14:00:57 +03:00
map_benchmark.c dma-mapping: benchmark: extract a common header file for map_benchmark definition 2022-03-10 07:41:14 +01:00
mapping.c ANDROID: iommu/dma: Add support for DMA_ATTR_SYS_CACHE_NWA 2023-05-01 21:16:31 -07:00
ops_helpers.c dma-mapping: handle vmalloc addresses in dma_common_{mmap,get_sgtable} 2021-07-16 11:30:26 +02:00
pool.c ANDROID: arm64/mm: Add command line option to make ZONE_DMA32 empty 2023-02-16 22:07:29 +00:00
remap.c UPSTREAM: dma-remap: use kvmalloc_array/kvfree for larger dma memory remap 2023-07-13 20:31:00 +00:00
swiotlb.c swiotlb: don't panic! 2022-09-20 08:42:47 +02:00