mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Vinod Koul <vinod.koul@intel.com>, Jon Hunter <jon-hunter@ti.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] dma:of: Use a mutex to protect the of_dma_list
Date: Fri, 19 Apr 2013 13:04:54 +0200	[thread overview]
Message-ID: <517124D6.7090008@metafoo.de> (raw)
In-Reply-To: <201304191213.48631.arnd@arndb.de>

On 04/19/2013 12:13 PM, Arnd Bergmann wrote:
> On Friday 19 April 2013, Lars-Peter Clausen wrote:
> 
>> This is rather ugly and unnecessary and non of the current users of
>> of_dma_controller_free() check it's return value anyway. Instead protect the
>> list by a mutex. The mutex will be held as long as a request operation is in
>> progress. So if of_dma_controller_free() is called while a request operation is
>> in progress it will be put to sleep and only wake up once the request operation
>> has finished.
>>
>> This means that it is no longer possible to register or unregister OF DMA
>> controllers from a context where it's not possible to sleep. But I doubt that
>> we'll ever need this.
>>
>> Also rename of_dma_get_controller back to of_dma_find_controller.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> 
> I guess we could also fix it by turning the reference count into a proper
> kref with kref_put calling the destructor, but your solution seems to solve
> the problem just as well.

Well, It's not only about the of_dma struct, e.g. the of_dma's of_dma_data
field usually points to some driver allocated data. If we do not block in
of_dma_controller_free() this data might be freed while the controller is
still in use.

  reply	other threads:[~2013-04-19 11:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19  9:42 [PATCH 1/2] dma: of: Fix of_node reference leak Lars-Peter Clausen
2013-04-19  9:42 ` [PATCH 2/2] dma:of: Use a mutex to protect the of_dma_list Lars-Peter Clausen
2013-04-19 10:13   ` Arnd Bergmann
2013-04-19 11:04     ` Lars-Peter Clausen [this message]
2013-04-19 12:25       ` Arnd Bergmann
2013-04-19 22:45   ` Jon Hunter
2013-04-19 23:13     ` Arnd Bergmann
2013-04-22  1:22       ` Jon Hunter
2013-04-20  7:28     ` Lars-Peter Clausen
2013-04-20 10:38       ` Arnd Bergmann
2013-04-22  1:18         ` Jon Hunter
2013-04-19 10:10 ` [PATCH 1/2] dma: of: Fix of_node reference leak Arnd Bergmann
2013-04-19 22:29   ` Jon Hunter
2013-05-02 16:24 ` 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=517124D6.7090008@metafoo.de \
    --to=lars@metafoo.de \
    --cc=arnd@arndb.de \
    --cc=jon-hunter@ti.com \
    --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

Powered by JetHome