From: ebiederm@xmission.com (Eric W. Biederman)
To: Loic Prylli <loic@myri.com>
Cc: linux-pci@atrey.karlin.mff.cuni.cz,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: MSI problem since 2.6.21 for devices not providing a mask in their MSI capability
Date: Thu, 04 Oct 2007 11:03:38 -0600 [thread overview]
Message-ID: <m1zlyyvml1.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <4704AEF1.3000206@myri.com> (Loic Prylli's message of "Thu, 04 Oct 2007 05:14:25 -0400")
Loic Prylli <loic@myri.com> writes:
I still looking through my copy of the pci specs and so will reply to
that part in a bit.
> To detect a crazy device generating storms of edge interrupts, I guess
> note_interrupt() could be called during this "reentrant detection" if
> masking was made conditional.
Hmm. Something like this?
Only mask it if the irq is disabled, and only disable it if
the user requests it or if note_interrupt decides we are screaming?
void handle_edge_irq(unsigned int irq, struct irq_desc *desc)
{
const unsigned int cpu = smp_processor_id();
spin_lock(&desc->lock);
desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
/*
* If we're currently running this IRQ, or its disabled,
* we shouldn't process the IRQ. Mark it pending, handle
* the necessary masking and go out
*/
if (unlikely((desc->status & IRQ_DISABLED) || !desc->action)){
desc->status |= (IRQ_PENDING | IRQ_MASKED);
mask_ack_irq(desc, irq);
goto out_unlock;
}
if (unlikely(desc->status & IRQ_INPROGRESS)) {
desc->status |= IRQ_PENDING;
desc->chip->ack(desc, irq);
note_interrupt(irq, desc, IRQ_NONE /* IRQ_DUP? */);
goto out_unlock;
}
kstat_cpu(cpu).irqs[irq]++;
/* Start handling the irq */
desc->chip->ack(irq);
/* Mark the IRQ currently in progress.*/
desc->status |= IRQ_INPROGRESS;
do {
struct irqaction *action = desc->action;
irqreturn_t action_ret;
if (unlikely(!action)) {
desc->chip->mask(irq);
goto out_unlock;
}
desc->status &= ~IRQ_PENDING;
spin_unlock(&desc->lock);
action_ret = handle_IRQ_event(irq, action);
if (!noirqdebug)
note_interrupt(irq, desc, action_ret);
spin_lock(&desc->lock);
} while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING);
desc->status &= ~IRQ_INPROGRESS;
out_unlock:
spin_unlock(&desc->lock);
}
Eric
prev parent reply other threads:[~2007-10-04 17:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-03 21:12 Loic Prylli
2007-10-03 21:49 ` Eric W. Biederman
2007-10-03 22:03 ` Benjamin Herrenschmidt
2007-10-03 22:25 ` Eric W. Biederman
2007-10-04 1:44 ` Loic Prylli
2007-10-04 3:58 ` Eric W. Biederman
2007-10-04 9:14 ` Loic Prylli
2007-10-04 17:03 ` Eric W. Biederman [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=m1zlyyvml1.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=loic@myri.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