[Intel-gfx] [i-g-t] dumb_buffer at clear_create triggers OOM since 0b0eaa353
Li Zhijian
zhijianx.li at intel.com
Thu Apr 23 09:38:38 UTC 2020
Hi guys
0Day noticed that dumb_buffer at clear_create triggers OOM since commit:
0b0eaa353 ("tests/dumb_buffer: Try to compute the largest possible dumb
buffer")
our platform is
- CPU: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
- memory: 48G
- kernel: v5.5, v5.6, v5.7-rc2
i tried to add some debug into the code as following
diff --git a/tests/dumb_buffer.c b/tests/dumb_buffer.c
index c1e7b4d3..22611f95 100644
--- a/tests/dumb_buffer.c
+++ b/tests/dumb_buffer.c
@@ -58,11 +58,13 @@ static int __dumb_create(int fd, struct
drm_mode_create_dumb *create)
{
int err = 0;
+ igt_info("start __dumb_create %ld\n", create->size);
if (igt_ioctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, create)) {
err = -errno;
igt_assume(err);
}
+ igt_info("end __dumb_create %ld, err %d\n", create->size, err);
errno = 0;
return err;
}
@@ -80,10 +82,12 @@ static void *__dumb_map(int fd, uint32_t handle,
uint64_t size, unsigned prot)
if (igt_ioctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg))
return NULL;
+ igt_info("size %ld, offset %x\n", size, arg.offset);
ptr = mmap(NULL, size, prot, MAP_SHARED, fd, arg.offset);
if (ptr == MAP_FAILED)
return NULL;
+ igt_info("mmap success, size %ld, offset %x\n", size, arg.offset);
return ptr;
}
@@ -356,6 +360,7 @@ static uint64_t estimate_largest_dumb_buffer(int fd)
return largest / PAGE_SIZE;
}
+ sleep(1);
for (create.height = 1; create.height; create.height *= 2) {
if (__dumb_create(fd, &create))
longjmp(sigjmp, SIGABRT);
@@ -368,7 +373,9 @@ static uint64_t estimate_largest_dumb_buffer(int fd)
if (!*ptr)
largest = create.size;
+ igt_info("mmap %ld\n", create.size);
munmap(ptr, create.size);
+ igt_info("unmmap %ld\n", create.size);
ptr = NULL;
}
then get below outputs:
Subtest map-invalid-size: SUCCESS (0.000s)
Starting subtest: create-clear
start __dumb_create 0
end __dumb_create 4194304, err 0
size 4194304, offset 1a48000
mmap success, size 4194304, offset 1a48000
mmap 4194304
unmmap 4194304
start __dumb_create 4194304
end __dumb_create 8388608, err 0
size 8388608, offset 1a48000
mmap success, size 8388608, offset 1a48000
mmap 8388608
unmmap 8388608
start __dumb_create 8388608
end __dumb_create 16777216, err 0
size 16777216, offset 1a48000
mmap success, size 16777216, offset 1a48000
mmap 16777216
unmmap 16777216
start __dumb_create 16777216
end __dumb_create 33554432, err 0
size 33554432, offset 1a48000
mmap success, size 33554432, offset 1a48000
mmap 33554432
unmmap 33554432
start __dumb_create 33554432
end __dumb_create 67108864, err 0
size 67108864, offset 1a48000
mmap success, size 67108864, offset 1a48000
mmap 67108864
unmmap 67108864
start __dumb_create 67108864
end __dumb_create 134217728, err 0
size 134217728, offset 1a48000
mmap success, size 134217728, offset 1a48000
mmap 134217728
unmmap 134217728
start __dumb_create 134217728
end __dumb_create 268435456, err 0
size 268435456, offset 1a48000
mmap success, size 268435456, offset 1a48000
mmap 268435456
unmmap 268435456
start __dumb_create 268435456
end __dumb_create 536870912, err 0
size 536870912, offset 1a48000
mmap success, size 536870912, offset 1a48000
mmap 536870912
unmmap 536870912
start __dumb_create 536870912
end __dumb_create 1073741824, err 0
size 1073741824, offset 1a48000
mmap success, size 1073741824, offset 1a48000
mmap 1073741824
unmmap 1073741824
start __dumb_create 1073741824
end __dumb_create 2147483648, err 0
size 2147483648, offset 1a48000
mmap success, size 2147483648, offset 1a48000
Killed
attached the dmesg as well[10703.523385] dumb_buffer invoked oom-killer:
gfp_mask=0x0(), order=0, oom_score_adj=1000
[10703.531385] CPU: 0 PID: 7166 Comm: dumb_buffer Not tainted
5.6.0-00335-g7111951b8d497 #1
[10703.539466] Hardware name: Supermicro SYS-5018D-FN4T/X10SDV-8C-TLN4F,
BIOS 1.1 03/02/2016
[10703.547630] Call Trace:
[10703.550080] dump_stack+0x66/0x8b
[10703.553398] dump_header+0x4a/0x220
[10703.556889] oom_kill_process+0xf6/0x150
[10703.560805] out_of_memory+0x105/0x540
[10703.564548] pagefault_out_of_memory+0x64/0x80
[10703.568987] page_fault+0x3e/0x50
[10703.572296] RIP: 0033:0x556f7b09257a
[10703.575867] Code: e8 2b fe ff ff 8b 74 24 40 44 89 f7 48 89 44 24 28
e8 ea fb ff ff 48 8b 44 24 28 48 85 c0 74 7d 48 8b 44 24 28 48 8b 4c 24
48 <80> 38 00 75 05 48 89 4c 24 20 48 8d 15 71 0b 00 00 31 ff 31 c0 be
[10703.594613] RSP: 002b:00007fff025dc330 EFLAGS: 00010206
[10703.599829] RAX: 00007fd2e42cf000 RBX: 00007fff025dc360 RCX:
0000000080000000
[10703.606955] RDX: 00007fff025dc31c RSI: 00000000c00464b4 RDI:
0000000000000003
[10703.614078] RBP: 00007fff025dc4e0 R08: 0000556f7b3b8014 R09:
0000000000000001
[10703.621201] R10: 0000556f7b3e2530 R11: 0000000000000246 R12:
0000556f7b091f60
[10703.628324] R13: 00007fff025dc5f0 R14: 0000000000000003 R15:
0000000000000000
[10703.635457] Mem-Info:
[10703.637734] active_anon:64644 inactive_anon:13676 isolated_anon:0
active_file:189 inactive_file:80 isolated_file:0
unevictable:567302 dirty:0 writeback:0 unstable:0
slab_reclaimable:17803 slab_unreclaimable:19262
mapped:6355 shmem:14081 pagetables:614 bounce:0
free:11608206 free_pcp:7728 free_cma:51062
[10703.671836] Node 0 active_anon:258576kB inactive_anon:54704kB
active_file:756kB inactive_file:320kB unevictable:2269208kB
isolated(anon):0kB isolated(file):0kB mapped:25420kB dirty:0kB
writeback:0kB shmem:56324kB shmem_thp: 0kB shmem_pmdmapped: 0kB
anon_thp: 235520kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes
[10703.700131] Node 0 DMA free:15888kB min:20kB low:32kB high:44kB
reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB
present:15972kB managed:15888kB mlocked:0kB kernel_stack:0kB
pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[10703.727907] lowmem_reserve[]: 0 1865 47608 47608 47608
[10703.733056] Node 0 DMA32 free:1898672kB min:2636kB low:4544kB
high:6452kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB
present:1975952kB managed:1910416kB mlocked:0kB kernel_stack:0kB
pagetables:0kB bounce:0kB free_pcp:11596kB local_pcp:1384kB free_cma:0kB
[10703.762653] lowmem_reserve[]: 0 0 45742 45742 45742
[10703.767534] Node 0 Normal free:44518264kB min:64924kB low:111968kB
high:159012kB reserved_highatomic:0KB active_anon:258576kB
inactive_anon:54704kB active_file:756kB inactive_file:320kB
unevictable:2269208kB writepending:0kB present:48234496kB
managed:47316716kB mlocked:2208kB kernel_stack:3584kB pagetables:2456kB
bounce:0kB free_pcp:19312kB local_pcp:1388kB free_cma:204248kB
[10703.800750] lowmem_reserve[]: 0 0 0 0 0
[10703.804598] Node 0 DMA: 0*4kB 0*8kB 1*16kB (U) 0*32kB 2*64kB (U)
1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (UM)
= 15888kB
[10703.817726] Node 0 DMA32: 28*4kB (UM) 9*8kB (UM) 19*16kB (UM) 12*32kB
(UM) 11*64kB (UM) 10*128kB (UM) 22*256kB (UM) 22*512kB (UM) 11*1024kB
(U) 2*2048kB (U) 455*4096kB (U) = 1898792kB
[10703.834063] Node 0 Normal: 697*4kB (UMEC) 893*8kB (UME) 239*16kB
(UME) 208*32kB (UMEC) 59*64kB (UME) 58*128kB (UME) 139*256kB (UMEC)
86*512kB (UME) 40*1024kB (UMC) 7*2048kB (UC) 10828*4096kB (UMC) = 44518012kB
[10703.852656] Node 0 hugepages_total=0 hugepages_free=0
hugepages_surp=0 hugepages_size=1048576kB
[10703.861361] Node 0 hugepages_total=0 hugepages_free=0
hugepages_surp=0 hugepages_size=2048kB
[10703.869807] 581564 total pagecache pages
[10703.873740] 0 pages in swap cache
[10703.877069] Swap cache stats: add 0, delete 0, find 0/0
[10703.882302] Free swap = 0kB
[10703.885198] Total swap = 0kB
[10703.888093] 12556605 pages RAM
[10703.891161] 0 pages HighMem/MovableOnly
[10703.895008] 245850 pages reserved
[10703.898337] 51200 pages cma reserved
[10703.901923] 0 pages hwpoisoned
[10703.904994] Tasks state (memory values in pages):
[10703.909720] [ pid ] uid tgid total_vm rss pgtables_bytes
swapents oom_score_adj name
[10703.918358] [ 354] 100 354 31823 1063 151552
0 0 systemd-timesyn
[10703.927405] [ 358] 0 358 12470 885 143360
0 0 rpcbind
[10703.935750] [ 384] 105 384 11285 969 126976
0 -900 dbus-daemon
[10703.944453] [ 399] 0 399 63585 782 147456
0 0 rsyslogd
[10703.952886] [ 406] 0 406 1074 32 53248
0 0 lkp-bootstrap
[10703.961762] [ 408] 0 408 1107 453 57344
0 -1000 lkp-setup-rootf
[10703.970816] [ 414] 0 414 11621 1190 131072
0 0 systemd-logind
[10703.979776] [ 420] 0 420 17488 1564 172032
0 -1000 sshd
[10703.987873] [ 438] 0 438 1491 174 57344
0 -1000 tail
[10703.995967] [ 440] 0 440 42374 38686 380928
0 -1000 sed
[10704.003976] [ 441] 0 441 1491 177 57344
0 -1000 tail
[10704.012071] [ 442] 0 442 26356 22656 253952
0 -1000 sed
[10704.020077] [ 464] 0 464 3218 431 69632
0 0 agetty
[10704.028362] [ 665] 0 665 1112 452 53248
0 -1000 run-lkp
[10704.036710] [ 690] 106 690 8860 595 114688
0 0 rpc.statd
[10704.045237] [ 757] 0 757 5716 459 86016
0 0 bmc-watchdog
[10704.054027] [ 796] 0 796 1070 380 57344
0 -1000 watchdog
[10704.062480] [ 1436] 0 1436 3470 623 61440
0 0 cron
[10704.070562] [ 4323] 0 4323 7077 825 81920
0 -1000 systemd-udevd
[10704.079426] [ 4997] 0 4997 3872 410 73728
0 0 lvmetad
[10704.087765] [ 7024] 0 7024 18206 1724 176128
0 0 sshd
[10704.095857] [ 7033] 0 7033 1546 918 49152
0 0 bash
[10704.103953] [ 7165] 0 7165 1015 197 49152
0 -1000 sleep
[10704.112135] [ 7166] 0 7166 564400 3494 327680
0 1000 dumb_buffer
[10704.120836]
oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-0.slice/session-35.scope,task=dumb_buffer,pid=7166,uid=0
[10704.137173] Out of memory: Killed process 7166 (dumb_buffer)
total-vm:2257600kB, anon-rss:3832kB, file-rss:10144kB, shmem-rss:0kB,
UID:0 pgtables:320kB oom_score_adj:1000
[10704.153758] oom_reaper: reaped process 7166 (dumb_buffer), now
anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Thanks
Zhijian
More information about the Intel-gfx
mailing list