Bug 238925

Summary: graphics/drm-fbsd12.0-kmod: leaks memory when i915kms.ko is loaded
Product: Ports & Packages Reporter: Ting-Wei Lan <lantw44>
Component: Individual Port(s)Assignee: freebsd-x11 mailing list <x11>
Status: Closed FIXED    
Severity: Affects Only Me CC: hselasky, zeising
Priority: --- Flags: bugzilla: maintainer-feedback? (jmd)
Version: Latest   
Hardware: Any   
OS: Any   

Description Ting-Wei Lan 2019-07-01 15:24:15 UTC
My desktop computer has 16 GiB RAM, but it seems that drm-fbsd12.0-kmod keeps leaking memory, using up all memory in one day and forcing me to reboot. This computer uses Intel i5-650 CPU and its integrated Intel Ironlake graphics. The operating system is FreeBSD 12.0 with GNOME desktop environment.

If I remember correctly, the problem has existed since the introduction of drm-fbsd12.0-kmod port. Here are a few test results I found a few days ago. The version of drm-fbsd12.0-kmod is 4.16.g20190624.

1. When the system was just booted, wired memory was below 3 GiB.

2. After the system had run for 12 hours, wired memory became 12 GiB. The desktop was still responsive, but the usage of swap was increasing.

3. After the system had run for 15 hours, wired memory become 15 GiB. The desktop was non-responsive, and it was slow to run any command from an SSH login shell. Ctrl-T showed that most of time are spent on swapping. Even Ctrl-C took several seconds to respond.

4. After I managed to terminate Xorg and bring down the desktop environment, the shell became responsive again. However, wired memory usage was still 14 GiB. It seemed that there was no way to reclaim the memory so I had to reboot it.

This kind of memory leak only happens when i915kms.ko from drm-fbsd12.0-kmod is used. It doesn't happen if i915kms.ko from base is used. If I use i915kms.ko from base, wired memory usually stays below 3 GiB, and the system can last more than one month without the need to reboot.
Comment 1 Niclas Zeising freebsd_committer 2019-07-01 18:50:02 UTC
Hi!
I've opened an issue in our github repo where the drm drivers are developed, to make it easier to track.  It can be followed here https://github.com/FreeBSDDesktop/kms-drm/issues/155

Can you provide more details, preferably in the github issue, about your graphics hardware?
Comment 2 commit-hook freebsd_committer 2019-07-10 14:50:40 UTC
A commit references this bug:

Author: zeising
Date: Wed Jul 10 14:50:13 UTC 2019
New revision: 506353
URL: https://svnweb.freebsd.org/changeset/ports/506353

Log:
  graphics/drm-current-kmod: Update snapshot

  Update snapshot of graphics/drm-curent-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue:	#55
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  MFH:		2019Q3 (implicit, drm-drivers blanket)
  Sponsored by:	B3 Init (zeising)

Changes:
  head/graphics/drm-current-kmod/Makefile
  head/graphics/drm-current-kmod/distinfo
Comment 3 commit-hook freebsd_committer 2019-07-10 14:51:44 UTC
A commit references this bug:

Author: zeising
Date: Wed Jul 10 14:51:17 UTC 2019
New revision: 506354
URL: https://svnweb.freebsd.org/changeset/ports/506354

Log:
  graphics/drm-fbsd12.0-kmod: Update snapshot

  Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue: #155
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  MFH:		2019Q3 (implicit, drm-drivers blanket)
  Sponsored by:	B3 Init (zeising)

Changes:
  head/graphics/drm-fbsd12.0-kmod/Makefile
  head/graphics/drm-fbsd12.0-kmod/distinfo
Comment 4 commit-hook freebsd_committer 2019-07-10 15:11:00 UTC
A commit references this bug:

Author: zeising
Date: Wed Jul 10 15:10:40 UTC 2019
New revision: 506355
URL: https://svnweb.freebsd.org/changeset/ports/506355

Log:
  MFH: r506311 r506335 r506353 r506354

  Merge the latest round of changes to drm-kmod ports.
  In short, this updats maintainer addresses and adds fixes for a memory leak.

  Original commit messages below

  Change maintainer of all drm kmod ports to x11@

  Change maintainer of all drm kmod ports to x11@FreeBSD.org.  This way, PRs,
  notice about build breakages from package builds and so on goes to the
  entire x11@ team, and not just one member.

  Approved by:	jmd (maintainer)

  graphics/drm-kmod: Update supported versions

  Update supported versions and ports selection in graphics/drm-kmod.  This
  only affects current.

  Reviewed by:	jmd
  Sponsored by:	B3 Init

  graphics/drm-current-kmod: Update snapshot

  Update snapshot of graphics/drm-curent-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue:	#155
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  Sponsored by:	B3 Init (zeising)

  graphics/drm-fbsd12.0-kmod: Update snapshot

  Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue: #155
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  Sponsored by:	B3 Init (zeising)

  Approved by:	portmgr (drm drivers blanket)

