Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2009 19:56:06 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r192335 - in user/kmacy/releng_7_2_fcs/sys: amd64/amd64 i386/i386
Message-ID:  <200905181956.n4IJu6N4073250@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Mon May 18 19:56:06 2009
New Revision: 192335
URL: http://svn.freebsd.org/changeset/base/192335

Log:
  merge 188904
    - Resolve an issue where we may clear an idt while an interrupt on a
      different cpu is still assigned to that vector by never clearing idt
      entries.  This was only provided as a debugging feature and the bugs
      are caught by other means.
    - Drop the sched lock when rebinding to reassign an interrupt vector
      to a new cpu so that pending interrupts have a chance to be delivered
      before removing the old vector.
  
   Discussed with:       tegge, jhb

Modified:
  user/kmacy/releng_7_2_fcs/sys/amd64/amd64/local_apic.c
  user/kmacy/releng_7_2_fcs/sys/i386/i386/local_apic.c

Modified: user/kmacy/releng_7_2_fcs/sys/amd64/amd64/local_apic.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/amd64/amd64/local_apic.c	Mon May 18 19:54:34 2009	(r192334)
+++ user/kmacy/releng_7_2_fcs/sys/amd64/amd64/local_apic.c	Mon May 18 19:56:06 2009	(r192335)
@@ -887,7 +887,13 @@ apic_disable_vector(u_int apic_id, u_int
 	KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
 	KASSERT(ioint_handlers[vector / 32] != NULL,
 	    ("No ISR handler for vector %u", vector));
+#ifdef notyet
+	/*
+	 * We can not currently clear the idt entry because other cpus
+	 * may have a valid vector at this offset.
+	 */
 	setidt(vector, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
+#endif
 }
 
 /* Release an APIC vector when it's no longer in use. */
@@ -911,9 +917,11 @@ apic_free_vector(u_int apic_id, u_int ve
 	if (sched_is_bound(td))
 		panic("apic_free_vector: Thread already bound.\n");
 	sched_bind(td, apic_cpuid(apic_id));
+	thread_unlock(td);
 	mtx_lock_spin(&icu_lock);
 	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0;
 	mtx_unlock_spin(&icu_lock);
+	thread_lock(td);
 	sched_unbind(td);
 	thread_unlock(td);
 

Modified: user/kmacy/releng_7_2_fcs/sys/i386/i386/local_apic.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/i386/i386/local_apic.c	Mon May 18 19:54:34 2009	(r192334)
+++ user/kmacy/releng_7_2_fcs/sys/i386/i386/local_apic.c	Mon May 18 19:56:06 2009	(r192335)
@@ -890,8 +890,14 @@ apic_disable_vector(u_int apic_id, u_int
 	KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
 	KASSERT(ioint_handlers[vector / 32] != NULL,
 	    ("No ISR handler for vector %u", vector));
+#ifdef notyet
+	/*
+	 * We can not currently clear the idt entry because other cpus
+	 * may have a valid vector at this offset.
+	 */
 	setidt(vector, &IDTVEC(rsvd), SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
+#endif
 }
 
 /* Release an APIC vector when it's no longer in use. */
@@ -915,9 +921,11 @@ apic_free_vector(u_int apic_id, u_int ve
 	if (sched_is_bound(td))
 		panic("apic_free_vector: Thread already bound.\n");
 	sched_bind(td, apic_cpuid(apic_id));
+	thread_unlock(td);
 	mtx_lock_spin(&icu_lock);
 	lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = 0;
 	mtx_unlock_spin(&icu_lock);
+	thread_lock(td);
 	sched_unbind(td);
 	thread_unlock(td);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905181956.n4IJu6N4073250>