DMA Engine development
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: madhuparnabhowmik10@gmail.com, dan.j.williams@intel.com,
	vkoul@kernel.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org, andrianov@ispras.ru,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] drivers/dma/dma-jz4780: Fix race condition between probe and irq handler
Date: Thu, 20 Aug 2020 20:46:43 +0200	[thread overview]
Message-ID: <VHLDFQ.HR10VPMY1GHD3@crapouillou.net> (raw)
In-Reply-To: <e1961c04-e2aa-fe3a-fb84-bb3b33fae5dc@metafoo.de>



Le jeu. 20 août 2020 à 20:23, Lars-Peter Clausen <lars@metafoo.de> a 
écrit :
> On 8/20/20 1:59 PM, Paul Cercueil wrote:
>> Hi,
>> 
>> Le dim. 16 août 2020 à 12:52, madhuparnabhowmik10@gmail.com a 
>> écrit :
>>> From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
>>> 
>>> In probe IRQ is requested before zchan->id is initialized which can 
>>> be
>>> read in the irq handler. Hence, shift request irq and enable clock 
>>> after
>>> other initializations complete. Here, enable clock part is not part 
>>> of
>>> the race, it is just shifted down after request_irq to keep the 
>>> error
>>> path same as before.
>>> 
>>> Found by Linux Driver Verification project (linuxtesting.org).
>>> 
>>> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
>> 
>> I don't think there is a race at all, the interrupt handler won't be 
>> \x7fcalled before the DMA is registered.
>> 
> From a purely formal verification perspective there is a bug. The 
> interrupt could fire if i.e. the hardware is buggy or something. In 
> general it is a good idea to not request the IRQ until all the 
> resources that are used in the interrupt handler are properly set up. 
> Even if you know that in practice the interrupt will never fire this 
> early.
> 

Fair enough, I'm fine with that, but the patch should be reworked so 
that the clk_prepare_enable() call is not moved.

Cheers,
-Paul



  reply	other threads:[~2020-08-20 18:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16  7:22 [PATCH] drivers/dma/dma-jz4780: Fix race condition between probe and irq handler madhuparnabhowmik10
2020-08-20 11:59 ` Paul Cercueil
2020-08-20 17:52   ` Madhuparna Bhowmik
2020-08-20 18:23   ` Lars-Peter Clausen
2020-08-20 18:46     ` Paul Cercueil [this message]
2020-08-21  3:16       ` Madhuparna Bhowmik

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=VHLDFQ.HR10VPMY1GHD3@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=andrianov@ispras.ru \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madhuparnabhowmik10@gmail.com \
    --cc=vkoul@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