Changes:
_U  branches/2019Q3/
  branches/2019Q3/graphics/drm-current-kmod/Makefile
  branches/2019Q3/graphics/drm-current-kmod/distinfo
  branches/2019Q3/graphics/drm-devel-kmod/Makefile
  branches/2019Q3/graphics/drm-fbsd11.2-kmod/Makefile
  branches/2019Q3/graphics/drm-fbsd12.0-kmod/Makefile
  branches/2019Q3/graphics/drm-fbsd12.0-kmod/distinfo
  branches/2019Q3/graphics/drm-kmod/Makefile
  branches/2019Q3/graphics/drm-legacy-kmod/Makefile
Comment 5 commit-hook freebsd_committer 2019-07-10 15:11:03 UTC
A commit references this bug:

Author: zeising
Date: Wed Jul 10 15:10:40 UTC 2019
New revision: 506355
URL: https://svnweb.freebsd.org/changeset/ports/506355

Log:
  MFH: r506311 r506335 r506353 r506354

  Merge the latest round of changes to drm-kmod ports.
  In short, this updats maintainer addresses and adds fixes for a memory leak.

  Original commit messages below

  Change maintainer of all drm kmod ports to x11@

  Change maintainer of all drm kmod ports to x11@FreeBSD.org.  This way, PRs,
  notice about build breakages from package builds and so on goes to the
  entire x11@ team, and not just one member.

  Approved by:	jmd (maintainer)

  graphics/drm-kmod: Update supported versions

  Update supported versions and ports selection in graphics/drm-kmod.  This
  only affects current.

  Reviewed by:	jmd
  Sponsored by:	B3 Init

  graphics/drm-current-kmod: Update snapshot

  Update snapshot of graphics/drm-curent-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue:	#155
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  Sponsored by:	B3 Init (zeising)

  graphics/drm-fbsd12.0-kmod: Update snapshot

  Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue: #155
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  Sponsored by:	B3 Init (zeising)

  Approved by:	portmgr (drm drivers blanket)

Changes:
_U  branches/2019Q3/
  branches/2019Q3/graphics/drm-current-kmod/Makefile
  branches/2019Q3/graphics/drm-current-kmod/distinfo
  branches/2019Q3/graphics/drm-devel-kmod/Makefile
  branches/2019Q3/graphics/drm-fbsd11.2-kmod/Makefile
  branches/2019Q3/graphics/drm-fbsd12.0-kmod/Makefile
  branches/2019Q3/graphics/drm-fbsd12.0-kmod/distinfo
  branches/2019Q3/graphics/drm-kmod/Makefile
  branches/2019Q3/graphics/drm-legacy-kmod/Makefile
Comment 6 Niclas Zeising freebsd_committer 2019-07-29 12:33:57 UTC
This should be solved, closing this.

Please reopen this or open a new PR if the issue remains.
Comment 7 commit-hook freebsd_committer 2019-08-06 08:36:54 UTC
A commit references this bug:

Author: zeising
Date: Tue Aug  6 08:35:56 UTC 2019
New revision: 508236
URL: https://svnweb.freebsd.org/changeset/ports/508236

Log:
  graphics/drm-fbsd11.2-kmod: Update snapshot

  Update snapshot of graphics/drm-fbsd11.2-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue: #155
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  MFH:		2019Q3 (implicit, drm-drivers blanket)
  Sponsored by:	B3 Init (zeising)

Changes:
  head/graphics/drm-fbsd11.2-kmod/Makefile
  head/graphics/drm-fbsd11.2-kmod/distinfo
Comment 8 commit-hook freebsd_committer 2019-08-06 08:36:56 UTC
A commit references this bug:

Author: zeising
Date: Tue Aug  6 08:36:43 UTC 2019
New revision: 508237
URL: https://svnweb.freebsd.org/changeset/ports/508237

Log:
  MFH: r508236

  graphics/drm-fbsd11.2-kmod: Update snapshot

  Update snapshot of graphics/drm-fbsd11.2-kmod to include a fix for a memory
  leak.

  FreeBSD Graphics issue: #155
  			https://github.com/FreeBSDDesktop/kms-drm/issues/155
  PR:		238925
  Reported by:	Ting-Wei Lan
  Sponsored by:	B3 Init (zeising)

  Approved by:	portmgr (implicit, drm-drivers blanket)

Changes:
_U  branches/2019Q3/
  branches/2019Q3/graphics/drm-fbsd11.2-kmod/Makefile
  branches/2019Q3/graphics/drm-fbsd11.2-kmod/distinfo