From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
Michal Sojka <sojkam1@control.felk.cvut.cz>
Subject: [PATCH] Linux 2.6.x VM86 interrupt emulation fixes - the second round
Date: Tue, 26 Apr 2005 10:49:03 +0200 [thread overview]
Message-ID: <200504261049.04139.pisa@cmp.felk.cvut.cz> (raw)
In-Reply-To: <1102790805.8194.11.camel@localhost.localdomain>
Patch solves VM86 interrupt emulation deadlock on SMP systems.
The VM86 interrupt emulation has been heavily tested and works
well on UP systems after last update, but it seems to deadlock
when we have used it on SMP/HT boxes now.
It seems, that disable_irq() cannot be called from interrupts,
because it waits until disabled interrupt handler finishes
(/kernel/irq/manage.c:synchronize_irq():while(IRQ_INPROGRESS);).
This blocks one CPU after another. Solved by use disable_irq_nosync.
There is the second problem. If IRQ source is fast, it is possible,
that interrupt is sometimes processed and re-enabled by the second
CPU, before it is disabled by the first one, but negative IRQ disable
depths are not allowed. The spinlocking and disabling IRQs over
call to disable_irq_nosync/enable_irq is the only solution found
reliable till now.
Signed-off-by: Michal Sojka <sojkam1@control.felk.cvut.cz>
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Index: linux-2.6.11.5/arch/i386/kernel/vm86.c
===================================================================
--- linux-2.6.11.5.orig/arch/i386/kernel/vm86.c
+++ linux-2.6.11.5/arch/i386/kernel/vm86.c
@@ -732,12 +732,12 @@ static irqreturn_t irq_handler(int intno
irqbits |= irq_bit;
if (vm86_irqs[intno].sig)
send_sig(vm86_irqs[intno].sig, vm86_irqs[intno].tsk, 1);
- spin_unlock_irqrestore(&irqbits_lock, flags);
/*
* IRQ will be re-enabled when user asks for the irq (whether
* polling or as a result of the signal)
*/
- disable_irq(intno);
+ disable_irq_nosync(intno);
+ spin_unlock_irqrestore(&irqbits_lock, flags);
return IRQ_HANDLED;
out:
@@ -769,17 +769,20 @@ static inline int get_and_reset_irq(int
{
int bit;
unsigned long flags;
+ int ret = 0;
if (invalid_vm86_irq(irqnumber)) return 0;
if (vm86_irqs[irqnumber].tsk != current) return 0;
spin_lock_irqsave(&irqbits_lock, flags);
bit = irqbits & (1 << irqnumber);
irqbits &= ~bit;
+ if (bit) {
+ enable_irq(irqnumber);
+ ret = 1;
+ }
+
spin_unlock_irqrestore(&irqbits_lock, flags);
- if (!bit)
- return 0;
- enable_irq(irqnumber);
- return 1;
+ return ret;
}
next prev parent reply other threads:[~2005-04-26 8:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-09 13:59 VM86 interrupt emulation breakage and FIXes for 2.6.x kernel series Pavel Pisa
2004-12-09 16:09 ` Linus Torvalds
2004-12-10 21:05 ` Alan Cox
2004-12-10 22:55 ` Linus Torvalds
2004-12-10 23:58 ` Alan Cox
2004-12-11 1:23 ` Linus Torvalds
2004-12-11 0:57 ` Alan Cox
2004-12-11 2:30 ` Pavel Pisa
2004-12-11 4:21 ` Linus Torvalds
2004-12-11 14:19 ` Alan Cox
2004-12-11 18:45 ` Linus Torvalds
2004-12-11 18:46 ` Alan Cox
2005-04-26 8:49 ` Pavel Pisa [this message]
2004-12-11 2:07 ` Pavel Pisa
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=200504261049.04139.pisa@cmp.felk.cvut.cz \
--to=pisa@cmp.felk.cvut.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=sojkam1@control.felk.cvut.cz \
--cc=torvalds@osdl.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