From: "Jan Beulich" Subject: [PATCH] x86: fix IRQ migration when using directed EOI (broken with c/s 20465) Date: Wed, 01 Dec 2010 10:42:10 +0000 Message-ID: <4CF6349202000078000251AB@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part664BD192.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part664BD192.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline In directed-EOI mode, there is no chance to do the migration in mask_and_ack_level_ioapic_irq(), as the remote IRR bit can't possibly be clear after issuing the EOI to the LAPIC. Consequently, there's no point to even try. Instead, migration must be done in end_level_ioapic_irq(), and it requires masking the interrupt source prior to issuing the EOI to the IO-APIC. Signed-off-by: Jan Beulich --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -1634,11 +1634,14 @@ static void mask_and_ack_level_ioapic_ir =20 ack_APIC_irq(); =20 + if ( directed_eoi_enabled ) + return; + if ((irq_desc[irq].status & IRQ_MOVE_PENDING) && !io_apic_level_ack_pending(irq)) - move_native_irq(irq); + move_masked_irq(irq); =20 - if (!directed_eoi_enabled && !(v & (1 << (i & 0x1f)))) { + if ( !(v & (1 << (i & 0x1f))) ) { atomic_inc(&irq_mis_count); spin_lock(&ioapic_lock); __edge_IO_APIC_irq(irq); @@ -1654,12 +1657,22 @@ static void end_level_ioapic_irq (unsign =20 if ( !ioapic_ack_new ) { - if ( irq_desc[irq].status & IRQ_DISABLED ) - return; - if ( directed_eoi_enabled ) + { + if ( !(irq_desc[irq].status & (IRQ_DISABLED|IRQ_MOVE_PENDING))= ) + { + eoi_IO_APIC_irq(irq); + return; + } + + mask_IO_APIC_irq(irq); eoi_IO_APIC_irq(irq); - else + if ( (irq_desc[irq].status & IRQ_MOVE_PENDING) && + !io_apic_level_ack_pending(irq) ) + move_masked_irq(irq); + } + + if ( !(irq_desc[irq].status & IRQ_DISABLED) ) unmask_IO_APIC_irq(irq); =20 return; --=__Part664BD192.0__= Content-Type: text/plain; name="x86-irq-migrate-directed-eoi.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-irq-migrate-directed-eoi.patch" In directed-EOI mode, there is no chance to do the migration in=0Amask_and_= ack_level_ioapic_irq(), as the remote IRR bit can't possibly=0Abe clear = after issuing the EOI to the LAPIC. Consequently, there's no=0Apoint to = even try. Instead, migration must be done in=0Aend_level_ioapic_irq(), and = it requires masking the interrupt source=0Aprior to issuing the EOI to the = IO-APIC.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/arch/x86/io_apic.c=0A+++ b/xen/arch/x86/io_apic.c=0A@@ -1634,11 = +1634,14 @@ static void mask_and_ack_level_ioapic_ir=0A =0A ack_APIC_ir= q();=0A =0A+ if ( directed_eoi_enabled )=0A+ return;=0A+=0A = if ((irq_desc[irq].status & IRQ_MOVE_PENDING) &&=0A !io_apic_leve= l_ack_pending(irq))=0A- move_native_irq(irq);=0A+ move_masked= _irq(irq);=0A =0A- if (!directed_eoi_enabled && !(v & (1 << (i & = 0x1f)))) {=0A+ if ( !(v & (1 << (i & 0x1f))) ) {=0A atomic_inc(&= irq_mis_count);=0A spin_lock(&ioapic_lock);=0A __edge_IO_AP= IC_irq(irq);=0A@@ -1654,12 +1657,22 @@ static void end_level_ioapic_irq = (unsign=0A =0A if ( !ioapic_ack_new )=0A {=0A- if ( = irq_desc[irq].status & IRQ_DISABLED )=0A- return;=0A-=0A = if ( directed_eoi_enabled )=0A+ {=0A+ if ( !(irq_desc[ir= q].status & (IRQ_DISABLED|IRQ_MOVE_PENDING)) )=0A+ {=0A+ = eoi_IO_APIC_irq(irq);=0A+ return;=0A+ = }=0A+=0A+ mask_IO_APIC_irq(irq);=0A eoi_IO_APIC_irq(= irq);=0A- else=0A+ if ( (irq_desc[irq].status & = IRQ_MOVE_PENDING) &&=0A+ !io_apic_level_ack_pending(irq) = )=0A+ move_masked_irq(irq);=0A+ }=0A+=0A+ if = ( !(irq_desc[irq].status & IRQ_DISABLED) )=0A unmask_IO_APIC_ir= q(irq);=0A =0A return;=0A --=__Part664BD192.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part664BD192.0__=--