Project

General

Profile

Bug #7379

blkdev leaks memory allocated at attach time

Added by Dan McDonald about 3 years ago. Updated about 3 years ago.

Status:
New
Priority:
High
Assignee:
-
Category:
driver - device drivers
Start date:
2016-09-14
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

A recent RTI, as part of its ::findleaks tests, found leaks that appear to be in the blkdev subsystem. The ::findleaks output is below.

> ::findleaks -d -v -f
findleaks:                maximum buffers => 33789051
findleaks:                 actual buffers => 33625282
mdb: [ffffd12ed0e90000, ffffd12f50e90000): couldn't read 16384 bytes at ffffd12f07e28000: only 12288 of 16384 bytes could be read
findleaks:
findleaks:             potential pointers => 2032702094
findleaks:                     dismissals => 1815865949    (89.3%)
findleaks:                         misses => 1380549       ( 0.0%)
findleaks:                           dups => 181830396     ( 8.9%)
findleaks:                        follows => 33625200      ( 1.6%)
findleaks:
findleaks:              peak memory usage => 792548 kB
findleaks:               elapsed CPU time => 99.2 seconds
findleaks:              elapsed wall time => 99.3 seconds
findleaks:
BYTES             LEAKED         VMEM_SEG CALLER
393256                 1 ffffd12f5d47f2b8 modinstall+0x113
393256                 1 ffffd12ddbc1fcb8 modinstall+0x113
------------------------------------------------------------------------
           Total       2 kmem_oversize leaks, 786512 bytes

CACHE             LEAKED           BUFCTL CALLER
ffffd12678475008       8 ffffd12f51882438 bd_create_errstats+0x35f
ffffd12678489008       4 ffffd12f540d7af8 bd_errstats_setstr+0x76
ffffd1267847d008      24 ffffd12f55c5c800 bd_errstats_setstr+0x76
ffffd12678479008      24 ffffd12f55bc92f0 bd_errstats_setstr+0x76
ffffd12678489008      20 ffffd12f53e1be00 bd_errstats_setstr+0x76
------------------------------------------------------------------------
           Total      80 buffers, 2176 bytes

kmem_oversize leak: 1 vmem_seg, 393256 bytes
            ADDR TYPE            START              END             SIZE
                                THREAD        TIMESTAMP
ffffd12f5d47f2b8 ALLC ffffd13053941000 ffffd130539a1028           393256
                      ffffd005dd585c40     2cd091a913e0
                 vmem_hash_insert+0xae
                 vmem_seg_alloc+0x23e
                 vmem_xalloc+0x749
                 vmem_alloc+0x145
                 kmem_alloc+0x173
                 kmem_zalloc+0xed
                 0xfffffffff82810d5
                 0xfffffffff8280e4b
                 0xfffffffff827d37e
                 0xfffffffff827cf75
                 0xfffffffff82b16b2
                 0xfffffffff8293f3d
                 modinstall+0x113
                 mod_hold_installed_mod+0x77
                 modrload+0xdd
                 modload+0x17
                 mod_hold_dev_by_major+0xbf
                 ndi_hold_driver+0x30
                 probe_node+0x52
                 i_ndi_config_node+0x110

kmem_oversize leak: 1 vmem_seg, 393256 bytes
            ADDR TYPE            START              END             SIZE
                                THREAD        TIMESTAMP
ffffd12ddbc1fcb8 ALLC ffffd12f60ce1000 ffffd12f60d41028           393256
                      ffffd005e1d4fc40     2cc2da749e68
                 vmem_hash_insert+0xae
                 vmem_seg_alloc+0x23e
                 vmem_xalloc+0x749
                 vmem_alloc+0x145
                 kmem_alloc+0x173
                 kmem_zalloc+0xed
                 0xfffffffff82940d5
                 0xfffffffff8293e4b
                 0xfffffffff829037e
                 0xfffffffff828ff75
                 0xfffffffff82c46b2
                 0xfffffffff82a6f3d
                 modinstall+0x113
                 mod_hold_installed_mod+0x77
                 modrload+0xdd
                 modload+0x17
                 mod_hold_dev_by_major+0xbf
                 ndi_hold_driver+0x30
                 probe_node+0x52
                 i_ndi_config_node+0x110

