From: "Jan Beulich" <jbeulich@novell.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] linux: mor assign_irq_vector() adjustments
Date: Tue, 25 Apr 2006 14:38:47 +0200 [thread overview]
Message-ID: <444E3477.76E4.0078.0@novell.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 245 bytes --]
Instead of adding locking to also protect irq_vector[] in xenlinux, this patch adds verification that the vector passed
up from Xen for a certain IRQ is matching a potential previously obtained value. Besides that, two minor cleanup hunks.
Jan
[-- Attachment #2: xenlinux-x86-assign_irq_vector.patch --]
[-- Type: text/plain, Size: 1827 bytes --]
Index: head-2006-04-24/arch/i386/kernel/io_apic-xen.c
===================================================================
--- head-2006-04-24.orig/arch/i386/kernel/io_apic-xen.c 2006-04-25 12:14:36.000000000 +0200
+++ head-2006-04-24/arch/i386/kernel/io_apic-xen.c 2006-04-25 13:11:31.000000000 +0200
@@ -1207,7 +1207,7 @@ int assign_irq_vector(int irq)
{
physdev_op_t op;
- BUG_ON(irq >= NR_IRQ_VECTORS);
+ BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
return IO_APIC_VECTOR(irq);
@@ -1217,8 +1217,11 @@ int assign_irq_vector(int irq)
return -ENOSPC;
vector_irq[op.u.irq_op.vector] = irq;
- if (irq != AUTO_ASSIGN)
- IO_APIC_VECTOR(irq) = op.u.irq_op.vector;
+ if (irq != AUTO_ASSIGN) {
+ u8 vector = cmpxchg(&IO_APIC_VECTOR(irq), 0, op.u.irq_op.vector);
+
+ BUG_ON(vector && vector != op.u.irq_op.vector);
+ }
return op.u.irq_op.vector;
}
Index: head-2006-04-24/arch/x86_64/kernel/io_apic-xen.c
===================================================================
--- head-2006-04-24.orig/arch/x86_64/kernel/io_apic-xen.c 2006-04-25 12:14:36.000000000 +0200
+++ head-2006-04-24/arch/x86_64/kernel/io_apic-xen.c 2006-04-25 13:11:31.000000000 +0200
@@ -881,14 +881,17 @@ int assign_irq_vector(int irq)
return -ENOSPC;
vector_irq[op.u.irq_op.vector] = irq;
- if (irq != AUTO_ASSIGN)
- IO_APIC_VECTOR(irq) = op.u.irq_op.vector;
+ if (irq != AUTO_ASSIGN) {
+ u8 vector = cmpxchg(&IO_APIC_VECTOR(irq), 0, op.u.irq_op.vector);
+
+ BUG_ON(vector && vector != op.u.irq_op.vector);
+ }
return op.u.irq_op.vector;
}
-extern void (*interrupt[NR_IRQS])(void);
#ifndef CONFIG_XEN
+extern void (*interrupt[NR_IRQS])(void);
static struct hw_interrupt_type ioapic_level_type;
static struct hw_interrupt_type ioapic_edge_type;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2006-04-25 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-25 12:38 Jan Beulich [this message]
2006-04-25 12:48 ` [PATCH] linux: mor assign_irq_vector() adjustments Keir Fraser
-- strict thread matches above, loose matches on Subject: below --
2006-04-26 3:09 Tian, Kevin
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=444E3477.76E4.0078.0@novell.com \
--to=jbeulich@novell.com \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.