From: Thomas Gleixner <tglx@linutronix.de>
To: Yong Zhang <yong.zhang0@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>,
linux-kernel@vger.kernel.org, ebiederm@xmission.com,
akpm@linux-foundation.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH]: use spin_lock_irqsave in try_one_irq()
Date: Wed, 4 Nov 2009 10:18:22 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.0911041016070.12138@localhost.localdomain> (raw)
In-Reply-To: <2674af740911030658m76b702cfxb67723984286c4bb@mail.gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1174 bytes --]
On Tue, 3 Nov 2009, Yong Zhang wrote:
> > This happens because the &desc->lock is taken with spin_lock_irqsave and
> > just a spin_lock. In the try_one_irq(), this lock really should be a
> > spin_lock_irqsave().
> >
>
> Cc'ed Ingo and Thomas.
>
> The reason is that try_one_irq() is called both from hardirq context and softirq
> context. And by default the timer handler poll_all_shared_irqs() is
> called with irq enabled.
> Then the two usage will cause inconsistent.
>
> So I think the following patch is also workable to you.
Yes, that's sufficient.
> diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
> index 114e704..11affbc 100644
> --- a/kernel/irq/spurious.c
> +++ b/kernel/irq/spurious.c
> @@ -111,6 +111,7 @@ static void poll_all_shared_irqs(void)
>
> for_each_irq_desc(i, desc) {
> unsigned int status;
> + unsigned long flags;
>
> if (!i)
> continue;
> @@ -121,7 +122,9 @@ static void poll_all_shared_irqs(void)
> if (!(status & IRQ_SPURIOUS_DISABLED))
> continue;
>
> + local_irq_save(flags);
> try_one_irq(i, desc);
> + local_irq_restore(flags);
You can even use local_irq_en/disable() here.
Thanks,
tglx
next prev parent reply other threads:[~2009-11-04 9:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-03 13:45 Prarit Bhargava
2009-11-03 14:58 ` Yong Zhang
2009-11-03 15:03 ` Prarit Bhargava
2009-11-04 9:18 ` Thomas Gleixner [this message]
2009-11-04 12:49 ` Yong Zhang
2009-11-04 13:01 ` Yong Zhang
2009-11-04 13:17 ` Prarit Bhargava
-- strict thread matches above, loose matches on Subject: below --
2009-10-26 18:35 Prarit Bhargava
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.0911041016070.12138@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=prarit@redhat.com \
--cc=yong.zhang0@gmail.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
all inboxes | Powered by JetHome®