public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Ido Yariv <ido@wizery.com>
Cc: Alexander Gordeev <agordeev@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [tip:irq/core] genirq: Flush the irq thread on synchronization
Date: Fri, 16 Mar 2012 11:06:52 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.02.1203161102190.2466@ionos> (raw)
In-Reply-To: <20120315225952.GA18032@WorkStation>

On Fri, 16 Mar 2012, Ido Yariv wrote:
> On Thu, Mar 15, 2012 at 08:07:56PM +0100, Alexander Gordeev wrote:
> > Nevertheless, wake_threads_waitq() gets called and desc->threads_active gets
> > decremented. As result, if desc->threads_active initially was decremented, we
> > might wrongly wake up the queue while some threaded handler is still running.
> > 
> > By contrast, if we choose not to wake up here, we might stuck in
> > synchronize_irq(). Which is probably better than a fooling synchronize_irq().
> 
> AFAICT, IRQTF_RUNTHREAD and the desc->threads_active are always modified
> together:
> desc->threads_active is incremented if and only if IRQTF_RUNTHREAD is
> set after being cleared (in irq_wake_thread()).
> desc->threads_active is decremented in wake_threads_waitq(), which is
> only called when IRQTF_RUNTHREAD is cleared.
> 
> It seems that if we get to this point, either IRQTF_RUNTHREAD is set and
> desc->threads_active was not decremented, or it is not set.
> 
> Do you see any case where the two will be out of sync?

There is really no way, that the flag is set when we come out this
regular exit path.

__free_irq()
	remove action
	synchronize_irq()
	kthread_stop()

So after the action is removed and synchronize_irq() made sure that
the thread has finished IRQTF_RUNTHREAD cannot be set. Neither can we
have a stale threads_oneshot bit set from this action.

That's a leftover of the old code and I really did not think it
through fully and kept the stuff along with paranoid warnings.

I'm going to remove all of it.

Thanks,

	tglx

  reply	other threads:[~2012-03-16 10:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 16:24 [RFC] genirq: Flush the irq thread on synchronization Ido Yariv
2011-12-02 23:21 ` Thomas Gleixner
2011-12-04 19:09   ` Ido Yariv
2011-12-16 10:48     ` Ido Yariv
2012-02-13  9:43       ` Ido Yariv
2012-02-15 14:34         ` Thomas Gleixner
2012-03-01 10:54           ` Ido Yariv
2011-12-05 21:55   ` Thomas Gleixner
2011-12-06 23:28     ` Ido Yariv
2011-12-07  0:48       ` Thomas Gleixner
2011-12-07  8:21         ` Ido Yariv
2012-03-14 11:07 ` [tip:irq/core] " tip-bot for Ido Yariv
2012-03-15 19:07   ` Alexander Gordeev
2012-03-15 19:27     ` Thomas Gleixner
2012-03-15 22:59     ` Ido Yariv
2012-03-16 10:06       ` Thomas Gleixner [this message]
2012-03-16 10:34     ` [tip:irq/core] genirq: Remove paranoid warnons and bogus fixups tip-bot for Thomas Gleixner

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.02.1203161102190.2466@ionos \
    --to=tglx@linutronix.de \
    --cc=agordeev@redhat.com \
    --cc=ido@wizery.com \
    --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