dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel@daenzer.net>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	ray.huang@amd.com, daniel@ffwll.ch
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ttm: stop using GFP_TRANSHUGE_LIGHT
Date: Wed, 27 Jan 2021 16:45:22 +0100	[thread overview]
Message-ID: <480d0a20-d64b-0837-6571-5af08080aa2a@daenzer.net> (raw)
In-Reply-To: <20210113131325.223511-1-christian.koenig@amd.com>

[-- Attachment #1: Type: text/plain, Size: 1930 bytes --]

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.koenig@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

[-- Attachment #2: splat.txt --]
[-- Type: text/plain, Size: 5388 bytes --]

[ 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

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2021-01-27 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 13:13 [PATCH] drm/ttm: stop using GFP_TRANSHUGE_LIGHT Christian König
2021-01-13 13:27 ` Daniel Vetter
2021-01-13 14:46   ` Christian König
2021-01-13 15:11     ` Daniel Vetter
2021-01-15 12:14 ` Christian König
2021-01-15 12:54   ` Hans de Goede
2021-01-15 13:00     ` Christian König
2021-01-27 15:45 ` Michel Dänzer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=480d0a20-d64b-0837-6571-5af08080aa2a@daenzer.net \
    --to=michel@daenzer.net \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ray.huang@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).