On 2021-01-13 2:13 p.m., Christian König wrote:
The only flag we really need is __GFP_NOMEMALLOC, highmem depends on
dma32 and moveable/compound should never be set in the first place.

Signed-off-by: Christian König <christian.koe...@amd.com>
---
  drivers/gpu/drm/ttm/ttm_pool.c | 11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
index 8cd776adc592..11e0313db0ea 100644
--- a/drivers/gpu/drm/ttm/ttm_pool.c
+++ b/drivers/gpu/drm/ttm/ttm_pool.c
@@ -79,12 +79,13 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool 
*pool, gfp_t gfp_flags,
        struct page *p;
        void *vaddr;
- if (order) {
-               gfp_flags |= GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
+       /* Don't set the __GFP_COMP flag for higher order allocations.
+        * Mapping pages directly into an userspace process and calling
+        * put_page() on a TTM allocated page is illegal.
+        */
+       if (order)
+               gfp_flags |= __GFP_NOMEMALLOC | __GFP_NORETRY |
                        __GFP_KSWAPD_RECLAIM;
-               gfp_flags &= ~__GFP_MOVABLE;
-               gfp_flags &= ~__GFP_COMP;
-       }
if (!pool->use_dma_alloc) {
                p = alloc_pages(gfp_flags, order);


I picked up this change today, and got the attached splat while running piglit.

scripts/faddr2line drivers/gpu/drm/ttm/ttm.ko ttm_pool_alloc+0x2e4/0x5e0

gives:

ttm_pool_alloc+0x2e4/0x5e0:
 alloc_pages at /home/daenzer/src/linux-git/linux/./include/linux/gfp.h:547

(inlined by) ttm_pool_alloc_page at /home/daenzer/src/linux-git/linux/drivers/gpu/drm//ttm/ttm_pool.c:91

(inlined by) ttm_pool_alloc at /home/daenzer/src/linux-git/linux/drivers/gpu/drm//ttm/ttm_pool.c:398



I suspect we need __GFP_NOWARN as well to avoid these splats.


--
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
[ 9556.710241] clinfo: page allocation failure: order:9, 
mode:0x194dc2(GFP_HIGHUSER|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_ZERO|__GFP_NOMEMALLOC),
 nodemask=(null),cpuset=user.slice,mems_allowed=0
[ 9556.710259] CPU: 1 PID: 470821 Comm: clinfo Tainted: G            E     
5.10.10+ #4
[ 9556.710264] Hardware name: Micro-Star International Co., Ltd. MS-7A34/B350 
TOMAHAWK (MS-7A34), BIOS 1.OR 11/29/2019
[ 9556.710268] Call Trace:
[ 9556.710281]  dump_stack+0x6b/0x83
[ 9556.710288]  warn_alloc.cold+0x7b/0xdf
[ 9556.710297]  ? __alloc_pages_direct_compact+0x137/0x150
[ 9556.710303]  __alloc_pages_slowpath.constprop.0+0xc1b/0xc50
[ 9556.710312]  __alloc_pages_nodemask+0x2ec/0x320
[ 9556.710325]  ttm_pool_alloc+0x2e4/0x5e0 [ttm]
[ 9556.710332]  ? kvmalloc_node+0x46/0x80
[ 9556.710341]  ttm_tt_populate+0x37/0xe0 [ttm]
[ 9556.710350]  ttm_bo_handle_move_mem+0x142/0x180 [ttm]
[ 9556.710359]  ttm_bo_validate+0x11d/0x190 [ttm]
[ 9556.710391]  ? drm_vma_offset_add+0x2f/0x60 [drm]
[ 9556.710399]  ttm_bo_init_reserved+0x2a7/0x320 [ttm]
[ 9556.710529]  amdgpu_bo_do_create+0x1b8/0x500 [amdgpu]
[ 9556.710657]  ? amdgpu_bo_subtract_pin_size+0x60/0x60 [amdgpu]
[ 9556.710663]  ? get_page_from_freelist+0x11f9/0x1450
[ 9556.710789]  amdgpu_bo_create+0x40/0x270 [amdgpu]
[ 9556.710797]  ? _raw_spin_unlock+0x16/0x30
[ 9556.710927]  amdgpu_gem_create_ioctl+0x123/0x310 [amdgpu]
[ 9556.711062]  ? amdgpu_gem_force_release+0x150/0x150 [amdgpu]
[ 9556.711098]  drm_ioctl_kernel+0xaa/0xf0 [drm]
[ 9556.711133]  drm_ioctl+0x20f/0x3a0 [drm]
[ 9556.711267]  ? amdgpu_gem_force_release+0x150/0x150 [amdgpu]
[ 9556.711276]  ? preempt_count_sub+0x9b/0xd0
[ 9556.711404]  amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
[ 9556.711411]  __x64_sys_ioctl+0x83/0xb0
[ 9556.711417]  do_syscall_64+0x33/0x80
[ 9556.711421]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 9556.711426] RIP: 0033:0x7f14217bdcc7
[ 9556.711431] Code: 00 00 00 48 8b 05 c9 91 0c 00 64 c7 00 26 00 00 00 48 c7 
c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 
f0 ff ff 73 01 c3 48 8b 0d 99 91 0c 00 f7 d8 64 89 01 48
[ 9556.711434] RSP: 002b:00007ffd97bfdc68 EFLAGS: 00000246 ORIG_RAX: 
0000000000000010
[ 9556.711439] RAX: ffffffffffffffda RBX: 00007ffd97bfdcc0 RCX: 00007f14217bdcc7
[ 9556.711442] RDX: 00007ffd97bfdcc0 RSI: 00000000c0206440 RDI: 0000000000000006
[ 9556.711445] RBP: 00000000c0206440 R08: 0000000000000008 R09: 00007f1421887be0
[ 9556.711448] R10: 00007ffd97c9e080 R11: 0000000000000246 R12: 0000564dab762d20
[ 9556.711450] R13: 0000000000000006 R14: 0000000000200000 R15: 0000000000200000
[ 9556.711489] Mem-Info:
[ 9556.711499] active_anon:3253 inactive_anon:141494 isolated_anon:0
                active_file:1878780 inactive_file:1558064 isolated_file:32
                unevictable:0 dirty:6571 writeback:0
                slab_reclaimable:123407 slab_unreclaimable:40992
                mapped:62091 shmem:3821 pagetables:3837 bounce:0
                free:293596 free_pcp:684 free_cma:0
