svn commit: r247877 - in stable/9/sys: amd64/include i386/include x86/x86

Andriy Gapon avg at FreeBSD.org
Wed Mar 6 09:22:47 UTC 2013


Author: avg
Date: Wed Mar  6 09:22:45 2013
New Revision: 247877
URL: http://svnweb.freebsd.org/changeset/base/247877

Log:
  MFC r246247: x86 suspend/resume: suspend pics and pseudo-pics in reverse order

Modified:
  stable/9/sys/amd64/include/intr_machdep.h
  stable/9/sys/i386/include/intr_machdep.h
  stable/9/sys/x86/x86/intr_machdep.c
  stable/9/sys/x86/x86/local_apic.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/include/intr_machdep.h
==============================================================================
--- stable/9/sys/amd64/include/intr_machdep.h	Wed Mar  6 09:22:10 2013	(r247876)
+++ stable/9/sys/amd64/include/intr_machdep.h	Wed Mar  6 09:22:45 2013	(r247877)
@@ -94,7 +94,7 @@ struct pic {
 	int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
 	    enum intr_polarity);
 	int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
-	STAILQ_ENTRY(pic) pics;
+	TAILQ_ENTRY(pic) pics;
 };
 
 /* Flags for pic_disable_source() */

Modified: stable/9/sys/i386/include/intr_machdep.h
==============================================================================
--- stable/9/sys/i386/include/intr_machdep.h	Wed Mar  6 09:22:10 2013	(r247876)
+++ stable/9/sys/i386/include/intr_machdep.h	Wed Mar  6 09:22:45 2013	(r247877)
@@ -94,7 +94,7 @@ struct pic {
 	int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
 	    enum intr_polarity);
 	int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
-	STAILQ_ENTRY(pic) pics;
+	TAILQ_ENTRY(pic) pics;
 };
 
 /* Flags for pic_disable_source() */

Modified: stable/9/sys/x86/x86/intr_machdep.c
==============================================================================
--- stable/9/sys/x86/x86/intr_machdep.c	Wed Mar  6 09:22:10 2013	(r247876)
+++ stable/9/sys/x86/x86/intr_machdep.c	Wed Mar  6 09:22:45 2013	(r247877)
@@ -78,7 +78,7 @@ static int intrcnt_index;
 static struct intsrc *interrupt_sources[NUM_IO_INTS];
 static struct mtx intr_table_lock;
 static struct mtx intrcnt_lock;
-static STAILQ_HEAD(, pic) pics;
+static TAILQ_HEAD(pics_head, pic) pics;
 
 #ifdef SMP
 static int assign_cpu;
@@ -102,7 +102,7 @@ intr_pic_registered(struct pic *pic)
 {
 	struct pic *p;
 
-	STAILQ_FOREACH(p, &pics, pics) {
+	TAILQ_FOREACH(p, &pics, pics) {
 		if (p == pic)
 			return (1);
 	}
@@ -124,7 +124,7 @@ intr_register_pic(struct pic *pic)
 	if (intr_pic_registered(pic))
 		error = EBUSY;
 	else {
-		STAILQ_INSERT_TAIL(&pics, pic, pics);
+		TAILQ_INSERT_TAIL(&pics, pic, pics);
 		error = 0;
 	}
 	mtx_unlock(&intr_table_lock);
@@ -287,7 +287,7 @@ intr_resume(void)
 	atpic_reset();
 #endif
 	mtx_lock(&intr_table_lock);
-	STAILQ_FOREACH(pic, &pics, pics) {
+	TAILQ_FOREACH(pic, &pics, pics) {
 		if (pic->pic_resume != NULL)
 			pic->pic_resume(pic);
 	}
@@ -300,7 +300,7 @@ intr_suspend(void)
 	struct pic *pic;
 
 	mtx_lock(&intr_table_lock);
-	STAILQ_FOREACH(pic, &pics, pics) {
+	TAILQ_FOREACH_REVERSE(pic, &pics, pics_head, pics) {
 		if (pic->pic_suspend != NULL)
 			pic->pic_suspend(pic);
 	}
@@ -381,7 +381,7 @@ intr_init(void *dummy __unused)
 
 	intrcnt_setname("???", 0);
 	intrcnt_index = 1;
-	STAILQ_INIT(&pics);
+	TAILQ_INIT(&pics);
 	mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF);
 	mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN);
 }

Modified: stable/9/sys/x86/x86/local_apic.c
==============================================================================
--- stable/9/sys/x86/x86/local_apic.c	Wed Mar  6 09:22:10 2013	(r247876)
+++ stable/9/sys/x86/x86/local_apic.c	Wed Mar  6 09:22:45 2013	(r247877)
@@ -1346,11 +1346,19 @@ apic_setup_io(void *dummy __unused)
 
 	if (best_enum == NULL)
 		return;
+
+	/*
+	 * Local APIC must be registered before other PICs and pseudo PICs
+	 * for proper suspend/resume order.
+	 */
+#ifndef XEN
+	intr_register_pic(&lapic_pic);
+#endif
+
 	retval = best_enum->apic_setup_io();
 	if (retval != 0)
 		printf("%s: Failed to setup I/O APICs: returned %d\n",
 		    best_enum->apic_name, retval);
-
 #ifdef XEN
 	return;
 #endif
@@ -1359,7 +1367,6 @@ apic_setup_io(void *dummy __unused)
 	 * properly program the LINT pins.
 	 */
 	lapic_setup(1);
-	intr_register_pic(&lapic_pic);
 	if (bootverbose)
 		lapic_dump("BSP");
 


More information about the svn-src-stable-9 mailing list