From: Ido Yariv <ido@wizery.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] genirq: Flush the irq thread on synchronization
Date: Sun, 4 Dec 2011 21:09:32 +0200 [thread overview]
Message-ID: <20111204190932.GO32400@WorkStation> (raw)
In-Reply-To: <alpine.LFD.2.02.1112022345300.2735@ionos>
Hi Thomas,
On Sat, Dec 03, 2011 at 12:21:46AM +0100, Thomas Gleixner wrote:
> I can see your problem, but this might lead to threads_active leaks
> under certain conditions. desc->threads_active was only meant to deal
> with shared interrupts.
>
> We explicitely allow a design where the primary handler can leave the
> device interrupt enabled and allow further interrupts to occur while
> the handler is running. We only have a single bit to note that the
> thread should run, but your wakeup would up the threads_active count
> in that scenario several times w/o a counterpart which decrements it.
>
> The solution for this is to keep the current threads_active semantics
> and make the wait function different. Instead of waiting for
> threads_active to become 0 it should wait for threads_active == 0 and
> the IRQTF_RUNTHREAD for all actions to be cleared. To avoid looping
> over the actions, we can take a similar approach as we take with the
> desc->threads_oneshot bitfield.
Thanks for reviewing this.
I might be missing something, but I don't see any potential
threads_active leaks in this approach. We wont increase threads_active
if IRQTF_RUNTHREAD was already set beforehand (as test_and_set_bit()
will return 1).
If irq_wake_thread is called multiple times before irq_thread has had a
chance to run, threads_active will only be increased once and decreased
back when IRQTF_RUNTHREAD is cleared.
Am I missing something? If not, do you see any other issues with this
implementation?
Thanks,
Ido.
next prev parent reply other threads:[~2011-12-04 19:09 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 [this message]
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
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=20111204190932.GO32400@WorkStation \
--to=ido@wizery.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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).