freebsd / drm-kmod

drm driver for FreeBSD
148 stars 68 forks source link

memory usage drops below zero #261

Closed magicalskye closed 8 months ago

magicalskye commented 8 months ago

hello lovely video card people,

i am having major gremlins in the machine.

i’m sorry that this will not be a succinct and to-the-point bug report but this is because i have no idea what i am doing. i cannot stress enough how much i have no idea. this is literally my first day on freeBSD. i have plenty of experience with hacky stuff on linux but i am 100% new to this ecosystem.

so, i have a Radeon RX 6500 XT. i installed freeBSD 13.2 and it obviously could not make heads or tails of the card. so i found out how to upgrade to 14.0 and then pkg install-ed the drm-515-kmod and i was very happy to finally have X running. then a helpful person in IRC told me to check for a memory leak and sure enough, it was leaking. and leaking more the more i was doing things. glxgears made it get bigger faster. no surprise there.

so i figured out how to use ports, and got the ports git repos fresh per the handbook, and because this is my first day, i just did portmaster -a and let it do its thing. i watched it compile the 515 and at the end it even gave me a helpful message about the package. so i know it updated that from ports.

i did a reboot and all was fine, so i turned on my fluxbox and ran the glxgears again. and at first i was happy because i saw that it was not getting bigger but smaller. but it kept getting smaller. and smaller. and then it reached zero and overflowed (underflowed?) into an impossibly large number. it keeps getting smaller, and the more i run the glxgears the smaller it gets, and if i do nothing it stays mostly the same size.

thankfully, i have not yet figured out which command replaces the 'watch' command i know from linux, therefore i was just doing 'vmstat -m | grep lkpikmalloc' repeatedly, which also means i could simply copy and paste the output (and leave out the parts where i was frantically reading man pages to find out what the columns actually mean, which they unfortunately do not explain)

now i may not know exactly what i did today but i feel like something here is very, very wrong and i am expecting either godzilla or little green men any minute now

(edit okay i am just gonna paste my actual terminal content instead of the much shortened version because you can see the development much better this way)

root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1591  2493K     8620  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1589  2494K     8647  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1585  2493K     8692  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1582  2492K     8719  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1579  2491K     8746  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1576  2490K     8773  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1573  2490K     8800  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1570  2489K     8827  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc  1198  2762K    16778  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc   758  2650K    19561  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc   365  2552K    22058  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709551461  2374K    25262  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709549261  1825K    39216  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | head
         Type InUse MemUse Requests  Size(s)
CAM I/O Scheduler     6     1K        6  128
   CAM periph    14     4K       49  16,32,64,128,256
    CAM queue    23    14K       83  16,32,1024
CAM dev queue    10     1K       10  64
      CAM SIM    10     2K       10  128
      CAM XPT    57     5K      135  16,32,128,256,512,1024,2048,65536
      CAM DEV    13    26K       32  2048
      CAM CCB     0     0K      123  2048
     CAM path    19     1K      112  32
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709545609   950K    62752  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709544590   700K    69358  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709543813   477K    74260  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709543141   309K    78571  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709542505   153K    82662  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709541809 18014398509481965K    87142  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709540587 18014398509481661K    94947  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709539956 18014398509481505K    99000  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709539159 18014398509481306K   104117  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709537683 18014398509480939K   113537  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709536639 18014398509480678K   120194  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709534445 18014398509480134K   134176  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709528449 18014398509478634K   172218  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # man vmstat
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709516815 18014398509475787K   247530  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat 
 procs    memory    page                      disks     faults       cpu
 r  b  w  avm  fre  flt  re  pi  po   fr   sr ad0 ad1   in   sy   cs us sy id
 0  0  0 514G  30G 4.0K   0   9   0 4.4K   37   0   0 1198  13K 3.9K  0  0 100
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709505944 18014398509473039K   316352  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
root@blfred:~ # vmstat -m | grep lkpikmalloc
  lkpikmalloc 18446744073709503927 18014398509472534K   329128  16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536

edit2 somehow it had not shown me the usual questions when i opened the issue but i did see them now in other issues so:

wulf7 commented 8 months ago

Try latest drm-515-kmod from sources. It should (about) fix memory accounting

magicalskye commented 8 months ago

i thought the ports version was the newest one! but apparently not. the github version works indeed much better with fewer reality bends, thank you very much

evadot commented 8 months ago

Try latest drm-515-kmod from sources. It should (about) fix memory accounting

Thanks wulf ! I'll make a new release of ports tomorrow.

magicalskye commented 8 months ago

appreciate it! thank you for your good work :)