[PATCH] drm/etnaviv: Remove GFP_HIGHUSER in systems with 32 address limits
wang xiaolei
xiaolei.wang at windriver.com
Tue Aug 6 13:17:25 UTC 2024
On 8/6/24 11:23 PM, Lucas Stach wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> Hi Xiaolei,
>
> Am Dienstag, dem 06.08.2024 um 18:47 +0800 schrieb Xiaolei Wang:
>> GFP_HIGHUSER is for userspace allocations that may be mapped
>> to userspace,An example may be a hardware allocation that maps
>> data directly into userspace but has no addressing limitations,
>> this conflicts with GFP_DMA32,The kernel reports a BUG:
>>
> GFP_HIGHUSER is a combination of GFP_USER | __GFP_HIGHMEM. Only the
> highmem part is incompatible with DMA32. You don't want to clear the
> GFP_USER bit here, as the driver allocated buffers might be mapped to
> userspace.
Yes, I will update the commit log in v2
thanks
xiaolei
>
> Regards,
> Lucas
>
>> kernel BUG at include/linux/gfp.h:139!
>> Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
>> Modules linked in:
>> Hardware name: NXP i.MX8MPlus EVK board (DT)
>> pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>> pc : __alloc_pages_noprof+0x5d8/0x72c
>> lr : alloc_pages_mpol_noprof+0x100/0x4e0
>> sp : ffffffc08c6a71c0
>> x29: ffffffc08c6a71c0 x28: ffffffc086e46000 x27: ffffffc086e46a68
>> x26: 1ffffff81122b260 x25: ffffffc089159304 x24: ffffff80da938000
>> x23: 0000000000000000 x22: 0000000000000000 x21: ffffff80da938000
>> x20: 1ffffff8118d4e46 x19: 0000000000146cc6 x18: 0000000000000000
>> x17: ffffffc081b00980 x16: ffffffc081b002a8 x15: 1ffffff8118d4e56
>> x14: 00000000f1f1f1f1 x13: 00000000f3f3f300 x12: 0000000000000000
>> x11: ffffff80da9384c8 x10: ffffff80da938000 x9 : 00000000f2f2f200
>> x8 : 0000000041b58ab3 x7 : 00000000f3000000 x6 : 00000000f3f3f3f3
>> x5 : 1ffffff01b527005 x4 : 000000000000000c x3 : 0000000000000006
>> x2 : 0000000000000000 x1 : 00000000000003a3 x0 : 0000000000000000
>> Call trace:
>> __alloc_pages_noprof+0x5d8/0x72c
>> alloc_pages_mpol_noprof+0x100/0x4e0
>> folio_alloc_mpol_noprof+0x18/0xb8
>> shmem_alloc_folio+0x154/0x1a8
>> shmem_alloc_and_add_folio+0x180/0xee8
>> shmem_get_folio_gfp+0x660/0x103c
>> shmem_read_folio_gfp+0x98/0x104
>> drm_gem_get_pages+0x174/0x5ac
>> etnaviv_gem_shmem_get_pages+0x18/0x5c
>> etnaviv_gem_get_pages+0x100/0x328
>> etnaviv_gem_cpu_prep+0x2e8/0x438
>> etnaviv_ioctl_gem_cpu_prep+0xb0/0x1ac
>> drm_ioctl_kernel+0x158/0x2c8
>> drm_ioctl+0x494/0xb48
>> __arm64_sys_ioctl+0x120/0x18c
>> invoke_syscall+0x6c/0x25c
>> el0_svc_common.constprop.0+0x174/0x278
>> do_el0_svc+0x40/0x58
>> el0_svc+0x50/0xc0
>> el0t_64_sync_handler+0xc0/0xc4
>> el0t_64_sync+0x190/0x194
>> Code: 52800021 39003c01 d4210000 17ffff57 (d4210000)
>>
>> Fixes: b72af445cd38 ("drm/etnaviv: request pages from DMA32 zone when needed")
>> Signed-off-by: Xiaolei Wang <xiaolei.wang at windriver.com>
>> ---
>> drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
>> index 7c7f97793ddd..c3f329226bed 100644
>> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
>> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
>> @@ -844,8 +844,10 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
>> * request pages for our SHM backend buffers from the DMA32 zone to
>> * hopefully avoid performance killing SWIOTLB bounce buffering.
>> */
>> - if (dma_addressing_limited(gpu->dev))
>> - priv->shm_gfp_mask |= GFP_DMA32;
>> + if (dma_addressing_limited(gpu->dev)) {
>> + priv->shm_gfp_mask |= GFP_DMA32 & GFP_USER;
>> + priv->shm_gfp_mask &= ~GFP_HIGHUSER;
>> + }
>>
>> /* Create buffer: */
>> ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer,
More information about the dri-devel
mailing list