Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2010 05:10:10 +0000 (UTC)
From:      Randall Stewart <rrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r203008 - head/sys/mips/rmi
Message-ID:  <201001260510.o0Q5AASp086583@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rrs
Date: Tue Jan 26 05:10:10 2010
New Revision: 203008
URL: http://svn.freebsd.org/changeset/base/203008

Log:
  Fix up the msg ring driver a bit tighter
  so that we don't loose an interrupt which
  we appeared to be doing.

Modified:
  head/sys/mips/rmi/xlr_machdep.c

Modified: head/sys/mips/rmi/xlr_machdep.c
==============================================================================
--- head/sys/mips/rmi/xlr_machdep.c	Tue Jan 26 05:07:41 2010	(r203007)
+++ head/sys/mips/rmi/xlr_machdep.c	Tue Jan 26 05:10:10 2010	(r203008)
@@ -352,14 +352,6 @@ mips_init(void)
 
 	mips_cpu_init();
 	pmap_bootstrap();
-
-	mips_proc0_init();
-	write_c0_register32(MIPS_COP_0_OSSCRATCH, 7, pcpup->pc_curthread);
-
-	mutex_init();
-
-	PMAP_LOCK_INIT(kernel_pmap);
-
 #ifdef DDB
 #ifdef SMP
 	setup_nmi();
@@ -369,6 +361,9 @@ mips_init(void)
 		kdb_enter("Boot flags requested debugger", NULL);
 	}
 #endif
+	mips_proc0_init();
+	write_c0_register32(MIPS_COP_0_OSSCRATCH, 7, pcpup->pc_curthread);
+	mutex_init();
 }
 
 void
@@ -604,31 +599,26 @@ msgring_process_fast_intr(void *arg)
 {
 	int cpu = PCPU_GET(cpuid);
 	volatile struct msgring_ithread *it;
-	struct proc *p;
 	struct thread *td;
 
 	/* wakeup an appropriate intr_thread for processing this interrupt */
 	it = (volatile struct msgring_ithread *)&msgring_ithreads[cpu];
 	td = it->i_thread;
-	p = td->td_proc;
 
 	/*
 	 * Interrupt thread will enable the interrupts after processing all
 	 * messages
 	 */
 	disable_msgring_int(NULL);
+	atomic_store_rel_int(&it->i_pending, 1);
 	thread_lock(td);
-	it->i_pending = 1;
 	if (TD_AWAITING_INTR(td)) {
-		CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, p->p_pid,
-		    p->p_comm);
 		TD_CLR_IWAIT(td);
 		sched_add(td, SRQ_INTR);
 	}
 	thread_unlock(td);
 }
 
-#define MIT_DEAD 4
 static void
 msgring_process(void *arg)
 {
@@ -650,22 +640,17 @@ msgring_process(void *arg)
 	//printf("Started %s on CPU %d\n", __FUNCTION__, ithd->i_cpu);
 
 	while (1) {
-		if (ithd->i_flags & MIT_DEAD) {
-			CTR3(KTR_INTR, "%s: pid %d (%s) exiting", __func__,
-			    p->p_pid, p->p_comm);
-			kthread_exit();
-		}
 		while (ithd->i_pending) {
 			/*
 			 * This might need a full read and write barrier to
 			 * make sure that this write posts before any of the
 			 * memory or device accesses in the handlers.
 			 */
-			atomic_store_rel_int(&ithd->i_pending, 0);
 			xlr_msgring_handler(NULL);
+			atomic_store_rel_int(&ithd->i_pending, 0);
+			enable_msgring_int(NULL);
 		}
-		enable_msgring_int(NULL);
-		if (!ithd->i_pending && !(ithd->i_flags & MIT_DEAD)) {
+		if (!ithd->i_pending) {
 			thread_lock(td);
 			if (ithd->i_pending) {
 			  thread_unlock(td);



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