[ 9556.711510] Node 0 active_anon:13012kB inactive_anon:565976kB 
active_file:7515120kB inactive_file:6232256kB unevictable:0kB 
isolated(anon):0kB isolated(file):128kB mapped:248364kB dirty:26284kB 
writeback:0kB shmem:15284kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 
176128kB writeback_tmp:0kB kernel_stack:11472kB all_unreclaimable? no
[ 9556.711518] Node 0 DMA free:13836kB min:64kB low:80kB high:96kB 
reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB 
inactive_file:0kB unevictable:0kB writepending:0kB present:15996kB 
managed:15884kB mlocked:0kB pagetables:0kB bounce:0kB free_pcp:0kB 
local_pcp:0kB free_cma:0kB
[ 9556.711530] lowmem_reserve[]: 0 3455 15916 15916 15916
[ 9556.711561] Node 0 DMA32 free:960912kB min:14656kB low:18320kB high:21984kB 
reserved_highatomic:0KB active_anon:0kB inactive_anon:4128kB 
active_file:1476984kB inactive_file:885884kB unevictable:0kB 
writepending:10744kB present:3616612kB managed:3614296kB mlocked:0kB 
pagetables:968kB bounce:0kB free_pcp:372kB local_pcp:4kB free_cma:0kB
[ 9556.711576] lowmem_reserve[]: 0 0 12460 12460 12460
[ 9556.711585] Node 0 Normal free:199384kB min:52856kB low:66068kB high:79280kB 
reserved_highatomic:0KB active_anon:13012kB inactive_anon:561868kB 
active_file:6038340kB inactive_file:5346576kB unevictable:0kB 
writepending:15844kB present:13094400kB managed:12768556kB mlocked:0kB 
pagetables:14380kB bounce:0kB free_pcp:2640kB local_pcp:1044kB free_cma:0kB
[ 9556.711592] lowmem_reserve[]: 0 0 0 0 0
[ 9556.711600] Node 0 DMA: 3*4kB (U) 4*8kB (U) 0*16kB 1*32kB (U) 3*64kB (U) 
0*128kB 1*256kB (U) 0*512kB 1*1024kB (U) 2*2048kB (UM) 2*4096kB (M) = 13836kB
[ 9556.711636] Node 0 DMA32: 7081*4kB (UME) 3926*8kB (UME) 1931*16kB (UME) 
11158*32kB (UME) 5198*64kB (UM) 620*128kB (UME) 115*256kB (ME) 62*512kB (M) 
40*1024kB (M) 0*2048kB 0*4096kB = 961860kB
[ 9556.711680] Node 0 Normal: 3812*4kB (UME) 8827*8kB (UME) 2131*16kB (UM) 
482*32kB (UME) 222*64kB (UME) 242*128kB (UM) 30*256kB (UM) 14*512kB (M) 
6*1024kB (UM) 0*2048kB 0*4096kB = 201560kB
[ 9556.711729] 3441160 total pagecache pages
[ 9556.711734] 582 pages in swap cache
[ 9556.711738] Swap cache stats: add 9254, delete 8674, find 415/656
[ 9556.711742] Free swap  = 7981308kB
[ 9556.711745] Total swap = 7999484kB
[ 9556.711748] 4181752 pages RAM
[ 9556.711752] 0 pages HighMem/MovableOnly
[ 9556.711755] 82068 pages reserved
[ 9556.711757] 0 pages hwpoisoned
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to