From: Viresh Kumar <viresh.kumar@linaro.org>
To: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
linaro-kernel@lists.linaro.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: device must have at least one channel
Date: Wed, 27 Jul 2016 21:48:24 -0700 [thread overview]
Message-ID: <20160728044824.GS6869@ubuntu> (raw)
In-Reply-To: <20160728034843.GI9681@localhost>
On 28-07-16, 09:18, Vinod Koul wrote:
> On Wed, Jul 27, 2016 at 02:32:58PM -0700, Viresh Kumar wrote:
> > The DMA device can't be registered if it doesn't have any channels
> > registered at all. Moreover, it leads to memory leak and is reported by
> > kmemleak as (on 3.10 kernel, and same shall happen on mainline):
> >
> > unreferenced object 0xffffffc09e597240 (size 64):
> > comm "swapper/0", pid 1, jiffies 4294877736 (age 7060.280s)
> > hex dump (first 32 bytes):
> > 00 00 00 00 c0 ff ff ff 30 00 00 ff 00 00 00 ff ........0.......
> > 00 00 00 ff 00 00 00 ff 00 00 00 ff 00 00 00 ff ................
> > backtrace:
> > [<ffffffc0003079ec>] create_object+0x148/0x2a0
> > [<ffffffc000cc150c>] kmemleak_alloc+0x80/0xbc
> > [<ffffffc000303a7c>] kmem_cache_alloc_trace+0x120/0x1ac
> > [<ffffffc00054771c>] dma_async_device_register+0x160/0x46c
> > [<ffffffc000548958>] foo_probe+0x1a0/0x264
> > [<ffffffc0005d6658>] platform_drv_probe+0x14/0x20
> > [<ffffffc0005d50cc>] driver_probe_device+0x160/0x374
> > [<ffffffc0005d538c>] __driver_attach+0x60/0x90
> > [<ffffffc0005d3e78>] bus_for_each_dev+0x7c/0xb0
> > [<ffffffc0005d4a0c>] driver_attach+0x1c/0x28
> > [<ffffffc0005d459c>] bus_add_driver+0x124/0x248
> > [<ffffffc0005d59cc>] driver_register+0x90/0x110
> > [<ffffffc0005d6bf4>] platform_driver_register+0x58/0x64
> > [<ffffffc00142a70c>] foo_driver_init+0x10/0x1c
> > [<ffffffc000200878>] do_one_initcall+0xac/0x148
> > [<ffffffc00140096c>] kernel_init_freeable+0x1a0/0x258
> >
> > Return -ENODEV from dma_async_device_register() on such a case.
> >
> > /Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> > Hi Vinod,
> >
> > Sorry if the fundamentals behind this patch are completely incorrect,
> > i.e. We *can't* register a dma device with 0 channels. Its been long
> > that I have worked on dma stuff :)
>
> This sounds okay,
Great..
> but why would anyone register a device without having
> a channel?
A buggy driver? The core should be handling this no matter what,
right?
The out of tree driver, 3.10 based driver I have looks to be buggy to
me. It is doing something like this (please ignore naming/formatting):
xlate()
{
chan = alloc();
list_add(chan.device_node, &dma_dev.channels)
}
probe()
{
...
dma_async_device_register()
of_dma_controller_register(xlate);
...
}
But with this it looks like the 'chan' structure wouldn't get
initialized properly as that is done from within
dma_async_device_register(). Right? Also, I am not sure if DMA is
getting used at all right now on my platform. Just noticed the
memleak, which I tried to fix.
--
viresh
next prev parent reply other threads:[~2016-07-28 4:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 21:32 [PATCH] dmaengine: device must have at least one channel Viresh Kumar
2016-07-28 3:48 ` Vinod Koul
2016-07-28 4:48 ` Viresh Kumar [this message]
2016-08-03 19:34 ` Greg Kroah-Hartman
2016-08-05 16:30 ` Viresh Kumar
2016-08-08 8:17 ` Vinod Koul
2016-08-08 15:24 ` Viresh Kumar
2016-08-08 17:06 ` Greg Kroah-Hartman
2016-08-08 17:08 ` Viresh Kumar
2016-08-22 6:19 ` Vinod Koul
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=20160728044824.GS6869@ubuntu \
--to=viresh.kumar@linaro.org \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vinod.koul@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).