public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jaswinder Singh Rajput <jaswinder@kernel.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: kmemleak issues in alsa
Date: Sun, 19 Jul 2009 14:07:00 +0200	[thread overview]
Message-ID: <s5h4ot8op0b.wl%tiwai@suse.de> (raw)
In-Reply-To: <1247861644.4513.15.camel@ht.satnam>

At Sat, 18 Jul 2009 01:44:04 +0530,
Jaswinder Singh Rajput wrote:
> 
> I was getting these kmemleak reports when I build SND_SEQUENCER in
> kernel :
> 
> unreferenced object 0xf6b0ac00 (size 512):
>   comm "swapper", pid 1, jiffies 4294671240
>   hex dump (first 32 bytes):
>     02 00 00 00 03 4f 53 53 20 73 65 71 75 65 6e 63  .....OSS sequenc
>     65 72 00 00 00 00 00 00 00 00 00 00 00 00 00 00  er..............
>   backtrace:
>     [<c12d7d83>] kmemleak_alloc+0x25/0x49
>     [<c109350d>] kmem_cache_alloc+0x95/0x124
>     [<c12568f0>] seq_create_client1+0x1d/0x165
>     [<c1257b01>] snd_seq_create_kernel_client+0x68/0xe7
>     [<c14c966f>] snd_seq_oss_create_client+0x86/0x143
>     [<c14c958a>] alsa_seq_oss_init+0xf8/0x157
>     [<c100104f>] do_one_initcall+0x4a/0x111
>     [<c14a8608>] kernel_init+0x16b/0x1bc
>     [<c100352b>] kernel_thread_helper+0x7/0x1a
>     [<ffffffff>] 0xffffffff
> unreferenced object 0xf6b08700 (size 128):
>   comm "swapper", pid 1, jiffies 4294671240
>   hex dump (first 32 bytes):
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<c12d7d83>] kmemleak_alloc+0x25/0x49
>     [<c109350d>] kmem_cache_alloc+0x95/0x124
>     [<c12591a3>] snd_seq_pool_new+0x17/0xbe
>     [<c1256955>] seq_create_client1+0x82/0x165
>     [<c1257b01>] snd_seq_create_kernel_client+0x68/0xe7
>     [<c14c966f>] snd_seq_oss_create_client+0x86/0x143
>     [<c14c958a>] alsa_seq_oss_init+0xf8/0x157
>     [<c100104f>] do_one_initcall+0x4a/0x111
>     [<c14a8608>] kernel_init+0x16b/0x1bc
>     [<c100352b>] kernel_thread_helper+0x7/0x1a
>     [<ffffffff>] 0xffffffff
> unreferenced object 0xf6b0aa00 (size 512):
>   comm "swapper", pid 1, jiffies 4294671246
>   hex dump (first 32 bytes):
>     0f 00 00 00 00 00 00 00 52 65 63 65 69 76 65 72  ........Receiver
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<c12d7d83>] kmemleak_alloc+0x25/0x49
>     [<c109350d>] kmem_cache_alloc+0x95/0x124
>     [<c125bdf9>] snd_seq_create_port+0x4c/0x197
>     [<c1257589>] snd_seq_ioctl_create_port+0x52/0x141
>     [<c1256bb3>] snd_seq_do_ioctl+0x59/0x78
>     [<c1256c11>] snd_seq_kernel_client_ctl+0x2f/0x48
>     [<c14c96e1>] snd_seq_oss_create_client+0xf8/0x143
>     [<c14c958a>] alsa_seq_oss_init+0xf8/0x157
>     [<c100104f>] do_one_initcall+0x4a/0x111
>     [<c14a8608>] kernel_init+0x16b/0x1bc
>     [<c100352b>] kernel_thread_helper+0x7/0x1a
>     [<ffffffff>] 0xffffffff
> 
> But when I build SND_SEQUENCER as module these kmemleak issues
> disappear.
> 
> Then I noticed that issue was in ordering. 
> 
> When build in kernel flow is like this :
> 
> OSS sequencer(alsa_seq_oss_init) -> System (snd_seq_system_client_init)
> 
> When build as modules flow is like this :
> 
> System(snd_seq_system_client_init) -> OSS sequencer(alsa_seq_oss_init)
> 
> So this fixes above kmemleak issues in my case, I hope it will be
> helpful :
> 
> diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c
> index f25e3cc..3ddf2c2 100644
> --- a/sound/core/seq/oss/seq_oss.c
> +++ b/sound/core/seq/oss/seq_oss.c
> @@ -116,7 +116,7 @@ static void __exit alsa_seq_oss_exit(void)
>  	unregister_device();
>  }
>  
> -module_init(alsa_seq_oss_init)
> +late_initcall(alsa_seq_oss_init);
>  module_exit(alsa_seq_oss_exit)

Thanks for checking this.

Another option would be to fix Makefile.  I guess simply putting the
line including sound/core/seq/oss/Makefile after the definitions of
other seq modules would do the same thing...


Takashi

  reply	other threads:[~2009-07-19 12:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17 20:14 kmemleak issues in alsa Jaswinder Singh Rajput
2009-07-19 12:07 ` Takashi Iwai [this message]
2009-07-19 15:26   ` Jaswinder Singh Rajput
2009-07-19 16:02     ` Takashi Iwai
2009-07-19 16:28       ` [PATCH] SOUND: OSS sequencer should be initialized after snd_seq_system_client_init Jaswinder Singh Rajput
2009-07-19 17:10         ` Takashi Iwai
2009-07-19 22:19         ` Catalin Marinas
2009-07-20  5:02           ` Jaswinder Singh Rajput

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h4ot8op0b.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=catalin.marinas@arm.com \
    --cc=jaswinder@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox