All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: "홍신 shin hong" <hongshin@gmail.com>
Cc: linux-mmc@vger.kernel.org
Subject: Re: BUG? a suspected race bug at sdio_irq_thread()
Date: Mon, 07 Sep 2009 22:30:38 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0909072217160.6044@xanadu.home> (raw)
In-Reply-To: <2014bcab0909070315j67c5db31gff6bc70f0b6369a5@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1113 bytes --]

On Mon, 7 Sep 2009, 홍신 shin hong wrote:

> sdio_irq_therad() is spawned as a sdio_card_irq_get().
> This thread is stopped by sdio_card_irq_put().
> 
> sdio_irq_thread() finishes its do-while iteration
> when kthread_should_stop() returns true
> or a condition is satisfied (break statements at line 106)
> 
> For the later case, if sdio_irq_thread() is finished
> before kthread_should_stop() returns false.
> 
> In that situation, if other thread invokes kthread_stop(),
> the caller of kthread_stop() might have a problem (waiting indefinitely).

No.

First of all, you get one instance of sdio_irq_thread() for each card.  
And if a card has multiple functions, then multiple sdio_card_irq_get() 
and sdio_card_irq_put() are expected, and they should be balanced as 
well.

So, when the last user of SDIO card interrupt calls sdio_card_irq_put(), 
then kthread_stop() is called on the IRQ thread, meaning that the 
kthread_should_stop condition is made true and the thread awakened, and 
then its termination is waited for.  If the thread terminated itself 
then there is simply no waiting to do.


Nicolas

      reply	other threads:[~2009-09-08  2:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2014bcab0909022048n2c937af4l5bd38c501469b1c7@mail.gmail.com>
2009-09-07 10:15 ` BUG? a suspected race bug at sdio_irq_thread() 홍신 shin hong
2009-09-08  2:30   ` Nicolas Pitre [this message]

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=alpine.LFD.2.00.0909072217160.6044@xanadu.home \
    --to=nico@cam.org \
    --cc=hongshin@gmail.com \
    --cc=linux-mmc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.