Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jan 2011 00:20:14 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216862 - head/sys/mips/mips
Message-ID:  <201101010020.p010KEk5092972@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmallett
Date: Sat Jan  1 00:20:14 2011
New Revision: 216862
URL: http://svn.freebsd.org/changeset/base/216862

Log:
  o) When trying to determine whether the pcpu pointer is a managed address, check
     not just that it is greater than the minimal kernel virtual address, but also
     that it is less than the maximal kernel virtual address.  On n64 kernels, the
     pcpup comes out of a direct-mapped address that, with an unsigned compare, is
     rather greater than the minimal kernel virtual address.
  o) Turn the panic if interrupts are disabled in cpu_idle into a KASSERT since on
     other architectures it's behind INVARIANTS anyway.
  o) Add a check that not all interrupts are masked, too.
  o) Add cpu_idleclock() and cpu_activeclock() use to cpu_idle as is done on other
     architectures.

Modified:
  head/sys/mips/mips/machdep.c

Modified: head/sys/mips/mips/machdep.c
==============================================================================
--- head/sys/mips/mips/machdep.c	Fri Dec 31 22:49:13 2010	(r216861)
+++ head/sys/mips/mips/machdep.c	Sat Jan  1 00:20:14 2011	(r216862)
@@ -426,8 +426,10 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
 	pcpu->pc_next_asid = 1;
 	pcpu->pc_asid_generation = 1;
 #ifdef SMP
-	if ((vm_offset_t)pcpup >= VM_MIN_KERNEL_ADDRESS)
+	if ((vm_offset_t)pcpup >= VM_MIN_KERNEL_ADDRESS &&
+	    (vm_offset_t)pcpup <= VM_MAX_KERNEL_ADDRESS) {
 		mips_pcpu_tlb_init(pcpu);
+	}
 #endif
 }
 
@@ -483,10 +485,20 @@ spinlock_exit(void)
 void
 cpu_idle(int busy)
 {
-	if (mips_rd_status() & MIPS_SR_INT_IE)
-		__asm __volatile ("wait");
-	else
-		panic("ints disabled in idleproc!");
+	KASSERT((mips_rd_status() & MIPS_SR_INT_IE) != 0,
+		("interrupts disabled in idle process."));
+	KASSERT((mips_rd_status() & MIPS_INT_MASK) != 0,
+		("all interrupts masked in idle process."));
+
+	if (!busy) {
+		critical_enter();
+		cpu_idleclock();
+	}
+	__asm __volatile ("wait");
+	if (!busy) {
+		cpu_activeclock();
+		critical_exit();
+	}
 }
 
 int



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