NetBSD Problem Report #55089

From tsutsui@ceres.dti.ne.jp  Fri Mar 20 01:30:35 2020
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6CF581A9213
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 20 Mar 2020 01:30:35 +0000 (UTC)
Message-Id: <202003200130.02K1UNum013811@ceres.dti.ne.jp>
Date: Fri, 20 Mar 2020 10:30:23 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Possible kernel memory leak in radeondrmkms on 9.0
X-Send-Pr-Version: 3.95

>Number:         55089
>Category:       kern
>Synopsis:       Possible kernel memory leak in radeondrmkms on 9.0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 20 01:35:00 +0000 2020
>Last-Modified:  Fri Mar 20 04:55:01 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0
>Organization:
>Environment:
System: NetBSD mirage 9.0 NetBSD 9.0 (GENERIC) #17: Sun Mar 8 12:57:12 JST 2020 tsutsui@mirage:/s/netbsd-9/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
I noticed 'vmstat -m' shows:
- a number of kmem-96 "Requests" is so large
- "Releases" count is very small

---
Memory resource pool statistics
Name        Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
kmem-96       96   298899    0      131  7114     0  7114  7114     0   inf    0
ffsdino2     256    45037    0        1  2815     0  2815  2815     0   inf    0
kmem-1024   1024    10360    0       36  2581     0  2581  2581     0   inf    0
kmem-768     768    15085    0     6385  2425     0  2425  2425     0   inf  353
vcachepl     196    45645    0        0  2283     0  2283  2283     0   inf    0

 :
---

This can be observed on HD5450 machine, not on Atom N455 netbook.

>How-To-Repeat:
- boot NetBSD/i386 9.0 on HD5450
- start Xorg (with a patch in PR/54782)
- see kmem-96 usage by 'vmstat -m 1 | grep kmem-96' etc.
- perform scrolls (cat large logs, build.sh etc.) on pseudo terminals
  (xterm, kterm, or mlterm etc.)

---
kmem-96       96   288641    0      131  6870     0  6870  6870     0   inf    0
kmem-96       96   288642    0      131  6870     0  6870  6870     0   inf    0
kmem-96       96   288648    0      131  6870     0  6870  6870     0   inf    0
kmem-96       96   288651    0      131  6870     0  6870  6870     0   inf    0
kmem-96       96   288651    0      131  6870     0  6870  6870     0   inf    0
kmem-96       96   288651    0      131  6870     0  6870  6870     0   inf    0
kmem-96       96   288659    0      131  6870     0  6870  6870     0   inf    0

[start scroll on other terminal]

kmem-96       96   288705    0      131  6871     0  6871  6871     0   inf    0
kmem-96       96   289505    0      131  6890     0  6890  6890     0   inf    0
kmem-96       96   290537    0      131  6915     0  6915  6915     0   inf    0
kmem-96       96   291363    0      131  6935     0  6935  6935     0   inf    0
kmem-96       96   292165    0      131  6954     0  6954  6954     0   inf    0
kmem-96       96   293017    0      131  6974     0  6974  6974     0   inf    0
kmem-96       96   293871    0      131  6994     0  6994  6994     0   inf    0
kmem-96       96   294756    0      131  7015     0  7015  7015     0   inf    0
kmem-96       96   295668    0      131  7037     0  7037  7037     0   inf    0
kmem-96       96   296561    0      131  7058     0  7058  7058     0   inf    0
kmem-96       96   297456    0      131  7080     0  7080  7080     0   inf    0

[stop scrolling]

kmem-96       96   297462    0      131  7080     0  7080  7080     0   inf    0
kmem-96       96   297462    0      131  7080     0  7080  7080     0   inf    0
kmem-96       96   297757    0      131  7087     0  7087  7087     0   inf    0
^C
---

>Fix:
No idea.

---
Izumi Tsutsui

>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: kern/55089: Possible kernel memory leak in radeondrmkms on 9.0
Date: Fri, 20 Mar 2020 11:02:46 +0900

 On NetBSD/amd64 9.0, it seems to use kmem-160 instead of kmem-96 on i386:

 ---
 kmem-160     160   117347    0        0  4694     0  4694  4694     0   inf    0
 kmem-160     160   119586    0        0  4784     0  4784  4784     0   inf    0
 kmem-160     160   121640    0        0  4866     0  4866  4866     0   inf    0
 kmem-160     160   123731    0        0  4950     0  4950  4950     0   inf    0
 kmem-160     160   125666    0        0  5027     0  5027  5027     0   inf    0
 kmem-160     160   127428    0        0  5098     0  5098  5098     0   inf    0
 kmem-160     160   128860    0        0  5155     0  5155  5155     0   inf    0
 kmem-160     160   128860    0        0  5155     0  5155  5155     0   inf    0
 kmem-160     160   128860    0        0  5155     0  5155  5155     0   inf    0
 kmem-160     160   128863    0        0  5155     0  5155  5155     0   inf    0
 kmem-160     160   128873    0        0  5155     0  5155  5155     0   inf    0
 ---

 So kmem_alloc(9) for structures with pointers?

 ---
 Izumi Tsutsui

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: re: kern/55089: Possible kernel memory leak in radeondrmkms on 9.0
Date: Fri, 20 Mar 2020 15:52:03 +1100

 >  On NetBSD/amd64 9.0, it seems to use kmem-160 instead of kmem-96 on i386:

 this matches my experience, and also dholland's i believe.

 i never quite figured out which ones were the right ones,
 and dtrace seemed the best way to find out..


 .mrg.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.