kmem_alloc_8 leak: 8 buffers, 8 bytes each, 64 bytes total
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
ffffd12f51882438 ffffd12f5128ae20     2cc2aa2b7d05 ffffd005e2269c40
                 ffffd12678475008 ffffd127aec20000 ffffd12b5e56d930
                 kmem_cache_alloc_debug+0x2e0
                 kmem_cache_alloc+0xdd
                 kmem_zalloc+0x47
                 bd_create_errstats+0x35f
                 bd_attach+0x3bb
                 devi_attach+0x9e
                 attach_node+0x14f
                 i_ndi_config_node+0xc0
                 i_ddi_attachchild+0x88
                 devi_attach_node+0x88
                 ndi_devi_online+0xb0
                 bd_attach_handle+0xc2
                 nvme_attach+0x511
                 devi_attach+0x9e
                 attach_node+0x14f

kmem_alloc_48 leak: 4 buffers, 48 bytes each, 192 bytes total
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
ffffd12f540d7af8 ffffd12f53f40d88     2cc2c1bf790e ffffd005e265dc40
                 ffffd12678489008 ffffd127a4e14740                0
                 kmem_cache_alloc_debug+0x2e0
                 kmem_cache_alloc+0x320
                 kmem_alloc+0x4b
                 bd_errstats_setstr+0x76
                 bd_init_errstats+0xeb
                 bd_attach+0x3ca
                 devi_attach+0x9e
                 attach_node+0x14f
                 i_ndi_config_node+0xc0
                 i_ddi_attachchild+0x88
                 devi_attach_node+0x88
                 ndi_devi_online+0xb0
                 bd_attach_handle+0xc2
                 nvme_attach+0x511
                 devi_attach+0x9e

kmem_alloc_24 leak: 24 buffers, 24 bytes each, 576 bytes total
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
ffffd12f55c5c800 ffffd12f56b6b030     2cc2aa2b86ba ffffd005e2269c40
                 ffffd1267847d008 ffffd127aec20240 ffffd12b5e56d980
                 kmem_cache_alloc_debug+0x2e0
                 kmem_cache_alloc+0xdd
                 kmem_alloc+0x4b
                 bd_errstats_setstr+0x76
                 bd_init_errstats+0xba
                 bd_attach+0x3ca
                 devi_attach+0x9e
                 attach_node+0x14f
                 i_ndi_config_node+0xc0
                 i_ddi_attachchild+0x88
                 devi_attach_node+0x88
                 ndi_devi_online+0xb0
                 bd_attach_handle+0xc2
                 nvme_attach+0x511
                 devi_attach+0x9e

kmem_alloc_16 leak: 24 buffers, 16 bytes each, 384 bytes total
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
ffffd12f55bc92f0 ffffd12f55e7d7b8     2cc2aa2b855a ffffd005e2269c40
                 ffffd12678479008 ffffd127aec20180 ffffd12b5e56d9d0
                 kmem_cache_alloc_debug+0x2e0
                 kmem_cache_alloc+0xdd
                 kmem_alloc+0x4b
                 bd_errstats_setstr+0x76
                 bd_init_errstats+0x9e
                 bd_attach+0x3ca
                 devi_attach+0x9e
                 attach_node+0x14f
                 i_ndi_config_node+0xc0
                 i_ddi_attachchild+0x88
                 devi_attach_node+0x88
                 ndi_devi_online+0xb0
                 bd_attach_handle+0xc2
                 nvme_attach+0x511
                 devi_attach+0x9e

kmem_alloc_48 leak: 20 buffers, 48 bytes each, 960 bytes total
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
ffffd12f53e1be00 ffffd12f53f46608     2cc2aa2b83c8 ffffd005e2269c40
                 ffffd12678489008 ffffd127aec200c0 ffffd12b5e569938
                 kmem_cache_alloc_debug+0x2e0
                 kmem_cache_alloc+0xdd
                 kmem_alloc+0x4b
                 bd_errstats_setstr+0x76
                 bd_init_errstats+0xeb
                 bd_attach+0x3ca
                 devi_attach+0x9e
                 attach_node+0x14f
                 i_ndi_config_node+0xc0
                 i_ddi_attachchild+0x88
                 devi_attach_node+0x88
                 ndi_devi_online+0xb0
                 bd_attach_handle+0xc2
                 nvme_attach+0x511
                 devi_attach+0x9e

History

#1

Updated by Hans Rosenfeld about 3 years ago

These are long strings (dynamically allocated) associated with the error kstats. I wonder why findleaks would classify them as leaks, because the kstats do have references on them.

Also available in: Atom PDF